From 4b8633cceb34c8b04fb740efef9b79e50fedbcca Mon Sep 17 00:00:00 2001 From: David Vassallo Date: Wed, 19 Oct 2022 02:04:52 +0300 Subject: [PATCH] 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 Signed-off-by: David Vassallo --- _example/vtable/vtable.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/_example/vtable/vtable.go b/_example/vtable/vtable.go index 1d6d824..dd457ea 100644 --- a/_example/vtable/vtable.go +++ b/_example/vtable/vtable.go @@ -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 }