Documentation ¶
Index ¶
- Constants
- Variables
- func Begin(name ...string) (sqlExecutor, error)
- func Commit(e sqlExecutor) error
- func Count(i interface{}, where ...interface{}) int64
- func Delete(clause string, args ...interface{}) (int64, error)
- func InitLogger(l *log.Logger)
- func Insert(i interface{}, args ...string) (int64, error)
- func R(i interface{}, cond ...interface{}) error
- func Register(dsn string, driver ...string) error
- func RegisterTableFunc(fn func(string) string)
- func RegisterWithName(dsn, name string, driver ...string) (err error)
- func RollBack(e sqlExecutor) error
- func Select(i interface{}, condition string, args ...interface{}) error
- func SelectByPK(i interface{}, tableName ...string) error
- func SetLoggerLevel(s string)
- func Update(clause string, args ...interface{}) (int64, error)
- func Using(name string) sqlExecutor
- type ExecHandler
- type YormTableStruct
Constants ¶
View Source
const ( CamelToUnderscore = iota FieldName )
field name
View Source
const (
//DriverMySQL driver for mysql
DriverMySQL = "mysql"
)
Variables ¶
View Source
var ( ErrIllegalParams = errors.New("illegal parameter(s)") ErrNonPtr = errors.New("must be the pointer to the modified object") ErrNonSlice = errors.New("must be a slice") ErrNotSupported = errors.New("not supported now") ErrNilMethodReceiver = errors.New("the method receiver is nil.") ErrNilSqlExecutor = errors.New("yorm not register the db config") ErrUpdateBadSql = errors.New("must be begin with update keyword") ErrDuplicatePkColumn = errors.New("duplicate pk column find") ErrNonePkColumn = errors.New("none pk column find") )
View Source
var ( Close = "" Debug = "Debug" Warn = "Warn" Error = "Error" )
Functions ¶
func InitLogger ¶
func RegisterTableFunc ¶
table func 可以根据项目需要定制不同的model对应表名,比如添加前缀、后缀;删除model中的前缀等 对于实现了YormTableStruct ( YormTableName() string)则不会去处理
func RegisterWithName ¶
RegisterWithName register a database driver with specific name.
func SelectByPK ¶
SelectByPK select by pk.
func SetLoggerLevel ¶
func SetLoggerLevel(s string)
Types ¶
type YormTableStruct ¶
type YormTableStruct interface {
YormTableName() string
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.