like

package
v1.0.18 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const CollectionName = "like"

Variables

This section is empty.

Functions

This section is empty.

Types

type IMongoMapper

type IMongoMapper interface {
	Insert(ctx context.Context, data *Like) error
	FindOne(ctx context.Context, id string) (*Like, error)
	Update(ctx context.Context, data *Like) error
	Delete(ctx context.Context, id string) error
	GetUserLike(ctx context.Context, userId string, targetId string, targetType int64) error
	GetUserLikes(ctx context.Context, userId string, targetType int64, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Like, int64, error)
	FindUserLikes(ctx context.Context, userId string, targetType int64, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Like, error)
	CountUserLikes(ctx context.Context, userId string, targetType int64) (int64, error)
	GetTargetLikes(ctx context.Context, targetId string, targetType int64) ([]*Like, error)
	GetId(ctx context.Context, userId string, targetId string, targetType int64) (string, error)
}

func NewMongoModel

func NewMongoModel(config *config.Config) IMongoMapper

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 MongoMapper

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

func (*MongoMapper) CountUserLikes added in v1.0.12

func (m *MongoMapper) CountUserLikes(ctx context.Context, userId string, targetType int64) (int64, error)

func (*MongoMapper) Delete

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

func (*MongoMapper) FindOne

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

func (*MongoMapper) FindUserLikes added in v1.0.12

func (m *MongoMapper) FindUserLikes(ctx context.Context, userId string, targetType int64, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Like, error)

func (*MongoMapper) GetId

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

func (*MongoMapper) GetTargetLikes

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

func (*MongoMapper) GetUserLike

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

func (*MongoMapper) GetUserLikes

func (m *MongoMapper) GetUserLikes(ctx context.Context, userId string, targetType int64, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Like, int64, error)

func (*MongoMapper) Insert

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

func (*MongoMapper) Update

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

Jump to

Keyboard shortcuts

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