Documentation ¶
Overview ¶
Package storage handles the primary data store
Index ¶
- Variables
- type Config
- type DocMeta
- type Service
- type Store
- func (s *Store) Delete(bucket string, query interface{}) error
- func (s *Store) Find(bucket string, query, selectFields interface{}, sort []string, ...) ([]map[string]interface{}, error)
- func (s *Store) FindOne(bucket string, query, selectFields interface{}, sort []string, ...) (map[string]interface{}, error)
- func (s *Store) Save(bucket string, data interface{}) (*DocMeta, error)
- func (s *Store) Update(bucket string, query interface{}, data interface{}) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound is returned if the record was not found in the storage ErrNotFound = errors.New("Record not found") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Name string Username string Password string AuthenticationSource string Hosts []string DialTimeout time.Duration Timeout time.Duration }
Config struct holds all the configurations required for the store
type Service ¶
type Service interface { // Save saves given data into the store and return the meta info and error if any Save(bucket string, data interface{}) (*DocMeta, error) // Update updates the first record matching the given query and new data Update(bucket string, query interface{}, data interface{}) error // Delete deletes the first record matching the provided query Delete(collectionName string, query interface{}) error // Find finds all the records matching the query Find(bucket string, query, selectFields interface{}, sort []string, start, limit int, result interface{}) ([]map[string]interface{}, error) // FindOne finds the first matching document for the given query FindOne(bucket string, query, selectFields interface{}, sort []string, result interface{}) (map[string]interface{}, error) }
Service defines all the methods implemented by the store
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds all the dependencies
func (*Store) Find ¶
func (s *Store) Find(bucket string, query, selectFields interface{}, sort []string, start, limit int, result interface{}) ([]map[string]interface{}, error)
Find finds all the records based on the provided query
func (*Store) FindOne ¶
func (s *Store) FindOne(bucket string, query, selectFields interface{}, sort []string, result interface{}) (map[string]interface{}, error)
FindOne finds the first document matching the provided query
Click to show internal directories.
Click to hide internal directories.