driver

package
v0.0.0-...-d0f7b5f Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2018 License: MIT Imports: 4 Imported by: 0

README

Built with sqlite3 amalgamation version 3.14.1 using the following options: SQLITE_THREADSAFE SQLITE_ENABLE_DBSTAT_VTAB SQLITE_ENABLE_RTREE SQLITE_ENABLE_JSON1 SQLITE_ENABLE_FTS5 SQLITE_ENABLE_SOUNDEX SQLITE_ENABLE_ICU

PCRE is dynamically linked against to support regexp.

Additionally ext/misc/{series,nextchar,spellfix}.c from the sqlite repo are required

sqlite3_mod_regexp.c is from github.com/mattn/go-sqlite3

For a different version you must rm shell.c before compiling or it will mess with cgo.

Documentation

Overview

Package driver is a limited, specialized binding to a customized SQLite.

Index

Constants

This section is empty.

Variables

View Source
var (
	//NotImplemented is returned when this package is
	//compiled without cgo.
	NotImplemented = errors.New("not implemented")
)

Functions

func Init

func Init() error

Init the sqlite engine and its extensions.

Types

type BulkLoader

type BulkLoader struct {
	// contains filtered or unexported fields
}

BulkLoader is a reverse iterator for shoveling data into SQLite.

func (*BulkLoader) Close

func (b *BulkLoader) Close() error

Close flushes any remaining rows. It does not Close the underlying prepared statement.

func (*BulkLoader) Load

func (b *BulkLoader) Load(vs []*string) error

Load queues a row for loading and loads many rows in bulk when an internal limit is hit

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

A Conn represents a connection to an underlying sqlite database.

func Open

func Open(name string) (*Conn, error)

Open db name.

func (*Conn) Assert

func (c *Conn) Assert(query string) (bool, error)

Assert a subquery, ensuring it returns a bool.

func (*Conn) Close

func (c *Conn) Close() error

Close the db connection.

func (*Conn) Prepare

func (c *Conn) Prepare(query string) (*Stmt, error)

Prepare a query.

type ErrDriverMisuse

type ErrDriverMisuse struct {
	// contains filtered or unexported fields
}

func (ErrDriverMisuse) Error

func (e ErrDriverMisuse) Error() string

type Iter

type Iter struct {
	// contains filtered or unexported fields
}

Iter represents iterator over the results of a query.

func (*Iter) Err

func (i *Iter) Err() error

Err reports any error encountered during iteration.

func (*Iter) Next

func (i *Iter) Next() bool

Next reports whether there is a next result.

func (*Iter) Row

func (i *Iter) Row() []*string

Row returns a copy of the current row.

type Stmt

type Stmt struct {
	// contains filtered or unexported fields
}

A Stmt is a prepared query. Stmt exposes a number of APIs depending on the kind of query and its intended use.

The most common is a statement that may return 0 or more results. For that there is Iter.

A statement that loads into the database uses BulkLoad.

Occasionally it's known that a statement returns no results, accepts no parameters, and is used only once. For that, there is Exec.

func (*Stmt) Close

func (s *Stmt) Close() error

Close the prepared statement.

func (*Stmt) Columns

func (s *Stmt) Columns() []string

Columns reports the columns returned by this query.

func (*Stmt) Exec

func (s *Stmt) Exec() error

Exec executes a statement that takes no parameters and returns no results.

func (*Stmt) Iter

func (s *Stmt) Iter() (*Iter, error)

Iter returns an iterator over the results of the query.

func (*Stmt) Loader

func (s *Stmt) Loader() (*BulkLoader, error)

Loader creates a bulk loader.

func (*Stmt) String

func (s *Stmt) String() string

String returns the string used to create this prepared statement.

func (*Stmt) Subquery

func (s *Stmt) Subquery() (*string, error)

Subquery emulates running the query in s as a subquery.

Jump to

Keyboard shortcuts

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