Documentation
¶
Index ¶
- Constants
- type IMongoMapper
- type Like
- type MongoMapper
- func (m *MongoMapper) CountUserLikes(ctx context.Context, userId string, targetType int64) (int64, error)
- func (m *MongoMapper) Delete(ctx context.Context, id string) error
- func (m *MongoMapper) FindOne(ctx context.Context, id string) (*Like, error)
- func (m *MongoMapper) FindUserLikes(ctx context.Context, userId string, targetType int64, ...) ([]*Like, error)
- func (m *MongoMapper) GetId(ctx context.Context, userId string, targetId string, targetType int64) (id string, err error)
- func (m *MongoMapper) GetTargetLikes(ctx context.Context, targetId string, targetType int64) ([]*Like, error)
- func (m *MongoMapper) GetUserLike(ctx context.Context, userId string, targetId string, targetType int64) (err error)
- func (m *MongoMapper) GetUserLikes(ctx context.Context, userId string, targetType int64, ...) ([]*Like, int64, error)
- func (m *MongoMapper) Insert(ctx context.Context, data *Like) error
- func (m *MongoMapper) Update(ctx context.Context, data *Like) error
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 (*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) GetTargetLikes ¶
func (*MongoMapper) GetUserLike ¶
func (*MongoMapper) GetUserLikes ¶
func (m *MongoMapper) GetUserLikes(ctx context.Context, userId string, targetType int64, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Like, int64, error)
Click to show internal directories.
Click to hide internal directories.