Versions in this module Expand all Collapse all v0 v0.1.4 Nov 10, 2023 Changes in this version + var AutoKeyBuffer = 100 + var Delimiter = "_" + var InvalidId = errors.New("InvalidId") + var LinkDelimiter = "@" + var PreAutoKavlb = "tank%avlb_" + var PreAutoKused = "tank%used_" + var PrefixLink = "link%" + var PrefixTable = "tbl%" + func Count[T IObject](db IRelationalDB) int + func DeepDeleteWrp[T IObject](objWrp *ObjWrapper[T]) error + func DeepDelete[T IObject](db IRelationalDB, id string) error + func DeleteWrp[T IObject](objWrp *ObjWrapper[T]) error + func Delete[T IObject](db IRelationalDB, id string) error + func Encode(obj *IObject) []byte + func ExistWrp[T IObject](objWrp *ObjWrapper[T]) bool + func Exist[T IObject](db IRelationalDB, id string) bool + func Foreach[T IObject](db IRelationalDB, do func(id string, value *T)) + func Link[S IObject, T IObject](s *ObjWrapper[S], biDirectional bool, targets ...*ObjWrapper[T]) + func MakeKey(tableName, id string) []byte + func MakeLinkKey(tableName string, id string, targetName string, targetId string) []string + func MakePrefix(tableName string) string + func NameOfField(parent interface{}, field interface{}) (string, error) + func NameOfStruct[T any]() string + func RemoveAllLinkWrp[T IObject](t *ObjWrapper[T]) + func RemoveAllLink[T IObject](db IRelationalDB, id string) + func RemoveAllTableLinkWrp[S IObject, T IObject](s *ObjWrapper[S]) + func RemoveAllTableLink[S IObject, T IObject](db IRelationalDB, id string) + func RemoveLinkWrp[S IObject, T IObject](s *ObjWrapper[S], t *ObjWrapper[T]) bool + func RemoveLink[S IObject, T IObject](db IRelationalDB, idOfS string, idOfT string) bool + func TableName[T IObject]() string + func ToString(v any) string + func Type[T IObject]() *T + func VisitWrp[S IObject, T IObject](s *ObjWrapper[S]) []string + func Visit[S IObject, T IObject](db IRelationalDB, id string) []string + type AbstractRelDB struct + func (db *AbstractRelDB) CleanUnusedKey() + func (db *AbstractRelDB) Count(prefix string) int + func (db *AbstractRelDB) DeepDelete(tableName string, id string) error + func (db *AbstractRelDB) Delete(tableName string, id string) error + func (db *AbstractRelDB) FindAll(tableName string, predicate func(id string, value *IObject) bool) ([]string, []*IObject) + func (db *AbstractRelDB) FindFirst(tableName string, predicate func(id string, value *IObject) bool) (string, *IObject) + func (db *AbstractRelDB) Foreach(tableName string, do func(id string, value *IObject)) + func (db *AbstractRelDB) FreeKey(keys ...string) []error + func (db *AbstractRelDB) Get(tableName string, id string) *IObject + func (db *AbstractRelDB) GetNextKey() string + func (db *AbstractRelDB) Insert(object IObject) string + func (db *AbstractRelDB) Set(id string, object IObject) error + func (db *AbstractRelDB) SetWrp(objWrp ObjWrapper[IObject]) error + func (db *AbstractRelDB) Update(tableName string, id string, editor func(value IObject) IObject) *IObject + type Collection struct + func NewCollection[T IObject](db IRelationalDB) *Collection[T] + func Where[T IObject, K IObject](firstOnly bool, collection *Collection[T], ...) *Collection[T] + func (c *Collection[T]) Distinct() *Collection[T] + func (c *Collection[T]) Filter(predicate func(objWrp *ObjWrapper[T]) bool) *Collection[T] + func (c *Collection[T]) GetArray() []*ObjWrapper[T] + func (c *Collection[T]) Len() int + func (c *Collection[T]) Less(i, j int) bool + func (c *Collection[T]) Sort(comparator func(x, y *ObjWrapper[T]) bool) *Collection[T] + func (c *Collection[T]) Swap(i, j int) + type DBObject struct + func (o DBObject) Equals(v IObject) bool + func (o DBObject) Hash() string + type IObject interface + Equals func(v IObject) bool + Hash func() string + TableName func() string + ToString func() string + func Decode(value []byte) *IObject + type IRelationalDB interface + CleanUnusedKey func() + Count func(tableName string) int + DeepDelete func(tableName string, id string) error + Delete func(tableName string, id string) error + Exist func(tableName string, id string) bool + FindAll func(tableName string, predicate func(id string, value *IObject) bool) ([]string, []*IObject) + FindFirst func(tableName string, predicate func(id string, value *IObject) bool) (string, *IObject) + Foreach func(tableName string, do func(id string, value *IObject)) + FreeKey func(key ...string) []error + Get func(tableName string, id string) *IObject + GetNextKey func() string + Insert func(object IObject) string + RawDelete func(prefix string, key string) bool + RawGet func(prefix string, key string) ([]byte, bool) + RawIterKV func(prefix string, action func(key string, value []byte) (stop bool)) + RawIterKey func(prefix string, action func(key string) (stop bool)) + RawSet func(prefix string, key string, value []byte) + Set func(id string, object IObject) error + SetWrp func(objWrp ObjWrapper[IObject]) error + Update func(tableName string, id string, editor func(value IObject) IObject) *IObject + type ObjWrapper struct + ID string + Value T + func AllFromLinkWrp[S IObject, T IObject](s *ObjWrapper[S]) []*ObjWrapper[T] + func AllFromLink[S IObject, T IObject](db IRelationalDB, idOfS string) []*ObjWrapper[T] + func FindAll[T IObject](db IRelationalDB, predicate func(id string, value *T) bool) []*ObjWrapper[T] + func FindFirst[T IObject](db IRelationalDB, predicate func(id string, value *T) bool) *ObjWrapper[T] + func Get[T IObject](db IRelationalDB, id string) *ObjWrapper[T] + func Insert[T IObject](db IRelationalDB, value T) *ObjWrapper[T] + func LinkNew[S IObject, T IObject](s *ObjWrapper[S], biDirectional bool, objs ...T) []*ObjWrapper[T] + func NewObjWrapper[T IObject](db IRelationalDB, ID string, value *T) *ObjWrapper[T] + func SetWrp[T IObject](db IRelationalDB, objWrp ObjWrapper[T]) *ObjWrapper[T] + func Set[T IObject](db IRelationalDB, id string, value T) *ObjWrapper[T] + func Update[T IObject](db IRelationalDB, id string, editor func(value *T)) *ObjWrapper[T] + func (w *ObjWrapper[T]) Unwrap() (string, T)