xgorm

package
v1.24.7 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 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 SetCallBacks added in v1.22.5

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

Types

type Callback

type Callback struct {
	Name      string
	Action    string
	SortName  string
	SortValue 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
	Loc          string
}

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