orm

package
v0.10.14 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 20 Imported by: 2

Documentation

Index

Constants

View Source
const (
	KeyInitDB      = ginshared.KeyInitDB
	KeyTablePrefix = "database.tablePrefix"
)
View Source
const (
	HealthURIKey   = "healthz"
	HealthURIValue = "/healthz"
)
View Source
const ViewMysqlTmp = "CREATE OR REPLACE ALGORITHM = UNDEFINED VIEW %s%s AS %s"

Variables

View Source
var DialectorMap = make(map[string]OrmDialector)
View Source
var ViewMap = make(map[string]GetViewSql)

Functions

func AppendEntity added in v0.4.11

func AppendEntity(entity ...interface{})

func ApplyMigrate added in v0.5.0

func ApplyMigrate() error

func DefaulViewSql added in v0.4.8

func DefaulViewSql(tablePrefix, view, query string) string

func DisableGormLogger added in v0.10.14

func DisableGormLogger() gormlogger.Interface

func InitDB

func InitDB(sub string, logger *zap.Logger) *gorm.DB

func InitDBWithPrefix added in v0.10.0

func InitDBWithPrefix(sub string, prefix string) *gorm.DB

func InitDefaultDB added in v0.1.3

func InitDefaultDB(logger *zap.Logger) *gorm.DB

func InitMysqlViews added in v0.1.7

func InitMysqlViews(tx *gorm.DB, logger *zap.Logger) error

func MigrateTableAndView added in v0.4.11

func MigrateTableAndView(db *gorm.DB, logger *zap.Logger, bus EventBus.Bus)

func NewGormLogger added in v0.10.14

func NewGormLogger(slowThreshold time.Duration, logLeveal string) gormlogger.Interface

func ReplaceTablePrefix added in v0.10.10

func ReplaceTablePrefix(raw string, prefixes ...string) string

func SessionWithConfig added in v0.4.6

func SessionWithConfig(slowThreshold time.Duration, ignoredNotFound bool) *gorm.Session

Types

type GetViewSql added in v0.4.8

type GetViewSql func(tablePrefix, view, query string) string

type GormLogger added in v0.10.14

type GormLogger struct {
	ZapLogger *zap.Logger
	Config    gormlogger.Config
}

func (*GormLogger) Error added in v0.10.14

func (l *GormLogger) Error(ctx context.Context, msg string, data ...interface{})

func (*GormLogger) Info added in v0.10.14

func (l *GormLogger) Info(ctx context.Context, msg string, data ...interface{})

func (*GormLogger) LogMode added in v0.10.14

func (*GormLogger) Trace added in v0.10.14

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

func (*GormLogger) Warn added in v0.10.14

func (l *GormLogger) Warn(ctx context.Context, msg string, data ...interface{})

type HealthController

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

func (*HealthController) Ping

func (h *HealthController) Ping(c *gin.Context)

type OrmDialector added in v0.0.5

type OrmDialector func(dsn string) gorm.Dialector

Jump to

Keyboard shortcuts

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