inmemory

package
v0.0.0-...-89bf0d2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() stores.Interface

New initializes a new In-Memory store implementation. This is not optimized implementation. It uses a go map object to store data and is there only for debugging and demonstration purposes.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store implements the 'stores.Interface'.

func (*Store) Create

func (st *Store) Create(obj *usher.Object) *usher.Error

Create stores the object into the storage backend. If object with same ID already exists, a '409 Conflict' error is returned.

func (*Store) Delete

func (st *Store) Delete(obj *usher.Object, id usher.ObjectID) *usher.Error

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) Exists

func (st *Store) Exists(id usher.ObjectID) *usher.Error

Exists checks if there is an item matching the given query.

func (*Store) Get

func (st *Store) Get(obj *usher.Object, id usher.ObjectID) *usher.Error

Get will fetch first object that matches the (name, kind, parent) ID tuple. If no object found matching this tuple, '404 NotFound' will be returned.

func (*Store) GetAll

func (st *Store) GetAll(obj *[]usher.Object, kind string, qa ...interface{}) *usher.Error

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 not be modified.

func (*Store) GetLatest

func (st *Store) GetLatest(obj *usher.Object, kind string, qa ...interface{}) *usher.Error

func (*Store) Update

func (st *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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL