Documentation ¶
Index ¶
- Variables
- type Cache
- type Collection
- type Delete
- type Filter
- type Memdis
- func (md *Memdis) Clear() error
- func (md *Memdis) Del(key string) error
- func (md *Memdis) Get(key string) (any, error)
- func (md *Memdis) GetMany(keys []string) []map[string]any
- func (md *Memdis) KeyValuePairs() []map[string]any
- func (md *Memdis) Keys() []string
- func (md *Memdis) OverWrite(key string, value any, duration ...time.Duration) error
- func (md *Memdis) OverWriteWithKey(prevkey, newKey string, value any, duration ...time.Duration) error
- func (md *Memdis) Set(key string, value any, duration ...time.Duration) error
- func (md *Memdis) SetMany(data []map[string]MemdisData) ([]map[string]any, error)
- func (md *Memdis) Size() int
- func (md *Memdis) TypeOf(key string) (string, error)
- func (md *Memdis) Values() []any
- type MemdisData
- type Memgodb
- type Operations
- type Persist
- type Update
Constants ¶
This section is empty.
Variables ¶
var ( // ErrKeyNotFound key not found ErrKeyNotFound = errors.New("key not found") // ErrKeyExists key already exists ErrKeyExists = errors.New("key already exist") )
var ( // ErrRecordNotFound record not found ErrRecordNotFound = errors.New("record not found") // ErrFilterParams filter params cannot be nil ErrFilterParams = errors.New("filter params cannot be nil") )
var ( // MemgodbStorage storage instance MemgodbStorage []any )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct { MemdisInstance Memdis MemgodbInstance Memgodb // contains filtered or unexported fields }
Cache object
type Collection ¶ added in v1.1.0
type Collection struct {
// contains filtered or unexported fields
}
Collection object
func (*Collection) Delete ¶ added in v1.1.0
func (c *Collection) Delete(filter map[string]any) *Delete
Delete is used to delete a new record from the storage. It has two methods which are One() and Many().
func (*Collection) Filter ¶ added in v1.1.0
func (c *Collection) Filter(filter map[string]any) *Filter
Filter is used to filter records from the storage. It has two methods which are First() and All().
func (*Collection) Insert ¶ added in v1.1.0
func (c *Collection) Insert(obj any) error
Insert is used to insert a new record into the storage.
func (*Collection) InsertFromJsonFile ¶ added in v1.2.1
func (c *Collection) InsertFromJsonFile(fileLocation string) error
InsertFromJsonFile adds records into the storage from a JSON file.
type Delete ¶ added in v1.1.0
type Delete struct {
// contains filtered or unexported fields
}
Delete object implements One() and All()
type Filter ¶ added in v1.1.0
type Filter struct {
// contains filtered or unexported fields
}
Filter object implements One() and All()
type Memdis ¶ added in v1.1.0
type Memdis struct {
// contains filtered or unexported fields
}
Memdis object instance
func (*Memdis) GetMany ¶ added in v1.1.0
GetMany() retrieves data with matching keys from the in-memory storage
func (*Memdis) KeyValuePairs ¶ added in v1.1.0
KeyValuePairs() returns an array of key value pairs of all the data in the storage
func (*Memdis) OverWriteWithKey ¶ added in v1.1.0
func (md *Memdis) OverWriteWithKey(prevkey, newKey string, value any, duration ...time.Duration) error
OverWriteWithKey() updates an already set value and key using the previously set key
func (*Memdis) SetMany ¶ added in v1.1.0
SetMany() sets many data objects into memory for later access
func (*Memdis) Size ¶ added in v1.1.0
Size() retrieves the total data objects in the in-memory storage
type MemdisData ¶ added in v1.1.0
MemdisData object
type Memgodb ¶ added in v1.1.0
type Memgodb struct {
// contains filtered or unexported fields
}
Memgodb object instance
func (*Memgodb) Collection ¶ added in v1.1.0
func (mg *Memgodb) Collection(col any) *Collection
Collection defines the collection(table) name to perform an operation on it
func (*Memgodb) LoadDefault ¶ added in v1.1.0
LoadDefault is used to load data from the JSON file saved on the server using Persist() if any.
type Operations ¶
type Operations interface { // Debug() enables debug to get certain logs Debug(io.Writer) // Memdis gives you a Redis-like feature similarly as you would with a Redis database Memdis() *Memdis // Memgodb gives you a MongoDB-like feature similarly as you would with a MondoDB database Memgodb() *Memgodb }
Operations lists all available operations on the fs-cache
type Persist ¶ added in v1.1.0
type Persist struct {
Error error
}
Persist objects implemented Persist() used to persist inserted records