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