sqlitestore

package
v0.0.0-...-4ae06c5 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InArgs

func InArgs[T Column](tt []T) (string, []any)

InArgs returns placeholders and args formatted for a WHERE IN clause. Calling InArgs([]int{1,2,3}) will return ("?,?,?", []any{1,2,3}).

Types

type Column

type Column interface {
	~byte | ~int16 | ~int32 | ~int64 | ~float64 |
		~string | ~bool | time.Time
}

Column is a type constraint for types representing a single database column.

type SQliteStore

type SQliteStore[T any, R store.Row[T]] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewStore

func NewStore[T any, R store.Row[T]](path string) (*SQliteStore[T, R], error)

func (*SQliteStore[T, R]) Close

func (o *SQliteStore[T, R]) Close() error

func (*SQliteStore[T, R]) DeleteMulti

func (o *SQliteStore[T, R]) DeleteMulti(ids []int64) error

func (*SQliteStore[T, R]) FindWhere

func (o *SQliteStore[T, R]) FindWhere(conds ...store.Cond) ([]T, error)

func (*SQliteStore[T, R]) GetMulti

func (o *SQliteStore[T, R]) GetMulti(ids []int64) ([]T, error)

func (*SQliteStore[T, R]) GetOne

func (o *SQliteStore[T, R]) GetOne(id int64) (T, error)

func (*SQliteStore[T, R]) Insert

func (o *SQliteStore[T, R]) Insert(obj T) (int64, error)

func (*SQliteStore[T, R]) Update

func (o *SQliteStore[T, R]) Update(id int64, obj T) error

Jump to

Keyboard shortcuts

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