Documentation
¶
Index ¶
- Constants
- type Collection
- func (c *Collection) Delete(ctx context.Context, key interface{}) error
- func (c *Collection) GC() error
- func (c *Collection) Get(ctx context.Context, key interface{}) (interface{}, bool)
- func (c *Collection) IsKeyExisted(key interface{}) bool
- func (c *Collection) Iter(ctx context.Context, key interface{}, ...)
- func (c *Collection) Key() string
- func (c *Collection) Len() int
- func (c *Collection) Upsert(ctx context.Context, key interface{}, value interface{}) error
- func (c *Collection) Upserts(ctx context.Context, in ...*CollectionKV) (int, error)
- type CollectionConfig
- type CollectionKV
- type CollectionValue
- type Engine
- type GetterFn
- type ICollection
- type IEngine
- type ISession
- type Session
- func (s *Session) Close()
- func (s *Session) Delete(key interface{}, setterFns ...SetterFn) error
- func (s *Session) Exec(outptr interface{}) (bool, error)
- func (s *Session) Filter(key interface{}, iter func(interface{}, int) bool, getterFns ...GetterFn) *Session
- func (s *Session) Get(key interface{}, iter func(interface{}, int) bool, getterFns ...GetterFn) *Session
- func (s *Session) KeyBulder(sim interface{}) interface{}
- func (s *Session) Upsert(key interface{}, value interface{}, setterFns ...SetterFn) error
- type SessionConfig
- type SetterFn
Constants ¶
View Source
const ( E_not_found_any_collection_key = "not_found_any_collection_key" E_upsert_problem = "upsert_problem" E_remove_problem = "remove_problem" E_no_item_to_get = "no_item_to_get" E_cancelled = "cancelled" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
func CreateCollection ¶
func CreateCollection(config *CollectionConfig) (*Collection, error)
func (*Collection) Get ¶
func (c *Collection) Get(ctx context.Context, key interface{}) (interface{}, bool)
func (*Collection) IsKeyExisted ¶
func (c *Collection) IsKeyExisted(key interface{}) bool
func (*Collection) Iter ¶
func (c *Collection) Iter(ctx context.Context, key interface{}, filtering func(item interface{}, index int))
func (*Collection) Key ¶
func (c *Collection) Key() string
func (*Collection) Len ¶
func (c *Collection) Len() int
func (*Collection) Upsert ¶
func (c *Collection) Upsert(ctx context.Context, key interface{}, value interface{}) error
func (*Collection) Upserts ¶
func (c *Collection) Upserts(ctx context.Context, in ...*CollectionKV) (int, error)
type CollectionConfig ¶
type CollectionKV ¶
type CollectionKV struct {
Key interface{} `json:"key"`
Value interface{} `json:"value"`
}
type CollectionValue ¶
type CollectionValue struct {
Created int64 `json:"created"`
Value interface{} `json:"value"`
}
* Collection is define a structure of data Save data inmem here
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
* Engine is define a structure for config and save all data. When engine run will create a session to execute with condition.
func Start ¶
func Start(cfs ...*CollectionConfig) *Engine
func (*Engine) AddCollection ¶
func (e *Engine) AddCollection(cfs ...*CollectionConfig) error
func (*Engine) Collection ¶
func (e *Engine) Collection() map[string]*Collection
func (*Engine) CollectionConfig ¶
func (e *Engine) CollectionConfig() map[string]*CollectionConfig
type ICollection ¶
type ICollection interface {
Upsert(ctx context.Context, key, value interface{}) error
Upserts(ctx context.Context, in ...*CollectionKV) (int, error)
Delete(ctx context.Context, key interface{}) error
Get(ctx context.Context, key interface{}) (interface{}, bool)
Iter(ctx context.Context, key interface{}, filtering func(item interface{}, index int))
Key() string
Len() int
IsKeyExisted(key interface{}) bool
GC()
}
type IEngine ¶
type IEngine interface {
Select(ctx context.Context, collectionKey string) ICollection
AddCollection(cf ...*CollectionConfig) error
Collection() map[string]*Collection
CollectionConfig() map[string]*CollectionConfig
Info()
}
type ISession ¶
type ISession interface {
Filter(iter func(interface{}, int) bool, getterFns ...GetterFn) ISession
Get(iter func(interface{}, int) bool, getterFns ...GetterFn) error
Exec(outptr interface{}) error
Upsert(key, value interface{}, setterFns ...SetterFn) error
Delete(key interface{}, setterFns ...SetterFn) error
Close()
}
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
type SessionConfig ¶
type SessionConfig struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.