Documentation ¶
Index ¶
- Variables
- func RegisterDataBase(aliasName, driverName, host, database, user, pwd string, params ...int) error
- func RegisterModel(models ...interface{})
- func SetLogging(islogging bool)
- func SetMaxIdleConns(aliasName string, maxIdleConns int)
- func SetMaxOpenConns(aliasName string, maxOpenConns int)
- type Commiter
- type Cond
- type IOperateSet
- type IOrm
- type ITransaction
- type ITx
- type Rollbacker
- type Transaction
- func (t *Transaction) Commit() error
- func (t *Transaction) Count(model interface{}, fields Cond) (int64, error)
- func (t *Transaction) Delete(model interface{}) (int64, error)
- func (t *Transaction) Exec(sql string, args ...interface{}) (int64, error)
- func (t *Transaction) ExecSQL(dest interface{}, sql string, args ...interface{}) error
- func (t *Transaction) Insert(model interface{}) (int64, error)
- func (t *Transaction) One(model interface{}, fields Cond) error
- func (t *Transaction) QuerySQL(dests interface{}, sql string, args ...interface{}) error
- func (t *Transaction) Rollback() error
- func (t *Transaction) Select(models interface{}, fields Cond, orderby ...interface{}) error
- func (t *Transaction) SelectLimit(models interface{}, fields Cond, offset int64, limit int64, ...) error
- func (t *Transaction) Update(model interface{}, cols ...string) error
- func (t *Transaction) Using(name string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNoMoreRows = errors.New(`orm: no more rows in this result set`)
)
Error messages.
Functions ¶
func RegisterDataBase ¶
func SetMaxIdleConns ¶
SetMaxIdleConns Change the max idle conns for *sql.DB, use specify database alias name
func SetMaxOpenConns ¶
SetMaxOpenConns Change the max open conns for *sql.DB, use specify database alias name
Types ¶
type Commiter ¶
type Commiter interface { // Commit commits the current transaction. Commit() error }
type Cond ¶
type Cond map[interface{}]interface{}
Cond is a map that defines conditions for a query and satisfies the Constraints and Compound interfaces.
type IOperateSet ¶
type IOperateSet interface { Insert(model interface{}) (int64, error) Update(model interface{}, cols ...string) error Delete(model interface{}) (int64, error) Select(models interface{}, fields Cond, orderby ...interface{}) error SelectLimit(models interface{}, fields Cond, offset int64, limit int64, orderby ...interface{}) error One(model interface{}, fields Cond) error Count(model interface{}, fields Cond) (int64, error) Exec(sql string, args ...interface{}) (int64, error) Using(name string) error QuerySQL(dests interface{}, sql string, args ...interface{}) error ExecSQL(dest interface{}, sql string, args ...interface{}) error }
type IOrm ¶
type IOrm interface { IOperateSet ITransaction }
type ITransaction ¶
type ITx ¶
type ITx interface { //goorm.OperateSet adds operation methods to the transaction. IOperateSet //Rollbacker add Rollback method to the transaction. Rollbacker //Commiter add Commiter method to the transaction. Commiter }
type Rollbacker ¶
type Rollbacker interface { // Rollback discards all the instructions on the current transaction. Rollback() error }
type Transaction ¶
type Transaction struct { Tx sqlbuilder.Tx // contains filtered or unexported fields }
func (*Transaction) Commit ¶
func (t *Transaction) Commit() error
func (*Transaction) Count ¶
func (t *Transaction) Count(model interface{}, fields Cond) (int64, error)
func (*Transaction) Delete ¶
func (t *Transaction) Delete(model interface{}) (int64, error)
func (*Transaction) Exec ¶
func (t *Transaction) Exec(sql string, args ...interface{}) (int64, error)
func (*Transaction) ExecSQL ¶
func (t *Transaction) ExecSQL(dest interface{}, sql string, args ...interface{}) error
func (*Transaction) Insert ¶
func (t *Transaction) Insert(model interface{}) (int64, error)
func (*Transaction) One ¶
func (t *Transaction) One(model interface{}, fields Cond) error
func (*Transaction) QuerySQL ¶
func (t *Transaction) QuerySQL(dests interface{}, sql string, args ...interface{}) error
func (*Transaction) Rollback ¶
func (t *Transaction) Rollback() error
func (*Transaction) Select ¶
func (t *Transaction) Select(models interface{}, fields Cond, orderby ...interface{}) error
func (*Transaction) SelectLimit ¶
func (t *Transaction) SelectLimit(models interface{}, fields Cond, offset int64, limit int64, orderby ...interface{}) error
func (*Transaction) Update ¶
func (t *Transaction) Update(model interface{}, cols ...string) error
func (*Transaction) Using ¶
func (t *Transaction) Using(name string) error
Click to show internal directories.
Click to hide internal directories.