common

package
v0.0.0-...-8d187f3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCEDBVersion

func CheckCEDBVersion(dc *DBConfig) error

func CheckCEDBVersionTableExists

func CheckCEDBVersionTableExists(dc *DBConfig) (bool, error)

func CheckDBVersion

func CheckDBVersion(dc *DBConfig, tableName string, expectedVersion string) error

func CheckTableExists

func CheckTableExists(dc *DBConfig, tableName string) (bool, error)

func CreateCEDBVersionTable

func CreateCEDBVersionTable(dc *DBConfig) error

func CreateDatabase

func CreateDatabase(dc *DBConfig) error

func CreateDatabaseIfNotExists

func CreateDatabaseIfNotExists(dc *DBConfig) (bool, error)

func CreateTable

func CreateTable(dc *DBConfig, sql string) error

func DropDatabase

func DropDatabase(dc *DBConfig) error

func DropDatabaseIfInitTablesFailed

func DropDatabaseIfInitTablesFailed(dc *DBConfig, editionFunc EditionInitTablesFunc) error

func ExecuteCEIssues

func ExecuteCEIssues(dc *DBConfig, curVersion string) error

func ExecuteIssues

func ExecuteIssues(dc *DBConfig, curVersion string, schemaDir string) error

func GetCEDBVersion

func GetCEDBVersion(dc *DBConfig) (string, error)

func GetDBVersion

func GetDBVersion(dc *DBConfig, tableName string) (string, error)

func GetSessionWithName

func GetSessionWithName(cfg config.MySqlConfig) (*gorm.DB, error)

func GetSessionWithoutName

func GetSessionWithoutName(cfg config.MySqlConfig) (*gorm.DB, error)

func InitCETables

func InitCETables(dc *DBConfig) error

func InitDefaultORGTables

func InitDefaultORGTables(dc *DBConfig, schemaDir string) error

func InitORGTables

func InitORGTables(dc *DBConfig, schemaDir string) error

func InitTables

func InitTables(dc *DBConfig, schemaDir string) error

func InsertDBVersion

func InsertDBVersion(dc *DBConfig, tableName string, version string) error

func LogDBName

func LogDBName(databaseName string, format string, a ...any) string

Types

type DBConfig

type DBConfig struct {
	DB     *gorm.DB
	Config config.MySqlConfig
}

func NewDBConfig

func NewDBConfig(db *gorm.DB, cfg config.MySqlConfig) *DBConfig

func (*DBConfig) GetDatabaseName

func (dc *DBConfig) GetDatabaseName() string

func (*DBConfig) SetConfig

func (dc *DBConfig) SetConfig(c config.MySqlConfig)

func (*DBConfig) SetDB

func (dc *DBConfig) SetDB(db *gorm.DB)

type Edition

type Edition struct {
	SchemeDir         string
	DBVersionTable    string
	DBVersionExpected string
}

func NewEdition

func NewEdition(schemeDir string, dbVersionTable string, dbVersionExpected string) *Edition

type EditionInitTablesFunc

type EditionInitTablesFunc func(dc *DBConfig) error // TODO

Jump to

Keyboard shortcuts

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