orm

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: MIT Imports: 12 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)

Functions

func InitDB

func InitDB(sub string, logger *zap.Logger) *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

Types

type CleanupService added in v0.2.6

type CleanupService struct {
	DBMap map[string]*gorm.DB
	// contains filtered or unexported fields
}

func (*CleanupService) Cleanup added in v0.2.6

func (cs *CleanupService) Cleanup(req *DBCleanupReq) error

func (*CleanupService) GetDefaultRequest added in v0.2.6

func (cs *CleanupService) GetDefaultRequest() *DBCleanupReq

func (*CleanupService) RegConnection added in v0.2.6

func (cs *CleanupService) RegConnection(name string, db *gorm.DB)

type DBCleanupReq added in v0.2.6

type DBCleanupReq struct {
	Cnn          string   //connection name
	Tables       []string //tables to be clean
	DeletedField string   //field name, default is deletedAt
	Duration     string   // only delete DeletedAt <  now - duration
	Batch        int      // batch per deleted
}

type DBCronJob added in v0.1.8

type DBCronJob struct {
	Name     string
	Schedule string
	Sql      string
	// contains filtered or unexported fields
}

func (*DBCronJob) FireJob added in v0.1.8

func (job *DBCronJob) FireJob()

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