Documentation ¶
Index ¶
- Constants
- func RegisterConnection(name string, rwSep bool, hosts, port, dbname, user, pass string, pre string, ...)
- func RegisterConnectionDefault(rwSep bool, hosts, port, dbname, user, pass string, pre string, safe bool, ...)
- type Conns
- type Sql
- func (this *Sql) Add(data map[string]interface{}) (int64, error)
- func (this *Sql) Clear() *Sql
- func (this *Sql) Commit() (bool, string)
- func (this *Sql) Count(filed string) (int, error)
- func (this *Sql) Delete() (int64, error)
- func (this *Sql) Exec(theSql string) (sql.Result, error)
- func (this *Sql) Fields(filed string) *Sql
- func (this *Sql) Find(id interface{}) (map[string]string, error)
- func (this *Sql) GetConnectionName() string
- func (this *Sql) GetField(fields string) (map[string](map[string]string), error)
- func (this *Sql) GetSql(isSelect bool) string
- func (this *Sql) Group(g string) *Sql
- func (this *Sql) Having(h string) *Sql
- func (this *Sql) Join(joinsql string) *Sql
- func (this *Sql) Lock(tables string, wirte bool) (bool, string)
- func (this *Sql) LockRow() *Sql
- func (this *Sql) MustMaster(mustMaster bool) *Sql
- func (this *Sql) NewCondition() map[string]interface{}
- func (this *Sql) Order(order string) *Sql
- func (this *Sql) Page(page int, pagesize int) *Sql
- func (this *Sql) Ping() (bool, string)
- func (this *Sql) Pk(pk string) *Sql
- func (this *Sql) Query(theSql string) (*sql.Rows, error)
- func (this *Sql) QueryMap(theSql string) ([]map[string]string, error)
- func (this *Sql) QueryRow(theSql string) *sql.Row
- func (this *Sql) Rollback() (bool, string)
- func (this *Sql) Save(data map[string]interface{}) (int64, error)
- func (this *Sql) Select() ([]map[string]string, error)
- func (this *Sql) SetInc(field string, value int) (int64, error)
- func (this *Sql) StartTrans() (bool, string)
- func (this *Sql) Table(tablename string) *Sql
- func (this *Sql) TrueTable(tablename string) *Sql
- func (this *Sql) Unlock() (bool, string)
- func (this *Sql) Where(condition interface{}) *Sql
Constants ¶
View Source
const VERSION = "2.1.0"
Variables ¶
This section is empty.
Functions ¶
func RegisterConnection ¶
func RegisterConnection(name string, rwSep bool, hosts, port, dbname, user, pass string, pre string, safe bool, maxOpenConnsNmaxIdleConns ...int)
*
- [RegisterConnection Reg a connection]
- @param {[string]} name string [connection name]
- @param {[bool]} rwSep bool [use RWseparate]
- @param {[string]} hosts [hosts for exp:192.168.0.1,192.168.0.2]
- @param {[string]} port [port for exp:3306,3307]
- @param {[string]} dbname [dbnames]
- @param {[string]} user [users]
- @param {[string]} pass string [passwords]
- @param {[string]} pre string [prefix]
- @param {[bool]} safe bool [safemode]
- @param {[int]} maxOpenConnsNmaxIdleConns ...int [maxOpenConns and maxIdleConns for exp:2000,1000]
func RegisterConnectionDefault ¶
func RegisterConnectionDefault(rwSep bool, hosts, port, dbname, user, pass string, pre string, safe bool, maxOpenConnsNmaxIdleConns ...int)
*
- [RegisterConnectionDefault Reg the default connection]
- @param {[bool]} rwSep bool [use RWseparate]
- @param {[string]} hosts [hosts for exp:192.168.0.1,192.168.0.2]
- @param {[string]} port [port for exp:3306,3307]
- @param {[string]} dbname [dbnames]
- @param {[string]} user [users]
- @param {[string]} pass string [passwords]
- @param {[string]} pre string [prefix]
- @param {[bool]} safe bool [safemode]
- @param {[int]} maxOpenConnsNmaxIdleConns ...int [maxOpenConns and maxIdleConns for exp:2000,1000]
Types ¶
type Sql ¶
type Sql struct {
// contains filtered or unexported fields
}
func NewSqlInstance ¶
*
- [NewSqlInstance Get a new instance for user]
- @param {[string]} name string [connection name]
- @return (*Sql, error)
func (*Sql) GetConnectionName ¶
func (*Sql) MustMaster ¶
func (*Sql) NewCondition ¶
func (*Sql) StartTrans ¶
Click to show internal directories.
Click to hide internal directories.