user

package
v0.0.0-...-5305c49 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count(filter bson.M) int

func ParsePhoneNumber

func ParsePhoneNumber(phone string, region string) (string, error)

Types

type User

type User struct {
	ID        primitive.ObjectID `bson:"_id" json:"id"`
	Name      string             `bson:"name" json:"name"`
	Phone     string             `bson:"phone" json:"phone"`
	Password  string             `bson:"password" json:"-"`
	SuperUser bool               `bson:"super_user" json:"super_user"`
	CreatedAt time.Time          `bson:"created_at" json:"created_at"`
}

func Auth

func Auth(phone, password string) (*User, error)

func Find

func Find(filter bson.M, page, limit int, sorts ...bson.E) ([]User, error)

func FindOne

func FindOne(filter bson.M) (*User, error)

func LoadByRequest

func LoadByRequest(secretKey []byte, r *http.Request) (*User, error)

func (*User) Delete

func (u *User) Delete() error

func (*User) Insert

func (u *User) Insert() error

func (*User) Save

func (u *User) Save() error

func (*User) Update

func (u *User) Update() error

Jump to

Keyboard shortcuts

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