Documentation ¶
Index ¶
- func GetBaseConfig(c framework.Container) *contract.DBConfig
- func NewHadeGorm(params ...interface{}) (interface{}, error)
- func WithConfigPath(configPath string) contract.DBOption
- func WithDryRun() contract.DBOption
- func WithFullSaveAssociations() contract.DBOption
- func WithGormConfig(f func(options *contract.DBConfig)) contract.DBOption
- type GormProvider
- type HadeGorm
- func (app *HadeGorm) CanConnect(ctx context.Context, db *gorm.DB) (bool, error)
- func (app *HadeGorm) GetDB(option ...contract.DBOption) (*gorm.DB, error)
- func (app *HadeGorm) GetTableColumns(ctx context.Context, db *gorm.DB, table string) ([]contract.TableColumn, error)
- func (app *HadeGorm) GetTables(ctx context.Context, db *gorm.DB) ([]string, error)
- func (app *HadeGorm) HasTable(ctx context.Context, db *gorm.DB, table string) (bool, error)
- type OrmLogger
- func (o *OrmLogger) Error(ctx context.Context, s string, i ...interface{})
- func (o *OrmLogger) Info(ctx context.Context, s string, i ...interface{})
- func (o *OrmLogger) LogMode(level logger.LogLevel) logger.Interface
- func (o *OrmLogger) Trace(ctx context.Context, begin time.Time, ...)
- func (o *OrmLogger) Warn(ctx context.Context, s string, i ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBaseConfig ¶
GetBaseConfig 读取database.yaml根目录结构
func NewHadeGorm ¶
func NewHadeGorm(params ...interface{}) (interface{}, error)
NewHadeGorm 代表实例化Gorm
func WithConfigPath ¶
WithConfigPath 加载配置文件地址
func WithFullSaveAssociations ¶
WithFullSaveAssociations 设置保存时候关联
Types ¶
type GormProvider ¶
type GormProvider struct { }
GormProvider 提供App的具体实现方法
func (*GormProvider) Boot ¶
func (h *GormProvider) Boot(container framework.Container) error
Boot 启动调用
func (*GormProvider) Params ¶
func (h *GormProvider) Params(container framework.Container) []interface{}
Params 获取初始化参数
func (*GormProvider) Register ¶
func (h *GormProvider) Register(container framework.Container) framework.NewInstance
Register 注册方法
type HadeGorm ¶
type HadeGorm struct {
// contains filtered or unexported fields
}
HadeGorm 代表hade框架的orm实现
func (*HadeGorm) CanConnect ¶ added in v1.0.6
func (*HadeGorm) GetTableColumns ¶ added in v1.0.6
type OrmLogger ¶
type OrmLogger struct {
// contains filtered or unexported fields
}
OrmLogger orm的日志实现类, 实现了gorm.Logger.Interface
Click to show internal directories.
Click to hide internal directories.