Documentation ¶
Index ¶
- type Conn
- type DB
- type SQL
- func (sq *SQL) Count(table db.TableIdentity) (int, error)
- func (sq *SQL) Delete(table db.TableIdentity, index string, indexValue interface{}) error
- func (sq *SQL) Get(table db.TableIdentity, consumer db.TableConsumer, index string, ...) error
- func (sq *SQL) GetAll(table db.TableIdentity, order string, orderBy string) ([]map[string]interface{}, error)
- func (sq *SQL) GetAllPerPage(table db.TableIdentity, order string, orderBy string, page int, ...) ([]map[string]interface{}, int, error)
- func (sq *SQL) Save(identity db.TableIdentity, table db.TableFields) error
- func (sq *SQL) Update(identity db.TableIdentity, table db.TableFields, index string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct { Port int Addr string User string Driver string Password string Database string Log sink.Sink }
Conn defines a struct which will generate a new sqlx connection for making sql queries.
type SQL ¶
type SQL struct {
// contains filtered or unexported fields
}
SQL defines an struct which implements the db.Provider which allows us execute CRUD ops.
func (*SQL) Count ¶
func (sq *SQL) Count(table db.TableIdentity) (int, error)
Count retrieves the total number of records from the specific table from the db.
func (*SQL) Delete ¶
func (sq *SQL) Delete(table db.TableIdentity, index string, indexValue interface{}) error
Delete removes the giving data from the specific db with the specific index and value.
func (*SQL) Get ¶
func (sq *SQL) Get(table db.TableIdentity, consumer db.TableConsumer, index string, indexValue interface{}) error
Get retrieves the giving data from the specific db with the specific index and value.
func (*SQL) GetAll ¶
func (sq *SQL) GetAll(table db.TableIdentity, order string, orderBy string) ([]map[string]interface{}, error)
GetAll retrieves the giving data from the specific db with the specific index and value.
func (*SQL) GetAllPerPage ¶
func (sq *SQL) GetAllPerPage(table db.TableIdentity, order string, orderBy string, page int, responsePerPage int) ([]map[string]interface{}, int, error)
GetAllPerPage retrieves the giving data from the specific db with the specific index and value.
func (*SQL) Save ¶
func (sq *SQL) Save(identity db.TableIdentity, table db.TableFields) error
Save takes the giving table name with the giving fields and attempts to save this giving data appropriately into the giving db.
func (*SQL) Update ¶
func (sq *SQL) Update(identity db.TableIdentity, table db.TableFields, index string) error
Update takes the giving table name with the giving fields and attempts to update this giving data appropriately into the giving db. index - defines the string which should identify the key to be retrieved from the fields to target the data to be updated in the db.