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: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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 NewInteractiveData

func NewInteractiveData(db *gorm.DB, l *zap.Logger) biz.InteractiveRepo

func NewLogger

func NewLogger() *zap.Logger

NewLogger 将日志输出到控制台

func NewRedis

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

NewRedis initializes Redis.

func NewSaramaClient

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

NewSaramaClient 初始化一个新的 Sarama 客户端

func NewSyncProducer

func NewSyncProducer(client sarama.Client) (sarama.SyncProducer, error)

NewSyncProducer 初始化一个新的 Sarama 同步生产者

Types

type Data

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

Data .

func NewData

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

NewData .

type Interactive

type Interactive struct {
	Id           int64  `gorm:"column:id;primaryKey;autoIncrement"`
	BizId        int64  `gorm:"column:biz_id"`
	BizName      string `gorm:"column:biz_name;type:varchar(255)"`
	ReadCount    int64  `gorm:"column:read_count"`
	LikeCount    int64  `gorm:"column:like_count"`
	CollectCount int64  `gorm:"column:collect_count"`
	UpdateTime   int64  `gorm:"column:update_time"`
	CreateTime   int64  `gorm:"column:create_time"`
	PostId       int64  `gorm:"column:post_id"`
	DeletedAt    int64  `gorm:"index"`
}

type InteractiveData

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

func (*InteractiveData) AddCollectCount

func (i *InteractiveData) AddCollectCount(ctx context.Context, postId int64, biz string) error

AddCollectCount implements biz.InteractiveRepo.

func (*InteractiveData) AddLikeCount

func (i *InteractiveData) AddLikeCount(ctx context.Context, postId int64, biz string) error

AddLikeCount implements biz.InteractiveRepo.

func (*InteractiveData) AddReadCount

func (i *InteractiveData) AddReadCount(ctx context.Context, postId int64, biz string) error

AddReadCount implements biz.InteractiveRepo.

func (*InteractiveData) GetInteractive

func (i *InteractiveData) GetInteractive(ctx context.Context, postId int64) (domain.Interactive, error)

GetInteractive implements biz.InteractiveRepo.

func (*InteractiveData) ListInteractive

func (i *InteractiveData) ListInteractive(ctx context.Context, pagination domain.Pagination) ([]domain.Interactive, error)

ListInteractive implements biz.InteractiveRepo.

type UserCollection

type UserCollection struct {
	ID           int64  `gorm:"primaryKey;autoIncrement"`                     // 收藏记录ID,主键,自增
	Uid          int64  `gorm:"index"`                                        // 用户ID,用于标识哪个用户收藏
	BizID        int64  `gorm:"index"`                                        // 业务ID,用于标识收藏的业务对象
	BizName      string `gorm:"type:varchar(255)"`                            // 业务名称
	Status       int    `gorm:"column:status"`                                // 状态,用于表示收藏的状态(如有效、无效等)
	CollectionId int64  `gorm:"index"`                                        // 收藏ID,用于标识具体的收藏对象
	UpdateTime   int64  `gorm:"column:updated_at;type:bigint;not null;index"` // 更新时间,Unix时间戳
	CreateTime   int64  `gorm:"column:created_at;type:bigint"`                // 创建时间,Unix时间戳
	Deleted      bool   `gorm:"column:deleted;default:false"`                 // 删除标志,表示该记录是否被删除
}

UserCollection 用户收藏

type UserLike

type UserLike struct {
	ID         int64  `gorm:"primaryKey;autoIncrement"`                     // 点赞记录ID,主键,自增
	Uid        int64  `gorm:"index"`                                        // 用户ID,用于标识哪个用户点赞
	BizID      int64  `gorm:"index"`                                        // 业务ID,用于标识点赞的业务对象
	BizName    string `gorm:"type:varchar(255)"`                            // 业务名称
	Status     int    `gorm:"type:int"`                                     // 状态,用于表示点赞的状态(如有效、无效等)
	UpdateTime int64  `gorm:"column:updated_at;type:bigint;not null;index"` // 更新时间,Unix时间戳
	CreateTime int64  `gorm:"column:created_at;type:bigint"`                // 创建时间,Unix时间戳
	Deleted    bool   `gorm:"column:deleted;default:false"`                 // 删除标志,表示该记录是否被删除
}

UserLike 用户点赞

Jump to

Keyboard shortcuts

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