MCPcopy Create free account
hub / github.com/mattn/go-sqlite3 / Create

Method Create

_example/vtable/vtable.go:23–42  ·  view source on GitHub ↗
(c *sqlite3.SQLiteConn, args []string)

Source from the content-addressed store, hash-verified

21}
22
23func (m *githubModule) Create(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTab, error) {
24 // args holds the raw xCreate arguments: args[0] is the module name,
25 // args[1] the database name, args[2] the virtual table name, and any
26 // user arguments follow.
27 if len(args) < 3 {
28 return nil, fmt.Errorf("githubModule: unexpected arguments: %v", args)
29 }
30 tableName := `"` + strings.ReplaceAll(args[2], `"`, `""`) + `"`
31 err := c.DeclareVTab(fmt.Sprintf(`
32 CREATE TABLE %s (
33 id INT,
34 full_name TEXT,
35 description TEXT,
36 html_url TEXT
37 )`, tableName))
38 if err != nil {
39 return nil, err
40 }
41 return &ghRepoTable{}, nil
42}
43
44func (m *githubModule) Connect(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTab, error) {
45 return m.Create(c, args)

Callers 1

ConnectMethod · 0.95

Calls 1

DeclareVTabMethod · 0.80

Tested by

no test coverage detected