persist

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddValue

func AddValue(bucket string, key []byte, value []byte) error

func AddValueCompress

func AddValueCompress(bucket string, key []byte, value []byte) error

func Count

func Count(o interface{}) (int, error)

func Delete

func Delete(o interface{}) error

func DeleteBucket

func DeleteBucket(bucket string, key []byte) error

func DeleteValue

func DeleteValue(bucket string, key []byte, value []byte) error

func Get

func Get(o interface{}) error

func GetCompressedValue

func GetCompressedValue(bucket string, key []byte) ([]byte, error)

func GetValue

func GetValue(bucket string, key []byte) ([]byte, error)

func Register

func Register(h ORM)

func RegisterKVHandler

func RegisterKVHandler(h KVStore)

func Save

func Save(o interface{}) error

func Update

func Update(o interface{}) error

Types

type BoolType

type BoolType string
const Must BoolType = "must"
const MustNot BoolType = "must_not"
const Should BoolType = "should"

type Cond

type Cond struct {
	Field       string
	SQLOperator string
	QueryType   QueryType
	BoolType    BoolType
	Value       interface{}
}

func And

func And(conds ...*Cond) []*Cond

func Eq

func Eq(field string, value interface{}) *Cond

func Ge

func Ge(field string, value interface{}) *Cond

func Gt

func Gt(field string, value interface{}) *Cond

func Le

func Le(field string, value interface{}) *Cond

func Lt

func Lt(field string, value interface{}) *Cond

func NotEq

func NotEq(field string, value interface{}) *Cond

type KVStore

type KVStore interface {
	Open() error

	Close() error

	GetValue(bucket string, key []byte) ([]byte, error)

	GetCompressedValue(bucket string, key []byte) ([]byte, error)

	AddValueCompress(bucket string, key []byte, value []byte) error

	AddValue(bucket string, key []byte, value []byte) error

	DeleteValue(bucket string, key []byte, value []byte) error

	DeleteBucket(bucket string, key []byte) error
}

type ORM

type ORM interface {
	Save(o interface{}) error

	Update(o interface{}) error

	Delete(o interface{}) error

	Search(t interface{}, to interface{}, q *Query) (error, Result)

	Get(o interface{}) error

	GetBy(field string, value interface{}, t interface{}, to interface{}) (error, Result)

	Count(o interface{}) (int, error)
}

type Query

type Query struct {
	Sort     *[]Sort
	From     int
	Size     int
	Conds    []*Cond
	RawQuery string
}

type QueryType

type QueryType string
const Match QueryType = "match"
const RangeGt QueryType = "gt"
const RangeGte QueryType = "gte"
const RangeLt QueryType = "lt"
const RangeLte QueryType = "lte"

type Result

type Result struct {
	Total  int
	Result interface{}
}

func GetBy

func GetBy(field string, value interface{}, t interface{}, to interface{}) (error, Result)
func Search(t interface{}, to interface{}, q *Query) (error, Result)

type Sort

type Sort struct {
	Field    string
	SortType SortType
}

type SortType

type SortType string
const ASC SortType = "asc"
const DESC SortType = "desc"

Jump to

Keyboard shortcuts

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