static_mock.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. // +build !cgo
  6. package sqlite3
  7. import (
  8. "database/sql"
  9. "database/sql/driver"
  10. "errors"
  11. )
  12. var errorMsg = errors.New("Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub")
  13. func init() {
  14. sql.Register("sqlite3", &SQLiteDriver{})
  15. }
  16. type (
  17. SQLiteDriver struct {
  18. Extensions []string
  19. ConnectHook func(*SQLiteConn) error
  20. }
  21. SQLiteConn struct{}
  22. )
  23. func (SQLiteDriver) Open(s string) (driver.Conn, error) { return nil, errorMsg }
  24. func (c *SQLiteConn) RegisterAggregator(string, interface{}, bool) error { return errorMsg }
  25. func (c *SQLiteConn) RegisterAuthorizer(func(int, string, string, string) int) {}
  26. func (c *SQLiteConn) RegisterCollation(string, func(string, string) int) error { return errorMsg }
  27. func (c *SQLiteConn) RegisterCommitHook(func() int) {}
  28. func (c *SQLiteConn) RegisterFunc(string, interface{}, bool) error { return errorMsg }
  29. func (c *SQLiteConn) RegisterRollbackHook(func()) {}
  30. func (c *SQLiteConn) RegisterUpdateHook(func(int, string, string, int64)) {}