dbo

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(file string) (*sql.DB, error)

Types

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type DeleteParams

type DeleteParams struct {
	Namespace string
	Key       string
}

type GetParams

type GetParams struct {
	Namespace string
	Key       string
}

type GetRow

type GetRow struct {
	Value       []byte
	ExpireAt    sql.NullInt64
	ContentType string
}

type ListNextParams

type ListNextParams struct {
	Namespace string
	ID        int64
	Limit     int64
}

type ListStartParams

type ListStartParams struct {
	Namespace string
	Limit     int64
}

type PutParams

type PutParams struct {
	Namespace   string
	Key         string
	Value       []byte
	ExpireAt    sql.NullInt64
	ContentType string
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) Delete

func (q *Queries) Delete(ctx context.Context, arg DeleteParams) error

func (*Queries) DeleteExpired

func (q *Queries) DeleteExpired(ctx context.Context) error

func (*Queries) DeleteNamespace

func (q *Queries) DeleteNamespace(ctx context.Context, namespace string) error

func (*Queries) Get

func (q *Queries) Get(ctx context.Context, arg GetParams) (GetRow, error)

func (*Queries) ListNext

func (q *Queries) ListNext(ctx context.Context, arg ListNextParams) ([]ValueKey, error)

func (*Queries) ListStart

func (q *Queries) ListStart(ctx context.Context, arg ListStartParams) ([]ValueKey, error)

TODO: unixepoch to unixepoch('subsec') once modernc/sqlite will switch to 3.42

func (*Queries) Put

func (q *Queries) Put(ctx context.Context, arg PutParams) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type Value

type Value struct {
	ID          int64
	ExpireAt    sql.NullInt64
	ContentType string
	Namespace   string
	Key         string
	Value       []byte
}

type ValueKey

type ValueKey struct {
	ID        int64
	Key       string
	Namespace string
	ExpireAt  sql.NullInt64
}

Jump to

Keyboard shortcuts

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