Documentation ¶
Index ¶
- Variables
- type Column
- type Interface
- type Option
- type Order
- type OrderColumn
- type SetColumn
- type TX
- func (tx *TX) Commit() error
- func (tx *TX) CommitOrRollback()
- func (tx *TX) Create(i interface{}) error
- func (tx *TX) CreateInBatches(i interface{}, size int) error
- func (tx *TX) DB() *gorm.DB
- func (tx *TX) Delete(i interface{}, options ...Option) (int64, error)
- func (tx *TX) Get(i interface{}, options ...Option) (bool, error)
- func (tx *TX) List(i interface{}, options ...Option) (int64, error)
- func (tx *TX) Rollback() error
- func (tx *TX) SetColumns(i interface{}, options ...Option) error
- func (tx *TX) Updates(i, v interface{}, options ...Option) error
- type WhereColumn
- type WhereValue
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidTransaction = errors.New("invalid transaction, it is already committed or roll backed")
ErrInvalidTransaction means the transaction is alread committed or roll backed
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column interface { WhereColumn OrderColumn SetColumn }
Column is an interface for shortcut of WhereColumn, OrderColumn, SetColumn
type Interface ¶
type Interface interface { // DB returns the raw *gorm.DB. DB() *gorm.DB // Q returns the CRUD APIs without a transaction. Q() *TX // Begin returns the CRUD APIs with a transaction. Begin() *TX }
Interface .
type Option ¶
Option is the function processes *gorm.DB
type OrderColumn ¶
OrderColumn contains order by options
type SetColumn ¶
type SetColumn interface {
Set(value interface{}) Option
}
SetColumn is used in update statements
type TX ¶
type TX struct { Error error // contains filtered or unexported fields }
TX contains the CRUS APIs
func (*TX) CommitOrRollback ¶
func (tx *TX) CommitOrRollback()
CommitOrRollback commits the transaction if db.Error is nil, or rollbacks if the db.Error is not nil.
func (*TX) CreateInBatches ¶
CreateInBatches inserts multi rows
func (*TX) SetColumns ¶
SetColumns is used to set columns. At least one SetColumn Option in the options.
type WhereColumn ¶
type WhereColumn interface { Is(value interface{}) Option In(values []interface{}) Option InMap(values map[interface{}]struct{}) Option Like(value interface{}) Option GreaterThan(value interface{}) Option EqGreaterThan(value interface{}) Option LessThan(value interface{}) Option EqLessThan(value interface{}) Option }
WhereColumn contains options for conditions
type WhereValue ¶
WhereValue contains the option presents where the value in
Click to show internal directories.
Click to hide internal directories.