Documentation ¶
Index ¶
- func ToValueString(val interface{}) (string, error)
- type Config
- 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) GetAllBy(table db.TableIdentity, order string, orderBy string, ...) error
- func (sq *SQL) GetAllPerPage(table db.TableIdentity, order string, orderBy string, page int, ...) ([]map[string]interface{}, int, error)
- func (sq *SQL) GetAllPerPageBy(table db.TableIdentity, order string, orderBy string, page int, ...) (int, error)
- func (sq *SQL) GetBy(table db.TableIdentity, consumer func(*sqlx.Row) error, index string, ...) 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 ¶
func ToValueString ¶
ToValueString returns the string representation of a basic go core data type for usage in a db call.
Types ¶
type Config ¶
type Config struct { User string `json:"user"` UserPassword string `json:"user_password"` DBPort string `json:"db_port"` DBIP string `json:"dp_ip"` DBName string `json:"db_name"` DBDriver string `json:"db_driver"` }
Config is a configuration struct for the DB connection for DBMaker.
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) GetAllBy ¶
func (sq *SQL) GetAllBy(table db.TableIdentity, order string, orderBy string, mx func(*sqlx.Rows) error) error
GetAllBy 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) GetAllPerPageBy ¶
func (sq *SQL) GetAllPerPageBy(table db.TableIdentity, order string, orderBy string, page int, responsePerPage int, mx func(*sqlx.Rows) error) (int, error)
GetAllPerPageBy retrieves the giving data from the specific db with the specific index and value.
func (*SQL) GetBy ¶
func (sq *SQL) GetBy(table db.TableIdentity, consumer func(*sqlx.Row) error, index string, indexValue interface{}) error
GetBy 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, indexValue interface{}) 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.