user

package
v0.0.0-...-23bce59 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUser

func CreateUser(c *gin.Context)

CreateUser

func DeleteUser

func DeleteUser(c *gin.Context)

DeleteUser

func GetUserInfo

func GetUserInfo(c *gin.Context)

GetUserInfo 根据用户名获取用户信息

func GetUserList

func GetUserList(c *gin.Context)

GetUserList 获取用户列表

func UpdateUser

func UpdateUser(c *gin.Context)

UpdateUser post json

Types

type User

type User struct {
	ID          primitive.ObjectID `json:"_id" bson:"_id,omitempty"` //bson是用来创建后返回,omitempty是创建时自动创建
	Mobile      string             `json:"mobile" bson:"mobile,omitempty"`
	Username    string             `json:"username" bson:"username,omitempty"`
	Password    string             `json:"password" bson:"password,omitempty"`
	Gender      string             `json:"gender" bson:"gender,omitempty"`
	Avatar      string             `json:"avatar" bson:"avatar,omitempty"`
	Addr        string             `json:"addr" bson:"addr,omitempty"`
	Email       string             `json:"email" bson:"email,omitempty"`
	Description string             `json:"description" bson:"description,omitempty"`
	Status      int                `json:"status" bson:"status,omitempty"`
	CreatedAt   time.Time          `json:"created_at" bson:"created_at,omitempty"`
	UpdatedAt   time.Time          `json:"updated_at" bson:"updated_at,omitempty"`
}

type UserService

type UserService interface {
	GetUserInfoByName(username string) (user User, err error)
	GetUserList(offset, limit int64, search User) (user []User, count int64, err error)
	CreateUser(user *User) (err error)
	UpdateUser(user *User) (err error)
	DeleteUser(userID int) (err error)
}

func NewService

func NewService(mongo *mongo.Database) UserService

Jump to

Keyboard shortcuts

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