mock

package
v0.0.0-...-21d4feb Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2017 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Default

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

Default contains the basic implementation of the EntityCRUD interface

func NewCRUDTable

func NewCRUDTable(session interface{}, db, table string) *Default

NewCRUDTable sets up a new Default struct

func (*Default) Delete

func (d *Default) Delete(id interface{}) error

Delete a document from the database

func (*Default) DeleteAll

func (d *Default) DeleteAll(pred interface{}) error

DeleteAll documents from the database

func (*Default) Find

func (d *Default) Find(id interface{}, value interface{}) error

Find a document match given id

func (*Default) FindBy

func (d *Default) FindBy(key string, value interface{}, results interface{}) error

FindBy a couple (k = v) in the database

func (*Default) FindByAndCount

func (d *Default) FindByAndCount(key string, value interface{}) (int, error)

FindByAndCount is used to count object that matchs the (key = value) predicate

func (*Default) FindOneBy

func (d *Default) FindOneBy(key string, value interface{}, result interface{}) error

FindOneBy a couple (k = v) in the database

func (*Default) GetDBName

func (d *Default) GetDBName() string

GetDBName returns database's name

func (*Default) GetSession

func (d *Default) GetSession() interface{}

GetSession returns the current session

func (*Default) GetTable

func (d *Default) GetTable() interface{}

GetTable returns no table

func (*Default) GetTableName

func (d *Default) GetTableName() string

GetTableName returns table's name

func (*Default) Insert

func (d *Default) Insert(data interface{}) error

Insert inserts a document into the database

func (*Default) InsertOrUpdate

func (d *Default) InsertOrUpdate(id interface{}, data interface{}) error

InsertOrUpdate a document occording to ID presence in database

func (*Default) List

func (d *Default) List(results interface{}, sortParams *api.SortParameters, pagination *api.Pagination) error

List all entities from the database

func (*Default) Search

func (d *Default) Search(results interface{}, filter map[string]interface{}, sortParams *api.SortParameters, pagination *api.Pagination) error

Search all entities from the database

func (*Default) Update

func (d *Default) Update(selector interface{}, data interface{}) error

Update a document that match the selector

func (*Default) UpdateID

func (d *Default) UpdateID(id interface{}, data interface{}) error

UpdateID updates a document using his id

func (*Default) Where

func (d *Default) Where(filter map[string]interface{}, results interface{}) error

Where is used to fetch documents that match th filter from the database

func (*Default) WhereAndFetchLimit

func (d *Default) WhereAndFetchLimit(filter map[string]interface{}, paginator *api.Pagination, results interface{}) error

WhereAndFetchLimit returns paginated list of document

func (*Default) WhereAndFetchOne

func (d *Default) WhereAndFetchOne(filter map[string]interface{}, result interface{}) error

WhereAndFetchOne returns one document that match the filter

func (*Default) WhereCount

func (d *Default) WhereCount(filter map[string]interface{}) (int, error)

WhereCount returns the document count that match the filter

Jump to

Keyboard shortcuts

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