user

package
v0.0.0-...-f45b2b9 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const CollectionName = "User"

Variables

This section is empty.

Functions

This section is empty.

Types

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

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

func (*MongoMapper) FindOneByEmail

func (m *MongoMapper) FindOneByEmail(ctx context.Context, email string) (*User, error)

func (*MongoMapper) GetConn

func (m *MongoMapper) GetConn() *monc.Model

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)

func (*MongoMapper) UpdateByEmail

func (m *MongoMapper) UpdateByEmail(ctx context.Context, data *User, Email string) (*mongo.UpdateResult, error)

type User

type User struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Name        string             `bson:"name,omitempty"`
	Email       string             `bson:"email,omitempty"`
	PassWord    string             `bson:"passWord,omitempty"`
	Sex         *int32             `bson:"sex,omitempty"`
	FullName    string             `bson:"fullName,omitempty"`
	IdCard      string             `bson:"idCard,omitempty"`
	Memory      *int64             `bson:"memory,omitempty"`
	Flow        *int64             `bson:"flow,omitempty"`
	Money       *int64             `bson:"money,omitempty"`
	Description string             `bson:"description,omitempty"`
	Url         string             `bson:"url,omitempty"`
	UpdateAt    time.Time          `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	CreateAt    time.Time          `bson:"createAt,omitempty" json:"createAt,omitempty"`
}

type UserMongoMapper

type UserMongoMapper 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)
	UpdateByEmail(ctx context.Context, data *User, Email string) (*mongo.UpdateResult, error)
	Delete(ctx context.Context, id string) (int64, error)
	FindOneByEmail(ctx context.Context, email string) (*User, error)
	GetConn() *monc.Model
}

func NewMongoModel

func NewMongoModel(config *config.Config) UserMongoMapper

Jump to

Keyboard shortcuts

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