client

package
v0.0.0-...-86f4363 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Timeout = 3 * time.Second // 默认超时时间
)

Variables

This section is empty.

Functions

func GetConn

func GetConn() (*kafukago.Conn, error)

GetConn conn不能保证并发安全,仅可作为单线程的长连接使用。

func GetNewReader

func GetNewReader(topic string, groupID string) *kafukago.Reader

GetNewReader 创建一个reader示例,reader是并发安全的

func GetNewWriter

func GetNewWriter(topic string, async bool) (*kafukago.Writer, error)

GetNewWriter 创建一个writer示例,writer是并发安全的。

func InitCartRPC

func InitCartRPC() (*cartservice.Client, error)

func InitCommodityRPC

func InitCommodityRPC() (*commodityservice.Client, error)

func InitCommodityStreamClientRPC

func InitCommodityStreamClientRPC() (*commodityservice.StreamClient, error)

func InitMySQL

func InitMySQL() (db *gorm.DB, err error)

InitMySQL 通用初始化mysql函数,传入tableName指定表

func InitOrderRPC

func InitOrderRPC() (*orderservice.Client, error)

func InitPaymentRPC

func InitPaymentRPC() (*paymentservice.Client, error)

func InitRedis

func InitRedis(db int) (*redis.Client, error)

func InitUserRPC

func InitUserRPC() (*userservice.Client, error)

func IsESConnected

func IsESConnected(es *elasticsearch.Client) bool

func NewEsClient

func NewEsClient() (*elasticsearch.Client, error)

func NewEsCommodityClient

func NewEsCommodityClient() (*elastic.Client, error)

func NewRedisClient

func NewRedisClient(db int) (*redis.Client, error)

NewRedisClient 传入dbName,具体参考 constants 包

Types

This section is empty.

Jump to

Keyboard shortcuts

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