Skip to content

Commit 4b8633c

Browse files
authored
Updating vtable example, "BestIndex" method (#1099)
As it was, the vtable example will give an error when adding any kind of SQL constraint in the SQL statement. Updating the BestIndex method will ensure that adding SQL constraints will not result in errors Signed-off-by: David Vassallo <[email protected]> Signed-off-by: David Vassallo <[email protected]>
1 parent 0b37084 commit 4b8633c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: _example/vtable/vtable.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ func (v *ghRepoTable) Open() (sqlite3.VTabCursor, error) {
6363
}
6464

6565
func (v *ghRepoTable) BestIndex(cst []sqlite3.InfoConstraint, ob []sqlite3.InfoOrderBy) (*sqlite3.IndexResult, error) {
66-
return &sqlite3.IndexResult{}, nil
66+
used := make([]bool, len(csts))
67+
return &sqlite3.IndexResult{
68+
IdxNum: 0,
69+
IdxStr: "default",
70+
Used: used,
71+
}, nil
6772
}
6873

6974
func (v *ghRepoTable) Disconnect() error { return nil }

0 commit comments

Comments
 (0)