Documentation ¶
Index ¶
- Constants
- Variables
- func Exec(query string, args ...interface{}) sql.Result
- func Query(query string, args ...interface{}) ([]map[string]interface{}, *sql.Rows)
- func RecycleSql(sql *Sql)
- type Connection
- type H
- type Join
- type RawUpdate
- type Sql
- func (sql *Sql) All() ([]map[string]interface{}, error)
- func (sql *Sql) Count() (int64, error)
- func (sql *Sql) Delete() error
- func (sql *Sql) Exec() (int64, error)
- func (sql *Sql) Find(arg interface{}) (map[string]interface{}, error)
- func (sql *Sql) First() (map[string]interface{}, error)
- func (sql *Sql) Insert(values dialect.H) (int64, error)
- func (sql *Sql) LeftJoin(table string, fieldA string, operation string, fieldB string) *Sql
- func (sql *Sql) OrderBy(filed string, order string) *Sql
- func (sql *Sql) Select(fields ...string) *Sql
- func (sql *Sql) ShowColumns() ([]map[string]interface{}, error)
- func (sql *Sql) ShowTables() ([]map[string]interface{}, error)
- func (sql *Sql) Skip(offset int) *Sql
- func (sql *Sql) Table(table string) *Sql
- func (sql *Sql) Take(take int) *Sql
- func (sql *Sql) Update(values dialect.H) (int64, error)
- func (sql *Sql) UpdateRaw(raw string, args ...interface{}) *Sql
- func (sql *Sql) Where(field string, operation string, arg interface{}) *Sql
- func (sql *Sql) WhereIn(field string, arg []interface{}) *Sql
- func (sql *Sql) WhereNotIn(field string, arg []interface{}) *Sql
- func (sql *Sql) WhereRaw(raw string, args ...interface{}) *Sql
- type Where
Constants ¶
View Source
const ( DRIVER_MYSQL = "mysql" DRIVER_MSSQL = "mssql" DRIVER_SQLITE = "sqlite" DRIVER_POSTGRESQL = "postgresql" )
Variables ¶
View Source
var SqlPool = sync.Pool{ New: func() interface{} { return &Sql{ SqlComponent: dialect.SqlComponent{ Fields: make([]string, 0), TableName: "", Args: make([]interface{}, 0), Wheres: make([]dialect.Where, 0), Leftjoins: make([]dialect.Join, 0), UpdateRaws: make([]dialect.RawUpdate, 0), WhereRaws: "", }, diver: nil, dialect: nil, } }, }
Functions ¶
func RecycleSql ¶
func RecycleSql(sql *Sql)
Types ¶
type Connection ¶
type Connection interface { Query(query string, args ...interface{}) ([]map[string]interface{}, *sql.Rows) Exec(query string, args ...interface{}) sql.Result InitDB(cfg map[string]config.Database) GetName() string }
func GetConnection ¶
func GetConnection() Connection
func GetConnectionByDriver ¶
func GetConnectionByDriver(driver string) Connection
type Sql ¶
type Sql struct { dialect.SqlComponent // contains filtered or unexported fields }
func WithDriver ¶
func (*Sql) ShowColumns ¶
func (*Sql) ShowTables ¶
func (*Sql) WhereNotIn ¶
Click to show internal directories.
Click to hide internal directories.