gormx

package
v0.0.0-...-eb626f9 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(ctx context.Context, db *gorm.DB) (bool, error)

func ExecTrans

func ExecTrans(ctx context.Context, db *gorm.DB, fn TransFunc) error

func ExecTransWithLock

func ExecTransWithLock(ctx context.Context, db *gorm.DB, fn TransFunc) error

func FindOne

func FindOne(ctx context.Context, db *gorm.DB, out interface{}) (bool, error)

func FindPage

func FindPage(ctx context.Context, db *gorm.DB, pp pagination.Param, out interface{}) (int, error)

func GetDB

func GetDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

func GetDBWithModel

func GetDBWithModel(ctx context.Context, defDB *gorm.DB, m interface{}) *gorm.DB

func NewDB

func NewDB(c *Config) (*gorm.DB, func(), error)

func ParseOrder

func ParseOrder(items []*pagination.OrderField, handle ...OrderFieldFunc) string

func WrapPageQuery

func WrapPageQuery(ctx context.Context, db *gorm.DB, pp pagination.Param, out interface{}) (*pagination.Pagination, error)

Types

type Config

type Config struct {
	Debug        bool
	DBType       string
	DSN          string
	MaxLifetime  int
	MaxOpenConns int
	MaxIdleConns int
	TablePrefix  string
}

type OrderFieldFunc

type OrderFieldFunc func(string) string

type TransFunc

type TransFunc func(context.Context) error

Jump to

Keyboard shortcuts

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