database

package
v0.0.0-...-08c5772 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGormMySQL

func NewGormMySQL(properties conf.GormMysqlConfigProperties) (*gorm.DB, error)

NewGormMySQL 初始化 gorm 对于 MySQL 的连接

func NewRedisClient

func NewRedisClient(properties conf.RedisConfigProperties) (*redis.Client, error)

NewRedisClient 初始化 redis 连接

Types

type DbFactory

type DbFactory struct {
	// 基于 gorm 的 MySQL 连接
	GormMySQL *gorm.DB

	// 基于 go-redis 的 Redis 连接
	RedisCli *redis.Client
	// 基于 go 的 elasticsearch 连接
	Es *Es
}

func NewDbFactory

func NewDbFactory(args ...any) *DbFactory

type Es

type Es struct {
	Cli *elasticsearch.Client
	// 适用于 go api 的 elasticsearch 连接
	TypedCli *elasticsearch.TypedClient
}

func NewEsTypedClient

func NewEsTypedClient(properties conf.ElasticSearchConfigProperties) (*Es, error)

NewEsTypedClient 初始化 适用于 go api 的 elasticsearch 连接

Jump to

Keyboard shortcuts

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