Documentation ¶
Index ¶
- Constants
- type EsFilter
- type EsMapper
- type FilterOptions
- type IEsMapper
- type IMongoMapper
- type Moment
- type MongoFilter
- type MongoMapper
- func (m *MongoMapper) Count(ctx context.Context, filter *FilterOptions) (int64, error)
- func (m *MongoMapper) Delete(ctx context.Context, id string) error
- func (m *MongoMapper) FindMany(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, ...) ([]*Moment, error)
- func (m *MongoMapper) FindManyAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, ...) ([]*Moment, int64, error)
- func (m *MongoMapper) FindOne(ctx context.Context, id string) (*Moment, error)
- func (m *MongoMapper) Insert(ctx context.Context, data *Moment) error
- func (m *MongoMapper) Update(ctx context.Context, data *Moment) error
Constants ¶
View Source
const CollectionName = "moment"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EsFilter ¶
type EsFilter struct { *FilterOptions // contains filtered or unexported fields }
type EsMapper ¶
type EsMapper struct {
// contains filtered or unexported fields
}
func (*EsMapper) CountWithQuery ¶
func (*EsMapper) Search ¶
func (m *EsMapper) Search(ctx context.Context, query []types.Query, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter esp.EsCursor) ([]*Moment, int64, error)
type FilterOptions ¶
type IEsMapper ¶
type IEsMapper interface { Search(ctx context.Context, query []types.Query, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter esp.EsCursor) ([]*Moment, int64, error) CountWithQuery(ctx context.Context, query []types.Query, fopts *FilterOptions) (int64, error) }
func NewEsMapper ¶
type IMongoMapper ¶
type IMongoMapper interface { Insert(ctx context.Context, data *Moment) error FindOne(ctx context.Context, id string) (*Moment, error) Update(ctx context.Context, data *Moment) error Delete(ctx context.Context, id string) error FindMany(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Moment, error) Count(ctx context.Context, filter *FilterOptions) (int64, error) FindManyAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Moment, int64, error) }
func NewMongoMapper ¶
func NewMongoMapper(config *config.Config) IMongoMapper
type Moment ¶
type Moment struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"` CatId string `bson:"catId,omitempty"` CommunityId string `bson:"communityId,omitempty"` Photos []string `bson:"photos,omitempty"` Title string `bson:"title,omitempty"` Text string `bson:"text,omitempty"` UserId string `bson:"userId,omitempty"` UpdateAt time.Time `bson:"updateAt,omitempty" json:"updateAt,omitempty"` CreateAt time.Time `bson:"createAt,omitempty" json:"createAt,omitempty"` // 仅ES查询时使用 Score_ float64 `bson:"_score,omitempty" json:"_score,omitempty"` }
type MongoFilter ¶
type MongoFilter struct { *FilterOptions // contains filtered or unexported fields }
func (*MongoFilter) CheckOnlyCommunityId ¶
func (f *MongoFilter) CheckOnlyCommunityId()
func (*MongoFilter) CheckOnlyCommunityIds ¶
func (f *MongoFilter) CheckOnlyCommunityIds()
func (*MongoFilter) CheckOnlyUserId ¶
func (f *MongoFilter) CheckOnlyUserId()
type MongoMapper ¶
type MongoMapper struct {
// contains filtered or unexported fields
}
func (*MongoMapper) Count ¶
func (m *MongoMapper) Count(ctx context.Context, filter *FilterOptions) (int64, error)
func (*MongoMapper) FindMany ¶
func (m *MongoMapper) FindMany(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Moment, error)
func (*MongoMapper) FindManyAndCount ¶
func (m *MongoMapper) FindManyAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Moment, int64, error)
Click to show internal directories.
Click to hide internal directories.