sql2keyval

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2022 License: Apache-2.0 Imports: 3 Imported by: 4

README

go-sql2keyval

database/sql as key value store

Go Reference Go Report Card codecov

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AddBucketFactory func(driverName string) func(Exec) AddBucket = compose(getQueryGeneratorOrEmpty, addBucketFactory)
View Source
var AddFactory func(driverName string) func(Exec) Add = compose(getQueryGeneratorOrEmpty, addFactory)
View Source
var DelBucketFactory func(driverName string) func(Exec) DelBucket = compose(getQueryGeneratorOrEmpty, delBucketFactory)
View Source
var DelFactory func(driverName string) func(Exec) Del = compose(getQueryGeneratorOrEmpty, delFactory)
View Source
var GetFactory func(driverName string) func(Query) Get = compose(getQueryGeneratorOrEmpty, getFactory)
View Source
var LstFactory func(driverName string) func(QueryCb) Lst = compose(getQueryGeneratorOrEmpty, lstFactory)
View Source
var SetFactory func(driverName string) func(Exec) Set = compose(getQueryGeneratorOrEmpty, setFactory)

Functions

func Bool2error

func Bool2error(ok bool, egen func() error) error

func Compose added in v0.2.0

func Compose[T, U, V any](f func(T) U, g func(U) V) func(T) V

func IterFlat2Chan added in v0.5.0

func IterFlat2Chan[T any](i Iter[Iter[T]], c chan<- T, lmt int)

func IterReduce added in v0.6.0

func IterReduce[T, U any](i Iter[T], init U, reducer func(state U, item T) U) U

func OptionEmptyNew added in v0.3.0

func OptionEmptyNew[T any]() optionEmpty[T]

func OptionNew added in v0.3.0

func OptionNew[T any](val T) optionValue[T]

func RegisterQueryGenerator

func RegisterQueryGenerator(driverName string, gen QueryGenerator)

Types

type Add

type Add func(ctx context.Context, bucket string, key []byte, val []byte) error

type AddBucket

type AddBucket func(ctx context.Context, bucket string) error

type AddLog added in v0.6.0

type AddLog func(ctx context.Context, bucket string) error

type Batch added in v0.4.0

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

func BatchNew added in v0.4.0

func BatchNew(bucket string, Key, Val []byte) Batch

func (Batch) Bucket added in v0.4.0

func (b Batch) Bucket() string

func (Batch) Pair added in v0.4.0

func (b Batch) Pair() Pair

func (Batch) WithKey added in v0.4.0

func (b Batch) WithKey(k []byte) Batch

type Del

type Del func(ctx context.Context, bucket string, key []byte) error

type DelBucket

type DelBucket func(ctx context.Context, bucket string) error

type Exec

type Exec func(ctx context.Context, query string, args ...any) error

type Get

type Get func(ctx context.Context, bucket string, key []byte) (val []byte, e error)

type InsLog added in v0.6.0

type InsLog func(ctx context.Context, lg []byte) error

type Iter added in v0.3.0

type Iter[T any] func() Option[T]

func IterEmptyNew added in v0.3.0

func IterEmptyNew[T any]() Iter[T]

func IterFromArray added in v0.3.0

func IterFromArray[T any](a []T) Iter[T]

func IterFromChan added in v0.3.0

func IterFromChan[T any](c <-chan T) Iter[T]

func IterFromChanNB added in v0.3.0

func IterFromChanNB[T any](c <-chan T) Iter[T]

func IterFromOpt added in v0.3.0

func IterFromOpt[T any](o Option[T]) Iter[T]

func IterInts added in v0.4.0

func IterInts(lbi int, ube int) Iter[int]

func IterMap added in v0.4.0

func IterMap[T, U any](i Iter[T], f func(T) U) Iter[U]

func (Iter[T]) Count added in v0.5.0

func (i Iter[T]) Count() uint64

func (Iter[T]) IntoInspect added in v0.5.0

func (i Iter[T]) IntoInspect(f func(T)) Iter[T]

func (Iter[T]) Take added in v0.6.0

func (iter Iter[T]) Take(imax int) Iter[T]

func (Iter[T]) ToArray added in v0.4.0

func (i Iter[T]) ToArray() (a []T)

type Lst

type Lst func(ctx context.Context, bucket string, cb func(key []byte) error) error

type Option added in v0.3.0

type Option[T any] interface {
	Value() T
	Empty() bool
	HasValue() bool
	ForEach(f func(T))
	Filter(f func(T) bool) Option[T]
}

func OptionMap added in v0.4.0

func OptionMap[T, U any](o Option[T], f func(T) U) Option[U]

type Pair

type Pair struct {
	Key []byte
	Val []byte
}

func (Pair) WithKey added in v0.4.0

func (p Pair) WithKey(Key []byte) Pair

type Pairs2Bucket added in v0.3.0

type Pairs2Bucket func(ctx context.Context, pairs Iter[Pair]) error

func NonAtomicPairs2BucketNew added in v0.3.0

func NonAtomicPairs2BucketNew(s Set2Bucket) Pairs2Bucket

type Query

type Query func(ctx context.Context, query string, args ...any) Record

type QueryCb

type QueryCb func(ctx context.Context, cb RecordConsumer, query string, args ...any) error

type QueryGenerator

type QueryGenerator interface {
	Get(bucket string) (query string, e error)
	Del(bucket string) (query string, e error)
	Add(bucket string) (query string, e error)
	Set(bucket string) (query string, e error)
	Lst(bucket string) (query string, e error)
	DelBucket(bucket string) (query string, e error)
	AddBucket(bucket string) (query string, e error)
}

type Record

type Record interface{ Scan(dest ...any) error }

type RecordConsumer

type RecordConsumer func(r Record) error

type Set

type Set func(ctx context.Context, bucket string, key []byte, val []byte) error

func NonAtomicSetNew

func NonAtomicSetNew(del Del, add Add) Set

type Set2Bucket added in v0.2.0

type Set2Bucket func(ctx context.Context, key, val []byte) error

type SetBatch added in v0.4.0

type SetBatch func(ctx context.Context, many Iter[Batch]) error

type SetMany

type SetMany func(ctx context.Context, bucket string, pairs []Pair) error

func NonAtomicSetsNew

func NonAtomicSetsNew(s Set) SetMany

type SetMany2Bucket added in v0.2.0

type SetMany2Bucket func(ctx context.Context, pairs []Pair) error

func NonAtomicSetsSingleNew added in v0.2.0

func NonAtomicSetsSingleNew(s Set2Bucket) SetMany2Bucket

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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