From 79a80cc3f1eab54bce5fe2651093c414d6ee4ce3 Mon Sep 17 00:00:00 2001 From: David Vassallo Date: Mon, 10 Oct 2022 10:01:17 +0300 Subject: [PATCH] Updating vtable example, "BestIndex" method 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 --- _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 1d6d824a..dd457eac 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 }