utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMetaWithError

func GetMetaWithError(err error) *v1.Metadata

func GetMetaWithErrorString

func GetMetaWithErrorString(err string) *v1.Metadata

func GetSnowflakeId

func GetSnowflakeId() int64

func GetSuccessMeta

func GetSuccessMeta() *v1.Metadata

func InitDefaultSnowflakeNode

func InitDefaultSnowflakeNode(node int64)

func InitStdLogger

func InitStdLogger(config *conf.App) log.Logger

Types

type DBClient

type DBClient struct {
	// contains filtered or unexported fields
}

func (*DBClient) DB

func (c *DBClient) DB(ctx context.Context) *gorm.DB

func (*DBClient) ExecTx

func (c *DBClient) ExecTx(ctx context.Context, fn func(ctx context.Context) error) error

ExecTx gorm Transaction

func (*DBClient) GetDB

func (c *DBClient) GetDB() *gorm.DB

func (*DBClient) WhereWithPaginateAndSort

func (c *DBClient) WhereWithPaginateAndSort(
	ctx context.Context,
	fn WhereConditionFn,
	value interface{},
	sort string,
	request *dto.PaginationRequest,
) *gorm.DB

type Transaction

type Transaction interface {
	ExecTx(context.Context, func(ctx context.Context) error) error
}

type WhereConditionFn

type WhereConditionFn func(db *gorm.DB) *gorm.DB

Jump to

Keyboard shortcuts

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