0
0
mirror of https://github.com/mattn/go-sqlite3.git synced 2025-05-24 14:54:48 +00:00
Files
go-sqlite3/driver/connector.go
Gert-Jan Timmer 7c7d9c8ce5 Update
* Increase coverage of backup tests
* FormatDSN
* Rewrite C.in to types for Stringer implementation
* Add PRAGMA func
* Fix TestPinger
* Driver, DriverContext => Fix Extensions, ConnectHook
* Add Stringer to CryptEncoder, CryptSaltedEncoder
* Fix OpenConnector
* Renamed context to vtable_context and include build tag
2018-06-24 22:57:57 +02:00

35 lines
727 B
Go

// Copyright (C) 2018 The Go-SQLite3 Authors.
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
// +build cgo
// +build go1.10
package sqlite3
import (
"context"
"database/sql/driver"
)
var (
_ driver.Connector = (*Config)(nil)
)
// Connect implements driver.Connector interface.
// Connect returns a connection to the database.
func (c *Config) Connect(ctx context.Context) (driver.Conn, error) {
return c.createConnection()
}
// Driver implements driver.Connector interface.
// Driver returns &SQLiteDriver{}.
func (c *Config) Driver() driver.Driver {
return &SQLiteDriver{
Config: c,
Extensions: c.Extensions,
ConnectHook: c.ConnectHook,
}
}