store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoResult = errors.New("store return no result")

store find no result

Functions

func InitStore

func InitStore(ctx *cli.Context)

Types

type Store

type Store struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Store combines memory, cache and database

func GetStore

func GetStore() *Store

func (*Store) AddStoreInfo

func (s *Store) AddStoreInfo(tp int, tblName, keyName, indexName string)

func (*Store) DeleteObject

func (s *Store) DeleteObject(storeType int, x StoreObjector) error

DeleteObject delete object cache and database with async call. it won't delete from memory

func (*Store) Exit

func (s *Store) Exit()

func (*Store) LoadArray

func (s *Store) LoadArray(storeType int, storeIndex int64, pool *sync.Pool) ([]interface{}, error)

func (*Store) LoadObject

func (s *Store) LoadObject(storeType int, keyValue interface{}, x StoreObjector) error

LoadObject loads object from cache at first, if didn't hit, it will search from database. it neither search nor save with memory.

func (*Store) MigrateDbTable

func (s *Store) MigrateDbTable(tblName string, indexNames ...string) error

func (*Store) SaveFields

func (s *Store) SaveFields(storeType int, x StoreObjector, fields map[string]interface{}) error

SaveFields save fields to cache and database with async call. it won't save to memory

func (*Store) SaveObject

func (s *Store) SaveObject(storeType int, x StoreObjector) error

SaveObject save object cache and database with async call. it won't save to memory

type StoreInfo

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

type StoreObjector

type StoreObjector interface {
	GetObjID() int64
	GetStoreIndex() int64
	AfterLoad() error
}

StoreObjector save and load with all structure

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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