model

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Code generated by goctl. DO NOT EDIT.

Code generated by goctl. DO NOT EDIT.

Code generated by goctl. DO NOT EDIT.

Index

Constants

View Source
const LikeCollectionName = "like"
View Source
const PopularityCollectionName = "cat_pop"
View Source
const ScoreCollectionName = "score"

Variables

View Source
var (
	ErrNotFound        = mon.ErrNotFound
	ErrInvalidObjectId = errors.New("invalid objectId")
)

Functions

This section is empty.

Types

type AggrScore added in v1.1.3

type AggrScore struct {
	Sid   string `bson:"_id,omitempty" `
	Score int64  `bson:"total_score"`
}

type CatPop added in v1.1.3

type CatPop struct {
	CatId      string `bson:"catId,omitempty" json:"catId,omitempty"`
	Popularity int64  `bson:"popularity,omitempty" json:"popularity,omitempty"`
}

type CatPopularity added in v1.1.3

type CatPopularity struct {
	ID         primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	CatId      string             `bson:"catId,omitempty" json:"catId,omitempty"`
	Popularity int64              `bson:"popularity,omitempty" json:"popularity,omitempty"`
	// TODO: Fill your own fields
	UpdateAt time.Time `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	CreateAt time.Time `bson:"createAt,omitempty" json:"createAt,omitempty"`
}

type CatPopularityModel added in v1.1.3

type CatPopularityModel interface {
	AddPopularity(ctx context.Context, catId string, val int64) error
	ListPopularity(ctx context.Context, catId []string) ([]CatPop, error)
	ListTopK(ctx context.Context, k int64) ([]CatPop, error)
	// contains filtered or unexported methods
}

CatPopularityModel is an interface to be customized, add more methods here, and implement the added methods in customCatPopularityModel.

func NewCatPopularityModel added in v1.1.3

func NewCatPopularityModel(url, db, collection string) CatPopularityModel

NewCatPopularityModel returns a model for the mongo.

type CustomLikeModel

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

func (CustomLikeModel) Delete

func (m CustomLikeModel) Delete(ctx context.Context, id string) error

func (CustomLikeModel) FindOne

func (m CustomLikeModel) FindOne(ctx context.Context, id string) (*Like, error)

func (*CustomLikeModel) GetId

func (m *CustomLikeModel) GetId(ctx context.Context, userId string, targetId string, targetType int64) (id string, err error)

func (*CustomLikeModel) GetTargetLikes

func (m *CustomLikeModel) GetTargetLikes(ctx context.Context, targetId string, targetType int64) ([]*Like, error)

func (*CustomLikeModel) GetUserLike

func (m *CustomLikeModel) GetUserLike(ctx context.Context, userId string, targetId string, targetType int64) (err error)

func (*CustomLikeModel) GetUserLikes added in v1.1.5

func (m *CustomLikeModel) GetUserLikes(ctx context.Context, userId string, targetType int64) ([]*Like, error)

func (CustomLikeModel) Insert

func (m CustomLikeModel) Insert(ctx context.Context, data *Like) error

func (CustomLikeModel) Update

func (m CustomLikeModel) Update(ctx context.Context, data *Like) error

type Like

type Like struct {
	ID           primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	UserId       string             `bson:"userId,omitempty" json:"userId,omitempty"`
	TargetId     string             `bson:"targetId,omitempty" json:"targetId,omitempty"`
	TargetType   int64              `bson:"targetType,omitempty" json:"targetType,omitempty"`
	AssociatedId string             `bson:"associatedId,omitempty" json:"associatedId,omitempty"`
	UpdateAt     time.Time          `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	CreateAt     time.Time          `bson:"createAt,omitempty" json:"createAt,omitempty"`
}

type LikeModel

type LikeModel interface {
	GetUserLike(ctx context.Context, userId string, targetId string, targetType int64) error
	GetUserLikes(ctx context.Context, userId string, targetType int64) ([]*Like, error)
	GetTargetLikes(ctx context.Context, targetId string, targetType int64) ([]*Like, error)
	GetId(ctx context.Context, userId string, targetId string, targetType int64) (string, error)
	// contains filtered or unexported methods
}

LikeModel is an interface to be customized, add more methods here, and implement the added methods in CustomLikeModel.

func NewLikeModel

func NewLikeModel(url, db, collection string, c cache.CacheConf) LikeModel

NewLikeModel returns a model for the mongo.

type Score added in v1.1.3

type Score struct {
	ID    primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Type  string             `bson:"type,omitempty" json:"type,omitempty"`
	Sid   string             `bson:"sid,omitempty" json:"sid,omitempty"`
	Score int64              `bson:"score,omitempty" json:"score,omitempty"`
	// TODO: Fill your own fields
	UpdateAt time.Time `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	CreateAt time.Time `bson:"createAt,omitempty" json:"createAt,omitempty"`
}

type ScoreModel added in v1.1.3

type ScoreModel interface {
	ListTopK(ctx context.Context, k int64, last int, t string) ([]*AggrScore, error)
	InsertMany(ctx context.Context, scores []Score) error
	// contains filtered or unexported methods
}

ScoreModel is an interface to be customized, add more methods here, and implement the added methods in customScoreModel.

func NewScoreModel added in v1.1.3

func NewScoreModel(url, db, collection string) ScoreModel

NewScoreModel returns a model for the mongo.

Jump to

Keyboard shortcuts

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