Documentation ¶
Index ¶
- Variables
- func GetDb(buildName string) (*gorm.DB, error)
- func NewMysqlPool() *mysqlPool
- type BaseFieldInterface
- type BaseManModeInterface
- type BaseManyModel
- func (b *BaseManyModel) GetAllFieldTag(structs BaseFieldInterface) []string
- func (b *BaseManyModel) GetAllFieldTagNotTable(structs BaseFieldInterface) []string
- func (b *BaseManyModel) GetDb() (*gorm.DB, error)
- func (b *BaseManyModel) GetItemTag(structs BaseFieldInterface, key string) string
- func (b *BaseManyModel) GetItemTagAliasTable(structs BaseFieldInterface, key string, AliasTable string) string
- func (b *BaseManyModel) GetItemTagNotTable(structs BaseFieldInterface, key string) string
- func (b *BaseManyModel) Paginator(page int, pageSize int, totalNum int) int
- func (b *BaseManyModel) SetBuilderName(buildName string)
- type BaseModel
- func (b *BaseModel) GetAllFieldTag(structs BaseFieldInterface) []string
- func (b *BaseModel) GetDb() (*gorm2.DB, error)
- func (b *BaseModel) GetItemTag(structs BaseFieldInterface, key string) string
- func (b *BaseModel) GetItemTagAliasTable(structs BaseFieldInterface, key string, AliasTable string) string
- func (b *BaseModel) GetItemTagNotTable(structs BaseFieldInterface, key string) string
- func (b *BaseModel) Paginator(page int, pageSize int, totalNum int) int
- type BuilderInterface
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MYSQL_ERR_BUILDER = errors.New("mysql builder error") DEFULA_LOG_DIR = "/Log" UTFALL_DATE = "2006-01-02" )
Functions ¶
func NewMysqlPool ¶
func NewMysqlPool() *mysqlPool
Types ¶
type BaseFieldInterface ¶
type BaseFieldInterface interface {
TableName() string
}
type BaseManModeInterface ¶ added in v1.1.0
type BaseManModeInterface interface {
Build() BaseManyModel
}
type BaseManyModel ¶ added in v1.1.0
type BaseManyModel struct {
// contains filtered or unexported fields
}
* 多表
func (*BaseManyModel) GetAllFieldTag ¶ added in v1.1.0
func (b *BaseManyModel) GetAllFieldTag(structs BaseFieldInterface) []string
* 获取所有 tag
func (*BaseManyModel) GetAllFieldTagNotTable ¶ added in v1.1.1
func (b *BaseManyModel) GetAllFieldTagNotTable(structs BaseFieldInterface) []string
* 获取所有 tag 不加table前缀
func (*BaseManyModel) GetItemTag ¶ added in v1.1.0
func (b *BaseManyModel) GetItemTag(structs BaseFieldInterface, key string) string
* 获取指定tag
func (*BaseManyModel) GetItemTagAliasTable ¶ added in v1.1.0
func (b *BaseManyModel) GetItemTagAliasTable(structs BaseFieldInterface, key string, AliasTable string) string
* 获取指定标签 并转为别名
func (*BaseManyModel) GetItemTagNotTable ¶ added in v1.1.0
func (b *BaseManyModel) GetItemTagNotTable(structs BaseFieldInterface, key string) string
func (*BaseManyModel) Paginator ¶ added in v1.1.0
func (b *BaseManyModel) Paginator(page int, pageSize int, totalNum int) int
* @title 总页数计算 @param page int 当前页 @param pageSize int 每页显示 @param totalNum int 总记录数
func (*BaseManyModel) SetBuilderName ¶ added in v1.1.0
func (b *BaseManyModel) SetBuilderName(buildName string)
type BaseModel ¶
type BaseModel struct{}
func (*BaseModel) GetAllFieldTag ¶
func (b *BaseModel) GetAllFieldTag(structs BaseFieldInterface) []string
* 获取所有 tag
func (*BaseModel) GetItemTag ¶
func (b *BaseModel) GetItemTag(structs BaseFieldInterface, key string) string
* 获取指定tag
func (*BaseModel) GetItemTagAliasTable ¶
func (b *BaseModel) GetItemTagAliasTable(structs BaseFieldInterface, key string, AliasTable string) string
* 获取指定标签 并转为别名
func (*BaseModel) GetItemTagNotTable ¶
func (b *BaseModel) GetItemTagNotTable(structs BaseFieldInterface, key string) string
type BuilderInterface ¶
type BuilderInterface interface { SetBuilderName(builderName string) BuilderInterface GetBuildName() string //地址 SetHost(host string) BuilderInterface //获取地址 GetHost() string //口端 SetPort(port int) BuilderInterface //获取端口 GetPort() int //用户名 SetUser(user string) BuilderInterface //获取用户名 GetUser() string //密码 SetPwd(pwd string) BuilderInterface //获取密码 GetPwd() string //数据库 SetDbName(dbName string) BuilderInterface //获取数据库 GetDbName() string //设置编码 SetChartSet(chartSet string) BuilderInterface //获取编码 GetChartSet() string //是否开启日志调试 SetIsDebug(isDebug bool) BuilderInterface //获取是否开启日志调试 GetIsDebug() bool //设置空闲连接池中的最大连接数(默认为10) SetMaxIdleConns(maxIdleConns int) BuilderInterface //获取空闲连接池中最大连接数 GetMaxIdleConns() int //设置与数据库的最大打开连接数(默认为10) SetMaxOpenConns(maxOpenConns int) BuilderInterface //获取与数据中最大打开连接数 GetMaxOpenConns() int //日志保存目录(当isDebug为true时开启) SetLogDir(logDir string) BuilderInterface //获取日志保存目录 GetLogDir() string GetHash() (string, error) }
func NewMysqlBuilder ¶
func NewMysqlBuilder(builderName, host string, port int, user, pwd, dbName, chartSet string, debug bool) BuilderInterface
* 带参初始化
Source Files ¶
Click to show internal directories.
Click to hide internal directories.