connectorsqlite

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

The connectorsqlite package has ready-made "database/sql/driver.Connector" for "github.com/mattn/go-sqlite3"

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnector

func NewConnector(ctx context.Context, filename string) (driver.Connector, error)
Example
// For more information, visit https://github.com/senzing-garage/go-databasing/blob/main/connectorsqlite/connectorsqlite_examples_test.go
ctx := context.TODO()
configuration := "/tmp/sqlite/G2C.db"
databaseConnector, err := NewConnector(ctx, configuration)
if err != nil {
	fmt.Println(err, databaseConnector)
}
Output:

Types

type Sqlite

type Sqlite struct {
	Filename string
}

Connector represents a fixed configuration for the pq driver with a given name. Connector satisfies the database/sql/driver Connector interface and can be used to create any number of DB Conn's via the database/sql OpenDB function.

See https://golang.org/pkg/database/sql/driver/#Connector. See https://golang.org/pkg/database/sql/#OpenDB.

func (*Sqlite) Connect

func (connector *Sqlite) Connect(_ context.Context) (driver.Conn, error)

Connect returns a connection to the database using the fixed configuration of this Connector. Context is not used.

func (*Sqlite) Driver

func (connector *Sqlite) Driver() driver.Driver

Driver returns the underlying driver of this Connector.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL