Documentation ¶
Index ¶
Constants ¶
View Source
const ( TypeMemory = "memory" TypeMongoDB = "mongodb" )
Storage database types
View Source
const ( SortByASC = "asc" SortByDESC = "desc" )
SortBy values
View Source
const ( OperatorNone = "" OperatorEqual = "eq" OperatorNotEqual = "ne" OperatorIn = "in" OperatorNotIn = "nin" OperatorRangeIn = "range_in" OperatorRangeNotIn = "range_not_in" OperatorGreaterThan = "gt" OperatorLessThan = "lt" OperatorGreaterThanEqual = "gte" OperatorLessThanEqual = "lte" OperatorExists = "exists" OperatorRegex = "regex" )
Operators
Variables ¶
Functions ¶
func GetStorageLogger ¶
returns a logger with environment values
Types ¶
type Filter ¶
type Filter struct { Key string `json:"k"` Operator string `json:"o"` Value interface{} `json:"v"` }
Filter used to limit the result
type Pagination ¶
type Pagination struct { Limit int64 `json:"limit"` Offset int64 `json:"offset"` SortBy []Sort `json:"sortBy"` }
Pagination configuration
type Plugin ¶
type Plugin interface { Name() string Ping() error Close() error Insert(entityName string, data interface{}) error Upsert(entityName string, data interface{}, filter []Filter) error Update(entityName string, data interface{}, filter []Filter) error FindOne(entityName string, out interface{}, filter []Filter) error Find(entityName string, out interface{}, filter []Filter, pagination *Pagination) (*Result, error) Delete(entityName string, filter []Filter) (int64, error) Pause() error Resume() error ClearDatabase() error // if your database needs start import, returns "true", "files-directory" and "file-format" // example: true, "/tmp/data", "yaml" // it is required for in-memory database at startup DoStartupImport() (bool, string, string) }
Plugin interface storage
Click to show internal directories.
Click to hide internal directories.