Documentation ¶
Index ¶
- Constants
- Variables
- func AddErrorTypes(errType reflect.Type)
- func CallFunc(fn interface{}, funcs LogicFuncs, args []interface{}) ([]interface{}, error)
- func DeepFields(iface interface{}, vType reflect.Type, fields []reflect.Value) interface{}
- func Derive(origin interface{}) (interface{}, error)
- func GetMysqlDSNFromConfig(name string, conf config.Config) string
- func Inherit(new, origin interface{}) error
- func NewEnginesFromConfig(conf config.Config) (engines map[string]*xorm.Engine, err error)
- func NewEnginesFromFile(file string) (map[string]*xorm.Engine, error)
- type Committer
- type Deriver
- type Inheritor
- type LogicFuncs
- type TXFunc
- type TXorm
- func (p *TXorm) NonTX(fn interface{}, repos ...interface{}) error
- func (p *TXorm) NonTXWithName(fn interface{}, name string, repos ...interface{}) error
- func (p *TXorm) Session() *xorm.Session
- func (p *TXorm) SetEngines(engines map[string]*xorm.Engine)
- func (p *TXorm) TX(fn interface{}, repos ...interface{}) error
- func (p *TXorm) TXWithName(fn interface{}, name string, repos ...interface{}) error
Constants ¶
View Source
const ( Logic = iota BeforeLogic AfterLogic OnError AfterCommit )
Function Flags
View Source
const (
DefaultDatabase = "go-trellis::txorm::default"
)
defines
Variables ¶
View Source
var ( ErrNotFoundDefaultDatabase = errors.New("not found default database") ErrAtLeastOneRepo = errors.New("input one repo at least") ErrNotFoundTransationFunction = errors.New("not found transation function") ErrStructCombineWithRepo = errors.New("your repository struct should combine repo") ErrFailToCreateRepo = errors.New("fail to create an new repo") ErrFailToConvetTXToNonTX = errors.New("could not convert TX to NON-TX") ErrTransactionIsAlreadyBegin = errors.New("transaction is already begin") ErrNonTransactionCantCommit = errors.New("non-transaction can't commit") ErrTransactionSessionIsNil = errors.New("transaction session is nil") ErrNotFoundXormEngine = errors.New("not found xorm engine") )
define connector errors
Functions ¶
func CallFunc ¶
func CallFunc(fn interface{}, funcs LogicFuncs, args []interface{}) ([]interface{}, error)
CallFunc execute transaction function with logic functions and args
func DeepFields ¶
DeepFields relect interface deep fields
func Derive ¶
func Derive(origin interface{}) (interface{}, error)
Derive derive from developer function
func GetMysqlDSNFromConfig ¶
GetMysqlDSNFromConfig get mysql dsn from gogap config
func Inherit ¶
func Inherit(new, origin interface{}) error
Inherit inherit a new repository from origin repository
func NewEnginesFromConfig ¶ added in v1.0.1
NewEnginesFromConfig initial xorm engine from config
Types ¶
type Committer ¶
type Committer interface { TX(fn interface{}, repos ...interface{}) error TXWithName(fn interface{}, name string, repos ...interface{}) error NonTX(fn interface{}, repos ...interface{}) error NonTXWithName(fn interface{}, name string, repos ...interface{}) error }
Committer Defination
type Deriver ¶
type Deriver interface {
Derive() (repo interface{}, err error)
}
Deriver derive function
type Inheritor ¶
type Inheritor interface {
Inherit(repo interface{}) error
}
Inheritor inherit function
type LogicFuncs ¶
type LogicFuncs struct { BeforeLogic interface{} AfterLogic interface{} OnError interface{} Logic interface{} AfterCommit interface{} }
LogicFuncs logic functions
func GetLogicFuncs ¶
func GetLogicFuncs(fn interface{}) (funcs LogicFuncs)
GetLogicFuncs reflect logic function
type TXorm ¶
type TXorm struct {
// contains filtered or unexported fields
}
TXorm trellis xorm
func (*TXorm) NonTXWithName ¶
NonTXWithName do non transaction function with name of database
func (*TXorm) SetEngines ¶
SetEngines set xorm engines
func (*TXorm) TXWithName ¶
TXWithName do transaction function with name of database
Click to show internal directories.
Click to hide internal directories.