Chore: Make cgo optional (for sqlite) (#108756)

* make cgo optional for sqlite

* update go.mod; check error code differently

* reduce api surface even more

* move test errors into sqlite package

* add a comment
This commit is contained in:
Serge Zaitsev
2025-07-31 09:25:19 +00:00
committed by GitHub
parent f39b878b0a
commit 6b1143565a
15 changed files with 160 additions and 41 deletions
+2 -6
View File
@@ -11,8 +11,8 @@ import (
"regexp"
"strings"
"github.com/grafana/grafana/pkg/util/sqlite"
"github.com/grafana/grafana/pkg/util/xorm/core"
sqlite "github.com/mattn/go-sqlite3"
)
var (
@@ -476,11 +476,7 @@ func (db *sqlite3) Filters() []core.Filter {
}
func (db *sqlite3) RetryOnError(err error) bool {
var sqlError sqlite.Error
if errors.As(err, &sqlError) && (sqlError.Code == sqlite.ErrLocked || sqlError.Code == sqlite.ErrBusy) {
return true
}
return false
return sqlite.IsBusyOrLocked(err)
}
type sqlite3Driver struct {