Skip to content

Commit

Permalink
Updating vtable example, "BestIndex" method (#1099)
Browse files Browse the repository at this point in the history
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 <davevassallo@gmail.com>

Signed-off-by: David Vassallo <davevassallo@gmail.com>
  • Loading branch information
dvas0004 authored Oct 18, 2022
1 parent 0b37084 commit 4b8633c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion _example/vtable/vtable.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ func (v *ghRepoTable) Open() (sqlite3.VTabCursor, error) {
}

func (v *ghRepoTable) BestIndex(cst []sqlite3.InfoConstraint, ob []sqlite3.InfoOrderBy) (*sqlite3.IndexResult, error) {
return &sqlite3.IndexResult{}, nil
used := make([]bool, len(csts))
return &sqlite3.IndexResult{
IdxNum: 0,
IdxStr: "default",
Used: used,
}, nil
}

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

0 comments on commit 4b8633c

Please sign in to comment.