Files
sqlite3/vtab.go

91 lines
2.0 KiB
Go
Raw Normal View History

2023-11-10 13:23:14 +00:00
package sqlite3
2023-11-14 13:56:27 +00:00
// https://sqlite.org/vtab.html#xconnect
2023-11-10 13:23:14 +00:00
type Module interface {
2023-11-14 13:56:27 +00:00
Connect(db *Conn, arg ...string) (VTab, error)
2023-11-10 13:23:14 +00:00
}
2023-11-14 13:56:27 +00:00
// https://sqlite.org/vtab.html#xcreate
2023-11-10 13:23:14 +00:00
type ModuleCreator interface {
Module
2023-11-14 13:56:27 +00:00
Create(db *Conn, arg ...string) (VTabDestroyer, error)
2023-11-10 13:23:14 +00:00
}
2023-11-14 13:56:27 +00:00
type VTab interface {
// https://sqlite.org/vtab.html#xbestindex
2023-11-10 13:23:14 +00:00
BestIndex(*IndexInfo) error
2023-11-14 13:56:27 +00:00
// https://sqlite.org/vtab.html#xdisconnect
2023-11-10 13:23:14 +00:00
Disconnect() error
2023-11-14 13:56:27 +00:00
// https://sqlite.org/vtab.html#xopen
Open() (VTabCursor, error)
}
// https://sqlite.org/vtab.html#sqlite3_module.xDestroy
type VTabDestroyer interface {
VTab
2023-11-10 13:23:14 +00:00
Destroy() error
}
2023-11-14 13:56:27 +00:00
// https://sqlite.org/vtab.html#xupdate
type VTabUpdater interface {
VTab
2023-11-10 13:23:14 +00:00
Update(arg ...Value) (rowid int64, err error)
}
2023-11-14 13:56:27 +00:00
// https://sqlite.org/vtab.html#xrename
type VTabRenamer interface {
VTab
2023-11-10 13:23:14 +00:00
Rename(new string) error
}
2023-11-14 13:56:27 +00:00
// https://sqlite.org/vtab.html#xfindfunction
type VTabOverloader interface {
VTab
FindFunction(arg int, name string) (func(ctx Context, arg ...Value), IndexConstraint)
2023-11-10 13:23:14 +00:00
}
2023-11-14 13:56:27 +00:00
// https://sqlite.org/vtab.html#xintegrity
type VTabChecker interface {
VTab
2023-11-10 13:23:14 +00:00
Integrity(schema, table string, flags int) error
}
2023-11-14 13:56:27 +00:00
type VTabTx interface {
VTab
// https://sqlite.org/vtab.html#xBegin
2023-11-10 13:23:14 +00:00
Begin() error
2023-11-14 13:56:27 +00:00
// https://sqlite.org/vtab.html#xsync
2023-11-10 13:23:14 +00:00
Sync() error
2023-11-14 13:56:27 +00:00
// https://sqlite.org/vtab.html#xcommit
2023-11-10 13:23:14 +00:00
Commit() error
2023-11-14 13:56:27 +00:00
// https://sqlite.org/vtab.html#xrollback
2023-11-10 13:23:14 +00:00
Rollback() error
}
2023-11-14 13:56:27 +00:00
// https://sqlite.org/vtab.html#xsavepoint
type VTabSavepointer interface {
VTabTx
Savepoint(id int) error
Release(id int) error
RollbackTo(id int) error
2023-11-10 13:23:14 +00:00
}
2023-11-14 13:56:27 +00:00
type VTabCursor interface {
// https://sqlite.org/vtab.html#xclose
2023-11-10 13:23:14 +00:00
Close() error
2023-11-14 13:56:27 +00:00
// https://sqlite.org/vtab.html#xfilter
Filter(idxNum int, idxStr string, arg ...Value) error
// https://sqlite.org/vtab.html#xnext
2023-11-10 13:23:14 +00:00
Next() error
2023-11-14 13:56:27 +00:00
// https://sqlite.org/vtab.html#xeof
EOF() bool
// https://sqlite.org/vtab.html#xcolumn
2023-11-10 13:23:14 +00:00
Column(ctx *Context, n int) error
2023-11-14 13:56:27 +00:00
// https://sqlite.org/vtab.html#xrowid
RowID() (int64, error)
2023-11-10 13:23:14 +00:00
}
type IndexInfo struct{}
2023-11-14 13:56:27 +00:00
type IndexConstraint uint8