mysql

package
v0.0.0-...-b6e1ce4 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustLoad

func MustLoad(userName, password, host, database string, maxOpen, maxIdle int, maxLifeTime time.Duration)

Types

type IDB

type IDB interface {
	GetDB() *gorm.DB
	DBClose() error
	Migrate()
}

func DB

func DB() IDB

type RepoDB

type RepoDB[T any] struct {
	// contains filtered or unexported fields
}

func MustNew

func MustNew[T any]() *RepoDB[T]

func (*RepoDB[T]) Count

func (r *RepoDB[T]) Count() (int64, error)

func (*RepoDB[T]) Create

func (r *RepoDB[T]) Create(obj T) error

func (*RepoDB[T]) Delete

func (r *RepoDB[T]) Delete(obj T) error

func (*RepoDB[T]) DeleteByKV

func (*RepoDB[T]) DeleteByKV(key string, val interface{}, obj T) error

func (*RepoDB[T]) Expr

func (r *RepoDB[T]) Expr(obj T, key, value string, column, expr string, num int) error

func (*RepoDB[T]) Find

func (r *RepoDB[T]) Find() ([]T, error)

func (*RepoDB[T]) FindByPage

func (r *RepoDB[T]) FindByPage(options *options.ListOptions) ([]T, int64, error)

func (*RepoDB[T]) FindByRaw

func (r *RepoDB[T]) FindByRaw(sql string) ([]T, error)

func (*RepoDB[T]) First

func (r *RepoDB[T]) First() (T, error)

func (*RepoDB[T]) List

func (r *RepoDB[T]) List(options *options.ListOptions) ([]T, error)

func (*RepoDB[T]) SetOptions

func (r *RepoDB[T]) SetOptions(key string, val interface{}) *RepoDB[T]

func (*RepoDB[T]) SetOptionsByMap

func (r *RepoDB[T]) SetOptionsByMap(data map[string]interface{}) *RepoDB[T]

func (*RepoDB[T]) SetOrderBy

func (r *RepoDB[T]) SetOrderBy(orderBy string) *RepoDB[T]

func (*RepoDB[T]) SetPreLoad

func (r *RepoDB[T]) SetPreLoad(pre string) *RepoDB[T]

func (*RepoDB[T]) SetTable

func (r *RepoDB[T]) SetTable(table string) *RepoDB[T]

func (*RepoDB[T]) TxCreate

func (r *RepoDB[T]) TxCreate(obj T, txDB *gorm.DB) error

func (*RepoDB[T]) TxDelete

func (r *RepoDB[T]) TxDelete(obj T, txDB *gorm.DB) error

func (*RepoDB[T]) TxExpr

func (r *RepoDB[T]) TxExpr(obj T, key, value string, column, expr string, num int, txDB *gorm.DB) error

func (*RepoDB[T]) TxUpdate

func (r *RepoDB[T]) TxUpdate(key, value string, attr map[string]interface{}, obj T, txDB *gorm.DB) error

func (*RepoDB[T]) Update

func (r *RepoDB[T]) Update(key, value string, attr map[string]interface{}, obj T) error

Jump to

Keyboard shortcuts

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