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
- Variables
- type AggrScore
- type CatPop
- type CatPopularity
- type CatPopularityModel
- type CustomLikeModel
- func (m CustomLikeModel) Delete(ctx context.Context, id string) error
- func (m CustomLikeModel) FindOne(ctx context.Context, id string) (*Like, error)
- func (m *CustomLikeModel) GetId(ctx context.Context, userId string, targetId string, targetType int64) (id string, err error)
- func (m *CustomLikeModel) GetTargetLikes(ctx context.Context, targetId string, targetType int64) ([]*Like, error)
- func (m *CustomLikeModel) GetUserLike(ctx context.Context, userId string, targetId string, targetType int64) (err error)
- func (m *CustomLikeModel) GetUserLikes(ctx context.Context, userId string, targetType int64) ([]*Like, error)
- func (m CustomLikeModel) Insert(ctx context.Context, data *Like) error
- func (m CustomLikeModel) Update(ctx context.Context, data *Like) error
- type Like
- type LikeModel
- type Score
- type ScoreModel
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 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) GetTargetLikes ¶
func (*CustomLikeModel) GetUserLike ¶
func (*CustomLikeModel) GetUserLikes ¶ added in v1.1.5
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.
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.
Click to show internal directories.
Click to hide internal directories.