Documentation
¶
Index ¶
- Constants
- Variables
- func MakeBsonFilter(options *FilterOptions) bson.M
- type EsMapper
- type FilterOptions
- type IUserEsMapper
- type IUserMongoMapper
- type MongoFilter
- type MongoMapper
- func (m *MongoMapper) Delete(ctx context.Context, id string) (int64, error)
- func (m *MongoMapper) FindMany(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, ...) ([]*User, error)
- func (m *MongoMapper) FindManyByIds(ctx context.Context, ids []string) ([]*User, error)
- func (m *MongoMapper) FindOne(ctx context.Context, id string) (*User, error)
- func (m *MongoMapper) Insert(ctx context.Context, data *User) (string, error)
- func (m *MongoMapper) Update(ctx context.Context, data *User) (*mongo.UpdateResult, error)
- type User
Constants ¶
View Source
const CollectionName = "user"
Variables ¶
View Source
var PrefixUserCacheKey = "cache:userinfo:"
Functions ¶
func MakeBsonFilter ¶
func MakeBsonFilter(options *FilterOptions) bson.M
Types ¶
type FilterOptions ¶
type FilterOptions struct {
OnlyUserIds []string
}
type IUserEsMapper ¶
type IUserEsMapper interface {
Search(ctx context.Context, query []types.Query, popts *pagination.PaginationOptions, sorter esp.EsCursor) ([]*User, int64, error)
}
func NewEsMapper ¶
func NewEsMapper(config *config.Config) IUserEsMapper
type IUserMongoMapper ¶
type IUserMongoMapper interface {
Insert(ctx context.Context, data *User) (string, error)
FindOne(ctx context.Context, id string) (*User, error)
Update(ctx context.Context, data *User) (*mongo.UpdateResult, error)
Delete(ctx context.Context, id string) (int64, error)
FindMany(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*User, error)
FindManyByIds(ctx context.Context, ids []string) ([]*User, error)
}
func NewMongoMapper ¶
func NewMongoMapper(config *config.Config) IUserMongoMapper
type MongoFilter ¶
type MongoFilter struct {
*FilterOptions
// contains filtered or unexported fields
}
func (*MongoFilter) CheckOnlyUserIds ¶
func (f *MongoFilter) CheckOnlyUserIds()
type MongoMapper ¶
type MongoMapper struct {
// contains filtered or unexported fields
}
func (*MongoMapper) FindMany ¶
func (m *MongoMapper) FindMany(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*User, error)
func (*MongoMapper) FindManyByIds ¶ added in v1.0.53
func (*MongoMapper) Update ¶
func (m *MongoMapper) Update(ctx context.Context, data *User) (*mongo.UpdateResult, error)
type User ¶
type User struct {
ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
Name string `bson:"name,omitempty" json:"name,omitempty"`
Sex int64 `bson:"sex,omitempty" json:"sex,omitempty"`
FullName string `bson:"fullName,omitempty" json:"fullName,omitempty"`
IdCard string `bson:"idCard,omitempty" json:"idCard,omitempty"`
Description string `bson:"description,omitempty" json:"description,omitempty"`
Url string `bson:"url,omitempty" json:"url,omitempty"`
UpdateAt time.Time `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
CreateAt time.Time `bson:"createAt,omitempty" json:"createAt,omitempty"`
Labels []string `bson:"labels,omitempty" json:"labels,omitempty"`
Score_ float64 `bson:"_score,omitempty" json:"_score,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.