MCPcopy
hub / github.com/cayleygraph/cayley / init

Function init

graph/sql/sqlite/sqlite.go:29–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27}
28
29func init() {
30 regex := func(re, s string) (bool, error) {
31 return regexp.MatchString(re, s)
32 }
33 sql.Register("sqlite3-regexp",
34 &sqlite3.SQLiteDriver{
35 ConnectHook: func(conn *sqlite3.SQLiteConn) error {
36 return conn.RegisterFunc("regexp", regex, true)
37 },
38 })
39 csql.Register(Type, csql.Registration{
40 Driver: "sqlite3-regexp",
41 HashType: fmt.Sprintf(`BINARY(%d)`, quad.HashSize),
42 BytesType: `BLOB`,
43 HorizonType: `INTEGER`,
44 TimeType: `DATETIME`,
45 QueryDialect: QueryDialect,
46 NoOffsetWithoutLimit: true,
47 NoForeignKeys: true,
48 Error: func(err error) error {
49 return err
50 },
51 Estimated: nil,
52 RunTx: runTxSqlite,
53 })
54}
55
56func runTxSqlite(tx *sql.Tx, nodes []graphlog.NodeUpdate, quads []graphlog.QuadUpdate, opts graph.IgnoreOpts) error {
57 // update node ref counts and insert nodes

Callers

nothing calls this directly

Calls 1

RegisterFunction · 0.92

Tested by

no test coverage detected