static_mock.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright (C) 2019 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
  2. //
  3. // Use of this source code is governed by an MIT-style
  4. // license that can be found in the LICENSE file.
  5. //go:build !cgo
  6. // +build !cgo
  7. package sqlite3
  8. import (
  9. "database/sql"
  10. "database/sql/driver"
  11. "errors"
  12. )
  13. var errorMsg = errors.New("Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub")
  14. func init() {
  15. sql.Register("sqlite3", &SQLiteDriver{})
  16. }
  17. type (
  18. SQLiteDriver struct {
  19. Extensions []string
  20. ConnectHook func(*SQLiteConn) error
  21. }
  22. SQLiteConn struct{}
  23. )
  24. func (SQLiteDriver) Open(s string) (driver.Conn, error) { return nil, errorMsg }
  25. func (c *SQLiteConn) RegisterAggregator(string, any, bool) error { return errorMsg }
  26. func (c *SQLiteConn) RegisterAuthorizer(func(int, string, string, string) int) {}
  27. func (c *SQLiteConn) RegisterCollation(string, func(string, string) int) error { return errorMsg }
  28. func (c *SQLiteConn) RegisterCommitHook(func() int) {}
  29. func (c *SQLiteConn) RegisterFunc(string, any, bool) error { return errorMsg }
  30. func (c *SQLiteConn) RegisterRollbackHook(func()) {}
  31. func (c *SQLiteConn) RegisterUpdateHook(func(int, string, string, int64)) {}