Documentation ¶
Index ¶
- Constants
- func MakeBsonFilter(options *FilterOptions) bson.M
- type EsMapper
- type FilterOptions
- type IEsMapper
- type IPostMongoMapper
- 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, ...) ([]*Post, error)
- func (m *MongoMapper) FindManyAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, ...) ([]*Post, int64, error)
- func (m *MongoMapper) FindManyByIds(ctx context.Context, ids []string) ([]*Post, error)
- func (m *MongoMapper) FindOne(ctx context.Context, id string) (*Post, error)
- func (m *MongoMapper) Insert(ctx context.Context, data *Post) (string, error)
- func (m *MongoMapper) Update(ctx context.Context, data *Post) error
- type Post
Constants ¶
View Source
const CollectionName = "post"
Variables ¶
This section is empty.
Functions ¶
func MakeBsonFilter ¶
func MakeBsonFilter(options *FilterOptions) bson.M
Types ¶
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) ([]*Post, int64, error)
type FilterOptions ¶
type IEsMapper ¶
type IEsMapper interface { Search(ctx context.Context, query []types.Query, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter esp.EsCursor) ([]*Post, int64, error) CountWithQuery(ctx context.Context, query []types.Query, fopts *FilterOptions) (int64, error) }
func NewEsMapper ¶
type IPostMongoMapper ¶
type IPostMongoMapper interface { Insert(ctx context.Context, data *Post) (string, error) FindOne(ctx context.Context, id string) (*Post, error) Update(ctx context.Context, data *Post) error Delete(ctx context.Context, id string) error FindMany(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Post, error) Count(ctx context.Context, fopts *FilterOptions) (int64, error) FindManyAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Post, int64, error) FindManyByIds(ctx context.Context, ids []string) ([]*Post, error) }
func NewMongoMapper ¶
func NewMongoMapper(config *config.Config) IPostMongoMapper
type MongoFilter ¶
type MongoFilter struct { *FilterOptions // contains filtered or unexported fields }
func (*MongoFilter) CheckOnlyPostId ¶
func (f *MongoFilter) CheckOnlyPostId()
func (*MongoFilter) CheckOnlyPostIds ¶
func (f *MongoFilter) CheckOnlyPostIds()
func (*MongoFilter) CheckOnlyStatus ¶
func (f *MongoFilter) CheckOnlyStatus()
func (*MongoFilter) CheckOnlyTags ¶
func (f *MongoFilter) CheckOnlyTags()
func (*MongoFilter) CheckOnlyText ¶
func (f *MongoFilter) CheckOnlyText()
func (*MongoFilter) CheckOnlyTitle ¶
func (f *MongoFilter) CheckOnlyTitle()
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) ([]*Post, error)
func (*MongoMapper) FindManyAndCount ¶
func (m *MongoMapper) FindManyAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Post, int64, error)
func (*MongoMapper) FindManyByIds ¶ added in v1.0.53
type Post ¶
type Post struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"` Title string `bson:"title,omitempty" ` Text string `bson:"text,omitempty"` Url string `bson:"url,omitempty"` Tags []string `bson:"tags,omitempty"` UserId string `bson:"userId,omitempty"` UpdateAt time.Time `bson:"updateAt,omitempty"` CreateAt time.Time `bson:"createAt,omitempty"` Status int64 `bson:"status,omitempty"` // 仅ES查询时使用 Score_ float64 `bson:"_score,omitempty" json:"_score,omitempty"` }
Click to show internal directories.
Click to hide internal directories.