mysql

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create[T interface{}](add T) error

func DB

func DB() *gorm.DB

func DBWithGormMysql

func DBWithGormMysql(reg *register.Register)

func Delete

func Delete[T interface{}](model T, args interface{}) error

func Select

func Select[T interface{}](model T, args interface{}) (T, error)

func SelectAll

func SelectAll[T interface{}](model T, args interface{}) ([]T, error)

func SelectPage

func SelectPage[T interface{}](model T, args interface{}, page, limit int) ([]T, int64, error)

func Update

func Update[T interface{}](model T, args interface{}, update map[string]interface{}) error

Types

type GormMysqlComponent

type GormMysqlComponent struct {
	Host            string `toml:"host" json:"host"`
	Port            int    `toml:"port" json:"port"`
	User            string `toml:"user" json:"user"`
	Passwd          string `toml:"passwd" json:"passwd"`
	DbName          string `toml:"dbname" json:"dbname"`
	MaxIdleConns    int    `toml:"max_idle_conns" json:"max_idle_conns"`
	MaxOpenConns    int    `toml:"max_open_conns" json:"max_open_conns"`
	ConnMaxIdletime int    `toml:"conn_max_idletime" json:"conn_max_idletime"`
	ConnMaxLifetime int    `toml:"conn_max_lifetime" json:"conn_max_lifetime"`
	// contains filtered or unexported fields
}

func (*GormMysqlComponent) Init

func (gmc *GormMysqlComponent) Init() error

func (*GormMysqlComponent) Name

func (gmc *GormMysqlComponent) Name() string

func (*GormMysqlComponent) Ready

func (gmc *GormMysqlComponent) Ready()

Jump to

Keyboard shortcuts

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