Documentation ¶
Index ¶
- func New(mongoURI string) (stores.Interface, error)
- type Store
- func (ms *Store) Create(obj *usher.Object) *usher.Error
- func (ms *Store) Delete(obj *usher.Object, id usher.ObjectID) *usher.Error
- func (ms *Store) Exists(id usher.ObjectID) *usher.Error
- func (ms *Store) Get(obj *usher.Object, id usher.ObjectID) *usher.Error
- func (ms *Store) GetAll(objList *[]usher.Object, kind string, qa ...interface{}) *usher.Error
- func (ms *Store) GetLatest(obj *usher.Object, kind string, qa ...interface{}) *usher.Error
- func (ms *Store) Update(obj *usher.Object, id usher.ObjectID, updates []usher.UpdateClause) *usher.Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the implementation `stores.Interface` using MongoDB as the storage backend.
func (*Store) Create ¶
Create stores the object into the storage backend. If object with same ID already exists, a '409 Conflict' error is returned.
func (*Store) Delete ¶
Delete will delete the object identified by (name, kind, parent). If item does not exist matching the given query, '404 NotFound' will be returned.
func (*Store) GetAll ¶
GetAll will fetch all the objects of the given 'kind'. Also, additional queries can be provided as variadic arguments. If no item found matching the (kind, query), the pointer 'obj' to list will be left empty.
func (*Store) Update ¶
func (ms *Store) Update(obj *usher.Object, id usher.ObjectID, updates []usher.UpdateClause) *usher.Error
Update is used to update an object. Update selectively updates and hence can be used for both PUT and PATCH type implementations. Only changes that are provided through in 'updates' array are applied to the object. If item does not exist in memory, a '404 NotFound' will be returned.