Documentation ¶
Index ¶
- Constants
- func Close()
- func Initialize(uri string) (err error)
- type Elephant
- func (e *Elephant) Create(input interface{}) (string, error)
- func (e *Elephant) Exists(inputType reflect.Type, key string) bool
- func (e *Elephant) ExistsBy(inputType reflect.Type, attribute string, input interface{}) bool
- func (e *Elephant) NextID(inputType reflect.Type) string
- func (e *Elephant) Remove(input interface{}) error
- func (e *Elephant) RemoveByKey(inputType reflect.Type, key string) error
- func (e *Elephant) Retrieve(inputType reflect.Type, key string) interface{}
- func (e *Elephant) RetrieveAll(inputType reflect.Type) (map[string]interface{}, error)
- func (e *Elephant) RetrieveBy(inputType reflect.Type, attribute string, input interface{}) interface{}
- func (e *Elephant) Update(input interface{}) error
Constants ¶
const ContextSymbol = "."
const MaxStructLength = 65535 //64k
MaxStructLength defines how long can be a structure converted to JSON to be stored
Variables ¶
This section is empty.
Functions ¶
func Initialize ¶
Initialize requires a supported uri using one of the following supported formats
Types ¶
type Elephant ¶
type Elephant struct { Context string // contains filtered or unexported fields }
Elephant provides db access to a concrete context
var MainContext *Elephant
MainContext is the default context
func GetElephant ¶
GetElephant returns a valid elephant for the required context
func (*Elephant) Create ¶
Create adds one element to the database If the key attribute value is empty (""), a new one will be assigned
func (*Elephant) ExistsBy ¶
ExistsBy gets one element from a specific type filtering by other attribute Returns true if found and false if parameters are incorrect or the element is not found
func (*Elephant) Remove ¶
Remove deletes one element from the database Returns err if the object does not exist
func (*Elephant) RemoveByKey ¶
RemoveByKey deletes one element from the database Returns err if the object does not exist
func (*Elephant) Retrieve ¶
Retrieve gets one element from a specific type filtering by key Returns the element if found and nil if not
func (*Elephant) RetrieveAll ¶
RetrieveAll gets all elements with a specific type Returns a map with all elements. It will be empty if there are no elements
func (*Elephant) RetrieveBy ¶
func (e *Elephant) RetrieveBy(inputType reflect.Type, attribute string, input interface{}) interface{}
RetrieveBy gets one element from a specific type filtering by other attribute Returns the element if found and nil if parameters are incorrect or the element is not found