sqlitekv

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2025 License: MIT Imports: 8 Imported by: 0

README

sqlitekv

KV on Sqlite DB

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

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

func (*Collection) Get

func (c *Collection) Get(ctx context.Context, key string, fn GetFn) (ok bool, err error)

func (*Collection) GetById

func (c *Collection) GetById(ctx context.Context, id int64, fn GetFn) (err error)

func (*Collection) List

func (c *Collection) List(ctx context.Context, keyPrefix string, fn GetFn, opts ListOptions) (err error)

func (*Collection) Put

func (c *Collection) Put(ctx context.Context, key string, buf []byte) (rowid int64, err error)

func (*Collection) Select

func (c *Collection) Select(ctx context.Context, rowfn RowFn, opts SelectOptions) (err error)

type CollectionOptions

type CollectionOptions struct {
	Delimiter string
	Columns   []GeneratedColumn
	Indexes   []string
}

type Counter

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

func NewCounter

func NewCounter(col *Collection, key string, opts CounterOptions) (c *Counter, err error)

func (*Counter) Next

func (c *Counter) Next(ctx context.Context) (counter int64, err error)

type CounterOptions

type CounterOptions struct {
	StartCount   int64
	ReserveCount int64
}

type GeneratedColumn

type GeneratedColumn struct {
	Name    string
	Type    string
	Def     string
	Storage string
}

type GetColumnValueFn

type GetColumnValueFn func(i int) (val any, ok bool, err error)

type GetFn

type GetFn func(id int64, key string, rawJson []byte, genColVals []any) error

type KV

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

func Open

func Open(dbpath string, opts *Options) (kv *KV, err error)

func (*KV) Close

func (kv *KV) Close() (err error)

func (*KV) Collection

func (kv *KV) Collection(name string, opts *CollectionOptions) (col *Collection, err error)

func (*KV) DefaultCollection

func (kv *KV) DefaultCollection() *Collection

func (*KV) JsonCollection

func (kv *KV) JsonCollection(name string, opts *CollectionOptions) (col *Collection, err error)

func (*KV) WithTx

func (kv *KV) WithTx(fn func() error) (err error)

type ListOptions

type ListOptions struct {
	OrderBy    []string
	Descending bool
	All        bool
}

type Options

type Options struct {
	JournalMode       string
	BusyRetryInterval time.Duration
}

type RowFn

type RowFn func(fn GetColumnValueFn) error

type SelectOptions

type SelectOptions struct {
	TableAlias string
	Columns    []string
	Where      string
	OrderBy    []string
	Limit      int
}

Directories

Path Synopsis
cmd
kvtest command

Jump to

Keyboard shortcuts

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