user

package
v1.0.53 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const CollectionName = "user"

Variables

View Source
var PrefixUserCacheKey = "cache:userinfo:"

Functions

func MakeBsonFilter

func MakeBsonFilter(options *FilterOptions) bson.M

Types

type EsMapper

type EsMapper struct {
	// contains filtered or unexported fields
}

func (*EsMapper) Search

func (m *EsMapper) Search(ctx context.Context, query []types.Query, popts *pagination.PaginationOptions, sorter esp.EsCursor) ([]*User, int64, error)

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

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

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 (m *MongoMapper) FindManyByIds(ctx context.Context, ids []string) ([]*User, error)

func (*MongoMapper) FindOne

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

func (*MongoMapper) Insert

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

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

Jump to

Keyboard shortcuts

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