connector

package module
v0.0.0-...-0450a86 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2019 License: GPL-3.0 Imports: 7 Imported by: 2

README

connector

connector is a tool to connect with system or any tools, such as mysql and so on.

database(mysql)

txorm

gxorm

Documentation

Index

Constants

View Source
const (
	Logic = iota
	BeforeLogic
	AfterLogic
	OnError
	AfterCommit
)

Function Flags

View Source
const (
	DefaultDatabase = "trellis::connector::default"
)

defines

Variables

This section is empty.

Functions

func AddErrorTypes

func AddErrorTypes(errType reflect.Type)

AddErrorTypes 增加支持的错误类型

func CallFunc

func CallFunc(fn interface{}, funcs LogicFuncs, args []interface{}) ([]interface{}, errors.ErrCode)

CallFunc execute transaction function with logic functions and args

func DeepFields

func DeepFields(iface interface{}, vType reflect.Type, fields []reflect.Value) interface{}

DeepFields relect interface deep fields

func Derive

func Derive(origin interface{}) (interface{}, error)

Derive derive from developer function

func GetMysqlDSNFromConfig

func GetMysqlDSNFromConfig(name string, conf config.Configuration) string

GetMysqlDSNFromConfig get mysql dsn from gogap config

func Inherit

func Inherit(new, origin interface{}) error

Inherit inherit a new repository from origin repository

Types

type Committer

type Committer interface {
	TX(fn interface{}, repos ...interface{}) errors.ErrCode
	TXWithName(fn interface{}, name string, repos ...interface{}) errors.ErrCode
	NonTX(fn interface{}, repos ...interface{}) errors.ErrCode
	NonTXWithName(fn interface{}, name string, repos ...interface{}) errors.ErrCode
}

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 TXFunc

type TXFunc func(repos []interface{}) errors.ErrCode

TXFunc Transation function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL