dbkit

package
v0.8.19 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TxoKey is key for Txo
	TxoKey key = iota
)

Variables

This section is empty.

Functions

func CtxWithTxo

func CtxWithTxo(parent context.Context) context.Context

CtxWithTxo return context with txo

func ErrCtx

func ErrCtx(ctx context.Context) error

ErrCtx return error from context

func GetCache

func GetCache(client *redis.Client, key string, val interface{}) (err error)

GetCache to get cache

func SetCache

func SetCache(client *redis.Client, key string, val interface{}, exp time.Duration) error

SetCache to set cache

func SetErrCtx

func SetErrCtx(ctx context.Context, err error) error

SetErrCtx to set tx in ctx

func SetTxCtx

func SetTxCtx(ctx context.Context, tx sq.BaseRunner) error

SetTxCtx to set tx in ctx

func TxCtx

func TxCtx(ctx context.Context, t sq.BaseRunner) sq.BaseRunner

TxCtx return transaction from context if any or return t params

Types

type FindOption added in v0.8.19

type FindOption interface {
	CompileQuery(sq.SelectBuilder) (sq.SelectBuilder, error)
}

FindOption to compile find query

func Pagination added in v0.8.19

func Pagination(offset, limit uint64) FindOption

Pagination find option

func PaginationWithRange added in v0.8.19

func PaginationWithRange(start, end uint64) FindOption

PaginationWithRange to setup pagination with start and end index

func Sort added in v0.8.19

func Sort(column string, orderBy OrderBy) FindOption

Sort is find option to sort by column and order

type FindOptionImpl added in v0.8.19

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

FindOptionImpl implementation of FindOption

func CreateFindOption added in v0.8.19

func CreateFindOption() *FindOptionImpl

CreateFindOption to create new instance of FindOption

func (*FindOptionImpl) CompileQuery added in v0.8.19

func (f *FindOptionImpl) CompileQuery(base sq.SelectBuilder) (compiled sq.SelectBuilder, err error)

CompileQuery new select query based on current option

func (*FindOptionImpl) With added in v0.8.19

func (f *FindOptionImpl) With(option ...FindOption) *FindOptionImpl

type JSON

type JSON json.RawMessage

JSON type

func (*JSON) MarshalJSON

func (j *JSON) MarshalJSON() ([]byte, error)

MarshalJSON to marshal to json formatted

func (*JSON) Scan

func (j *JSON) Scan(src interface{}) error

Scan is implement of scanner

func (*JSON) UnmarshalJSON

func (j *JSON) UnmarshalJSON(data []byte) error

UnmarshalJSON to unmarshal

func (JSON) Value

func (j JSON) Value() (driver.Value, error)

Value is implement of Valuer

type OrderBy added in v0.8.19

type OrderBy int
const (
	Asc OrderBy = iota
	Desc
)

func (OrderBy) String added in v0.8.19

func (o OrderBy) String() string

type Txo

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

Txo stand of transaction object

type WhereCondition added in v0.8.19

type WhereCondition FindOption

func Equal added in v0.8.19

func Equal(column string, cond string) WhereCondition

NewFilter return new instance of Filter

func Like added in v0.8.19

func Like(column, condition string) WhereCondition

Like where condition

Jump to

Keyboard shortcuts

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