Documentation ¶
Index ¶
- func DropDB(database *Database) error
- func InstallDB(database *Database) error
- func ToJSON(model DBInterface) string
- func ValidateConstraint(err error, r interface{}) (map[string]string, error)
- func ValidateStruct(r interface{}) (map[string]string, error)
- type Change
- type DBInterface
- type Database
- func (d *Database) Delete(table string, whereClause string, args ...interface{}) Result
- func (d Database) Force() Database
- func (d *Database) Insert(m DBInterface, data interface{}, keys ...string) error
- func (d *Database) Query(query string, params ...interface{}) Result
- func (d *Database) QueryRow(query string, params ...interface{}) Result
- func (d *Database) QueryRowWithModel(query string, target interface{}, params ...interface{}) Result
- func (d *Database) QueryWithModel(query string, target interface{}, params ...interface{}) Result
- func (d *Database) Transaction(cb func(tx *Tx) error) *Database
- func (d *Database) Update(m DBInterface, data interface{}, whereClause *string, keys ...string) error
- type Error
- type Postgres
- type Result
- type Tables
- type Tag
- type Tx
- type Violation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToJSON ¶
func ToJSON(model DBInterface) string
ToJSON Converting models belonging to DBInterface to json string
func ValidateConstraint ¶
ValidateConstraint sql violation error validator
func ValidateStruct ¶
ValidateStruct struct validator
Types ¶
type Change ¶
type Change struct { Key string Name string String string Int int64 Bool bool Decimal decimal.Decimal }
Change database model compare and change
type DBInterface ¶
DBInterface database model interface
type Database ¶
type Database struct { Config *model.Config Type model.DB DB *sqlx.DB Tx *sqlx.Tx Logger *utils.Logger Error error Reset bool QueryType string }
Database struct
func (*Database) Insert ¶
func (d *Database) Insert(m DBInterface, data interface{}, keys ...string) error
Insert query builder by database type
func (*Database) QueryRowWithModel ¶
func (d *Database) QueryRowWithModel(query string, target interface{}, params ...interface{}) Result
QueryRowWithModel database row query builder with target model
func (*Database) QueryWithModel ¶
QueryWithModel database query builder with given model
func (*Database) Transaction ¶
Transaction database tx builder
Click to show internal directories.
Click to hide internal directories.