xgorm

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModelToMap added in v1.21.7

func ModelToMap(m Model) map[string]any

func NewMysqlDB

func NewMysqlDB(cfg *DatabaseConfig) (*gorm.DB, error)

func RegisterCallBack

func RegisterCallBack(db *gorm.DB, callbacks ...Callback) error

Types

type Callback

type Callback struct {
	Name     string
	Action   string
	Before   string
	After    string
	Callback func(db *gorm.DB)
}

func (Callback) Valid

func (c Callback) Valid() error

type DatabaseConfig

type DatabaseConfig struct {
	Host         string
	Port         int
	Dbname       string
	Charset      string
	User         string
	Password     string
	MaxOpenConn  int
	MaxLifeTime  time.Duration
	MaxIdleConn  int
	MaxIdleTime  time.Duration
	ReadTimeout  int
	WriteTimeout int
	Timeout      int
	Debug        bool
}

type Model added in v1.21.7

type Model interface {
	TableName() string
}

Jump to

Keyboard shortcuts

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