rethinkdb

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connection

func Connection(ctx context.Context, cfg *Configuration) (*r.Session, error)

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

func NewCRUDTable(session *r.Session, db, table string) *Default

NewCRUDTable sets up a new Default struct

func (*Default) Delete

func (d *Default) Delete(ctx context.Context, id interface{}) error

Delete a document from the database

func (*Default) DeleteAll

func (d *Default) DeleteAll(ctx context.Context, pred interface{}) error

DeleteAll documents from the database

func (*Default) Find

func (d *Default) Find(ctx context.Context, id interface{}, value interface{}) error

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

func (d *Default) FindByAndCount(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, data interface{}) error

Insert inserts a document into the database

func (*Default) InsertOrUpdate

func (d *Default) InsertOrUpdate(ctx context.Context, id interface{}, data interface{}) error

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

func (d *Default) Update(ctx context.Context, selector interface{}, data interface{}) error

Update a document that match the selector

func (*Default) UpdateID

func (d *Default) UpdateID(ctx context.Context, id interface{}, data interface{}) error

UpdateID updates a document using his id

func (*Default) Where

func (d *Default) Where(ctx context.Context, filter interface{}, results interface{}) error

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

func (*Default) WhereAndFetchOne

func (d *Default) WhereAndFetchOne(ctx context.Context, filter interface{}, result interface{}) error

WhereAndFetchOne returns one document that match the filter

func (*Default) WhereCount

func (d *Default) WhereCount(ctx context.Context, filter 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