coreDb

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectDatabase

func ConnectDatabase(username, password, host, port, database, charset, logLevel string) (*gorm.DB, error)

ConnectDatabase 连接数据库

func GetRedisContext

func GetRedisContext() context.Context

func IfTxIsNullGetDB

func IfTxIsNullGetDB(tx *gorm.DB, ado *gorm.DB) *gorm.DB

IfTxIsNullGetDB 创建事务

func InitRedis

func InitRedis(cfg RedisConfig) *redis.Client

InitRedis 初始化 Redis 客户端

func IsErrRecordNotFound

func IsErrRecordNotFound(err error) bool

IsErrRecordNotFound 未找到记录

func IsRealError

func IsRealError(err error) bool

IsRealError 真实的错误

func IsRedisRealError

func IsRedisRealError(err error) bool

IsRedisRealError 判断错误是否是 真实的错误

func WithContext

func WithContext(c context.Context) context.Context

WithContext 创建上下文

Types

type RedisConfig

type RedisConfig struct {
	Host     string
	Port     string
	Password string
	DB       int

	PoolSize     int
	MinIdleConns int
}

Jump to

Keyboard shortcuts

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