Documentation ¶
Index ¶
- Constants
- type EsMapper
- type IEsMapper
- type IMongoMapper
- type MongoMapper
- func (m *MongoMapper) Delete(ctx context.Context, id string) error
- func (m *MongoMapper) FindOne(ctx context.Context, id string) (*User, error)
- func (m *MongoMapper) FindOneNoCache(ctx context.Context, id string) (*User, error)
- func (m *MongoMapper) Insert(ctx context.Context, data *User) error
- func (m *MongoMapper) Update(ctx context.Context, data *User) error
- func (m *MongoMapper) UpsertUser(ctx context.Context, data *User) error
- type User
Constants ¶
View Source
const (
CollectionName = "user"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EsMapper ¶
type EsMapper struct {
// contains filtered or unexported fields
}
func (*EsMapper) SearchUser ¶
type IEsMapper ¶
type IEsMapper interface {
SearchUser(ctx context.Context, name string, popts *pagination.PaginationOptions, sorter esp.EsCursor) ([]*User, int64, error)
}
func NewEsMapper ¶
type IMongoMapper ¶
type IMongoMapper interface { Insert(ctx context.Context, data *User) error FindOne(ctx context.Context, id string) (*User, error) Update(ctx context.Context, data *User) error Delete(ctx context.Context, id string) error UpsertUser(ctx context.Context, data *User) error FindOneNoCache(ctx context.Context, id string) (*User, error) }
IMongoMapper is an interface to be customized, add more methods here, and implement the added methods in MongoMapper.
func NewMongoMapper ¶
func NewMongoMapper(config *config.Config) IMongoMapper
type MongoMapper ¶
type MongoMapper struct {
// contains filtered or unexported fields
}
func (*MongoMapper) FindOneNoCache ¶ added in v1.0.17
func (*MongoMapper) UpsertUser ¶
func (m *MongoMapper) UpsertUser(ctx context.Context, data *User) error
type User ¶
type User struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` AvatarUrl string `bson:"avatarUrl,omitempty" json:"avatar_url,omitempty"` Nickname string `bson:"nickname,omitempty" json:"nickname,omitempty"` Motto string `bson:"motto,omitempty" json:"motto,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"` }
Click to show internal directories.
Click to hide internal directories.