sqlite

package
v0.0.0-...-90b5d9c Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoConnection = errors.New("no connection")

Functions

func FromSecs

func FromSecs(s float64) time.Time

func InSavepoint

func InSavepoint(ctx context.Context, conn *sqlite.Conn, name string, transaction func() error) (err error)

func QuoteIdentifier

func QuoteIdentifier(s string) string

func QuoteText

func QuoteText(s string) string

func ToSecs

func ToSecs(t time.Time) float64

Types

type DB

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

func NewFileDB

func NewFileDB(ctx context.Context, path string, poolSize int) (*DB, error)

func NewMemoryDB

func NewMemoryDB(ctx context.Context, poolSize int) (*DB, error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) CreateRunner

func (db *DB) CreateRunner(ctx context.Context, runner *com.Runner) error

func (*DB) GetRunnerByToken

func (db *DB) GetRunnerByToken(ctx context.Context, token string, getDeleted bool) (*com.Runner, error)

func (*DB) GetRunnerTags

func (db *DB) GetRunnerTags(ctx context.Context, runner *com.Runner) error

func (*DB) Migrate

func (db *DB) Migrate(ctx context.Context) error

func (*DB) SetRunnerUpdatedTime

func (db *DB) SetRunnerUpdatedTime(ctx context.Context, runner *com.Runner, t time.Time) error

func (*DB) TagRunner

func (db *DB) TagRunner(ctx context.Context, runner *com.Runner, tags []string) (err error)

TagRunner associates the given tags to the runner and vice-versa.

type Patch

type Patch interface {
	Name() string
	Component() string
	Version() int
	Apply(ctx context.Context, conn *sqlite.Conn) error
}

type PatchSet

type PatchSet []Patch

func (PatchSet) Apply

func (ps PatchSet) Apply(ctx context.Context, conn *sqlite.Conn) error

type ReleaseError

type ReleaseError struct {
	Savepoint string
	Err       error
}

func (*ReleaseError) Error

func (e *ReleaseError) Error() string

type RollbackError

type RollbackError struct {
	Savepoint      string
	Err            error
	TransactionErr error
}

func (*RollbackError) Error

func (e *RollbackError) Error() string

type SimplePatch

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

func NewSimplePatch

func NewSimplePatch(name, component string, version int, apply func(context.Context, *sqlite.Conn) error) *SimplePatch

func StatementPatch

func StatementPatch(name, component string, version int, sqlStatements ...string) *SimplePatch

func (*SimplePatch) Apply

func (p *SimplePatch) Apply(ctx context.Context, conn *sqlite.Conn) error

func (*SimplePatch) Component

func (p *SimplePatch) Component() string

func (*SimplePatch) Name

func (p *SimplePatch) Name() string

func (*SimplePatch) Version

func (p *SimplePatch) Version() int

Jump to

Keyboard shortcuts

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