Documentation ¶
Overview ¶
Package sql is general sql adapter that wraps database/sql.
Index ¶
- Variables
- func Scan(value interface{}, rows Rows) (int64, error)
- type Adapter
- func (adapter *Adapter) Aggregate(query grimoire.Query, doc interface{}, loggers ...grimoire.Logger) error
- func (adapter *Adapter) All(query grimoire.Query, doc interface{}, loggers ...grimoire.Logger) (int, error)
- func (adapter *Adapter) Begin() (grimoire.Adapter, error)
- func (adapter *Adapter) Close() error
- func (adapter *Adapter) Commit() error
- func (adapter *Adapter) Delete(query grimoire.Query, loggers ...grimoire.Logger) error
- func (adapter *Adapter) Exec(statement string, args []interface{}, loggers ...grimoire.Logger) (int64, int64, error)
- func (adapter *Adapter) Insert(query grimoire.Query, changes map[string]interface{}, ...) (interface{}, error)
- func (adapter *Adapter) InsertAll(query grimoire.Query, fields []string, allchanges []map[string]interface{}, ...) ([]interface{}, error)
- func (adapter *Adapter) Query(out interface{}, statement string, args []interface{}, ...) (int64, error)
- func (adapter *Adapter) Rollback() error
- func (adapter *Adapter) Update(query grimoire.Query, changes map[string]interface{}, ...) error
- type Builder
- func (builder *Builder) Aggregate(q grimoire.Query) (string, []interface{})
- func (builder *Builder) Delete(collection string, cond c.Condition) (string, []interface{})
- func (builder *Builder) Find(q grimoire.Query) (string, []interface{})
- func (builder *Builder) Insert(collection string, changes map[string]interface{}) (string, []interface{})
- func (builder *Builder) InsertAll(collection string, fields []string, allchanges []map[string]interface{}) (string, []interface{})
- func (builder *Builder) Returning(field string) *Builder
- func (builder *Builder) Update(collection string, changes map[string]interface{}, cond c.Condition) (string, []interface{})
- type Config
- type Rows
Constants ¶
This section is empty.
Variables ¶
View Source
var UnescapeCharacter byte = '^'
UnescapeCharacter disable field escaping when it starts with this character.
Functions ¶
Types ¶
type Adapter ¶
type Adapter struct { Config *Config DB *sql.DB Tx *sql.Tx // contains filtered or unexported fields }
Adapter definition for mysql database.
func (*Adapter) Aggregate ¶
func (adapter *Adapter) Aggregate(query grimoire.Query, doc interface{}, loggers ...grimoire.Logger) error
Aggregate record using given query.
func (*Adapter) All ¶
func (adapter *Adapter) All(query grimoire.Query, doc interface{}, loggers ...grimoire.Logger) (int, error)
All retrieves all record that match the query.
func (*Adapter) Exec ¶
func (adapter *Adapter) Exec(statement string, args []interface{}, loggers ...grimoire.Logger) (int64, int64, error)
Exec performs exec operation.
func (*Adapter) Insert ¶
func (adapter *Adapter) Insert(query grimoire.Query, changes map[string]interface{}, loggers ...grimoire.Logger) (interface{}, error)
Insert inserts a record to database and returns its id.
func (*Adapter) InsertAll ¶
func (adapter *Adapter) InsertAll(query grimoire.Query, fields []string, allchanges []map[string]interface{}, loggers ...grimoire.Logger) ([]interface{}, error)
InsertAll inserts all record to database and returns its ids.
func (*Adapter) Query ¶
func (adapter *Adapter) Query(out interface{}, statement string, args []interface{}, loggers ...grimoire.Logger) (int64, error)
Query performs query operation.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder defines information of query builder.
func (*Builder) Insert ¶
func (builder *Builder) Insert(collection string, changes map[string]interface{}) (string, []interface{})
Insert generates query for insert.
func (*Builder) InsertAll ¶
func (builder *Builder) InsertAll(collection string, fields []string, allchanges []map[string]interface{}) (string, []interface{})
InsertAll generates query for multiple insert.
Click to show internal directories.
Click to hide internal directories.