Documentation ¶
Index ¶
- func Connection(ctx context.Context, cfg *Configuration) (*r.Session, error)
- func ConvertSortParameters(params db.SortParameters) []interface{}
- type Configuration
- type Default
- func (d *Default) Delete(ctx context.Context, id interface{}) error
- func (d *Default) DeleteAll(ctx context.Context, pred interface{}) error
- func (d *Default) Find(ctx context.Context, id interface{}, value interface{}) error
- func (d *Default) FindBy(ctx context.Context, key string, value interface{}, results interface{}) error
- func (d *Default) FindByAndCount(ctx context.Context, key string, value interface{}) (int, error)
- func (d *Default) FindOneBy(ctx context.Context, key string, value interface{}, result interface{}) error
- func (d *Default) GetDBName() string
- func (d *Default) GetSession() interface{}
- func (d *Default) GetTable() interface{}
- func (d *Default) GetTableName() string
- func (d *Default) Insert(ctx context.Context, data interface{}) error
- func (d *Default) InsertOrUpdate(ctx context.Context, id interface{}, data interface{}) error
- func (d *Default) List(ctx context.Context, results interface{}, sortParams *db.SortParameters, ...) error
- func (d *Default) Search(ctx context.Context, results interface{}, filter interface{}, ...) error
- func (d *Default) Update(ctx context.Context, selector interface{}, data interface{}) error
- func (d *Default) UpdateID(ctx context.Context, id interface{}, data interface{}) error
- func (d *Default) Where(ctx context.Context, filter interface{}, results interface{}) error
- func (d *Default) WhereAndFetchLimit(ctx context.Context, filter interface{}, paginator *db.Pagination, ...) error
- func (d *Default) WhereAndFetchOne(ctx context.Context, filter interface{}, result interface{}) error
- func (d *Default) WhereCount(ctx context.Context, filter interface{}) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connection ¶
Connection provides Wire provider for a PostgreSQL database connection
func ConvertSortParameters ¶
func ConvertSortParameters(params db.SortParameters) []interface{}
ConvertSortParameters to rethinkdb query string
Types ¶
type Configuration ¶
type Configuration struct { AutoMigrate bool Addresses []string Database string Username string Password string AuthKey string }
Configuration repesents database connection configuration
type Default ¶
type Default struct {
// contains filtered or unexported fields
}
Default contains the basic implementation of the EntityCRUD interface
func NewCRUDTable ¶
NewCRUDTable sets up a new Default struct
func (*Default) Delete ¶
Delete a document from the database
func (*Default) DeleteAll ¶
DeleteAll documents from the database
func (*Default) Find ¶
Find a document match given id
func (*Default) FindBy ¶
func (d *Default) FindBy(ctx context.Context, key string, value interface{}, results interface{}) error
FindBy all couples (k = v) in the database
func (*Default) FindByAndCount ¶
FindByAndCount is used to count object that matchs the (key = value) predicate
func (*Default) FindOneBy ¶
func (d *Default) FindOneBy(ctx context.Context, key string, value interface{}, result interface{}) error
FindOneBy a couple (k = v) in the database
func (*Default) GetSession ¶
func (d *Default) GetSession() interface{}
GetSession returns the current session
func (*Default) GetTableName ¶
GetTableName returns table's name
func (*Default) Insert ¶
Insert inserts a document into the database
func (*Default) InsertOrUpdate ¶
InsertOrUpdate a document occording to ID presence in database
func (*Default) List ¶
func (d *Default) List(ctx context.Context, results interface{}, sortParams *db.SortParameters, pagination *db.Pagination) error
List all entities from the database
func (*Default) Search ¶
func (d *Default) Search(ctx context.Context, results interface{}, filter interface{}, sortParams *db.SortParameters, pagination *db.Pagination) error
Search all entities in the database
func (*Default) Update ¶
Update a document that match the selector
func (*Default) UpdateID ¶
UpdateID updates a document using his id
func (*Default) Where ¶
Where is used to fetch documents that match th filter from the database
func (*Default) WhereAndFetchLimit ¶
func (d *Default) WhereAndFetchLimit(ctx context.Context, filter interface{}, paginator *db.Pagination, results interface{}) error
WhereAndFetchLimit returns paginated list of document