orm

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "orm"

Variables

This section is empty.

Functions

func Builder

func Builder(sql string, bindValues ...any) builder

func CheckEmptyId

func CheckEmptyId(sql string, bindValues ...any) bool

func GetDB

func GetDB(connName ...string) *gorm.DB

在 GetDB 时进行服务初始化,连接数据库 使用 map 保存多个数据,dsn 作为 key 确保单例

Types

type OrmLogger

type OrmLogger struct {
	// contains filtered or unexported fields
}

orm 的日志实现类, 实现了gorm.Logger.Interface

func (*OrmLogger) Error

func (o *OrmLogger) Error(ctx context.Context, s string, i ...interface{})

func (*OrmLogger) Info

func (o *OrmLogger) Info(ctx context.Context, s string, i ...interface{})

func (*OrmLogger) Trace

func (o *OrmLogger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error)

func (*OrmLogger) Warn

func (o *OrmLogger) Warn(ctx context.Context, s string, i ...interface{})

type OrmProvider

type OrmProvider struct {
	core.ServiceProvider
}

func (*OrmProvider) AfterInit

func (*OrmProvider) AfterInit(instance any) error

func (*OrmProvider) BeforeInit

func (*OrmProvider) BeforeInit(c core.Container) error

func (*OrmProvider) InitOnBoot

func (*OrmProvider) InitOnBoot() bool

func (*OrmProvider) Name

func (self *OrmProvider) Name() string

func (*OrmProvider) Params

func (*OrmProvider) Params(c core.Container) []interface{}

func (*OrmProvider) RegisterProviderInstance

func (*OrmProvider) RegisterProviderInstance(c core.Container) core.NewInstanceFunc

type OrmService

type OrmService struct {
	Service
	// contains filtered or unexported fields
}

func (*OrmService) Init

func (self *OrmService) Init()

如果能获取到配置文件则进行数据库连接,这个目前在 engine/run.go -> initServices() 中直接实例化了

type Service

type Service interface {
	Init()
}

Jump to

Keyboard shortcuts

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