data

package
v0.0.0-...-fa05059 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: MIT, MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPostNotFound  = errors.New("post not found")
	ErrInvalidParams = errors.New("invalid parameters")
)

ProviderSet is data providers.

Functions

func InitTables

func InitTables(db *gorm.DB) error

func NewDB

func NewDB(c *conf.Data) (*gorm.DB, error)

NewDB initializes the database.

func NewLogger

func NewLogger() *zap.Logger

NewLogger 将日志输出到控制台

func NewMongoDB

func NewMongoDB(c *conf.Data) *mongo.Client

func NewPostData

func NewPostData(data *Data, l *zap.Logger) biz.PostData

func NewRedis

func NewRedis(c *conf.Data) redis.Cmdable

NewRedis initializes Redis.

func NewSaramaClient

func NewSaramaClient(c *conf.Data) (sarama.Client, error)

NewSaramaClient 初始化Sarama客户端,用于连接到Kafka集群

func NewSyncProducer

func NewSyncProducer(c sarama.Client) sarama.SyncProducer

NewSyncProducer 使用已有的Sarama客户端初始化同步生产者

Types

type Data

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

Data .

func NewData

func NewData(c *conf.Data, cs *conf.Service, db *gorm.DB, redis redis.Cmdable, logger log.Logger, mongo *mongo.Client) (*Data, func(), error)

NewData .

Jump to

Keyboard shortcuts

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