user

package
v1.0.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2023 License: GPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

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

func (m *EsMapper) SearchUser(ctx context.Context, name string, popts *pagination.PaginationOptions, sorter esp.EsCursor) ([]*User, int64, error)

type IEsMapper

type IEsMapper interface {
	SearchUser(ctx context.Context, name string, popts *pagination.PaginationOptions, sorter esp.EsCursor) ([]*User, int64, error)
}

func NewEsMapper

func NewEsMapper(config *config.Config) IEsMapper

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) Delete

func (m *MongoMapper) Delete(ctx context.Context, id string) error

func (*MongoMapper) FindOne

func (m *MongoMapper) FindOne(ctx context.Context, id string) (*User, error)

func (*MongoMapper) FindOneNoCache added in v1.0.17

func (m *MongoMapper) FindOneNoCache(ctx context.Context, id string) (*User, error)

func (*MongoMapper) Insert

func (m *MongoMapper) Insert(ctx context.Context, data *User) error

func (*MongoMapper) Update

func (m *MongoMapper) Update(ctx context.Context, data *User) error

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"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL