model

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicInit

func BasicInit() error

func GetUserID

func GetUserID(username string) string

func GetUserIDByName

func GetUserIDByName(userName string) (userID string)

Types

type Claims

type Claims struct {
	ID     int    `json:"claim_id"`
	AuthID int    `json:"auth_id"`
	Type   string `json:"type"`
	Value  string `json:"value"`
}

func GetUserClaims

func GetUserClaims(userName string) (claims []Claims)

type TAuth

type TAuth struct {
	ID       bson.ObjectId `json:"id" bson:"_id"`
	Role     string        `json:"role" bson:"role"`
	Username string        `json:"username" bson:"name"`
	Password string        `json:"password" bson:"password"`
}

func (*TAuth) AddAuth

func (t *TAuth) AddAuth() error

func (*TAuth) CheckAuth

func (t *TAuth) CheckAuth() bool

func (*TAuth) DeleteAuthByName

func (t *TAuth) DeleteAuthByName() error

func (*TAuth) GetAuth

func (t *TAuth) GetAuth() string

func (*TAuth) GetRoles

func (t *TAuth) GetRoles() string

type TBasic

type TBasic struct {
	ID        bson.ObjectId `json:"id" bson:"_id"`
	UserNum   int           `json:"user_num" bson:"user_num"`
	ShopNum   int           `json:"shop_num" bson:"shop_num"`
	ItemNum   int           `json:"item_num" bson:"item_num"`
	RecordNum int           `json:"record_num" bson:"record_num"`
}
var Basic TBasic

func (*TBasic) AddItem

func (t *TBasic) AddItem() error

func (*TBasic) AddShop

func (t *TBasic) AddShop() error

func (*TBasic) AddUser

func (t *TBasic) AddUser() error

func (*TBasic) DeleteItem

func (t *TBasic) DeleteItem() error

func (*TBasic) DeleteShop

func (t *TBasic) DeleteShop() error

func (*TBasic) DeleteUser

func (t *TBasic) DeleteUser() error

type TProduct

type TProduct struct {
	ID        bson.ObjectId `json:"item_id" bson:"_id"`
	StoreID   bson.ObjectId `json:"store_id" bson:"store_id"`
	Name      string        `json:"item_name" bson:"item_name"`
	Price     float64       `json:"item_price" bson:"item_price"`
	Score     float64       `json:"item_score" bson:"item_score"`
	SaleCount int           `json:"item_salecount" bson:"item_salecount"`
	Brand     string        `json:"item_brand" bson:"item_brand"`
	Timestamp int64         `json:"item_timestamp" bson:"item_timestamp"`
}

func GetAllProducts

func GetAllProducts() (Products []TProduct, err error)

func GetAllProductsByPage

func GetAllProductsByPage(pageNum int, pageSize int) (stores []TProduct, err error)

func GetProductsByPage

func GetProductsByPage(pageNum int, pageSize int, StoreID bson.ObjectId) (stores []TProduct, err error)

func (*TProduct) AddProduct

func (t *TProduct) AddProduct() error

func (*TProduct) DeleteProduct

func (t *TProduct) DeleteProduct() error

func (*TProduct) GetProductByID

func (t *TProduct) GetProductByID() (Product TProduct, err error)

func (*TProduct) GetProductsByStoreID

func (t *TProduct) GetProductsByStoreID() (Products []TProduct, err error)

func (*TProduct) UpdateProduct

func (t *TProduct) UpdateProduct() error

type TRecommend

type TRecommend struct {
	UserID   string `json:"user_id"`
	Query    string `json:"query"`
	PageSize int    `json:"page_size"`
	PageNum  int    `json:"page_num"`
}

func (*TRecommend) AddRecommend

func (t *TRecommend) AddRecommend() error

func (*TRecommend) AddRecommendByOrder

func (t *TRecommend) AddRecommendByOrder() error

func (*TRecommend) GetRecommend

func (t *TRecommend) GetRecommend() ([]TProduct, error)

type TRecord

type TRecord struct {
	RecordID  bson.ObjectId `json:"record_id" bson:"_id"`
	UserID    bson.ObjectId `json:"user_id" bson:"user_id"`
	ItemID    bson.ObjectId `json:"item_id" bson:"item_id"`
	Status    int           `json:"is_trade" bson:"is_trade"`
	Query     string        `json:"query" bson:"query"`
	Timestamp int64         `json:"timestamp" bson:"timestamp"`
}

func GetAllRecords

func GetAllRecords() ([]TRecord, error)

func (*TRecord) AddRecord

func (t *TRecord) AddRecord() error

func (*TRecord) GetRecordsByItemID

func (t *TRecord) GetRecordsByItemID() ([]TRecord, error)

func (*TRecord) GetRecordsByUserID

func (t *TRecord) GetRecordsByUserID() ([]TRecord, error)

type TStores

type TStores struct {
	ID        bson.ObjectId `json:"store_id" bson:"_id"`
	Name      string        `json:"name" bson:"name"`
	NickName  string        `json:"store_name" bson:"store_name"`
	Level     float64       `json:"store_level" bson:"store_level"`
	City      string        `json:"store_city" bson:"store_city"`
	Timestamp int64         `json:"timestamp" bson:"timestamp"`
}

func GetAllStores

func GetAllStores() (stores []TStores, err error)

func GetStoresByPage

func GetStoresByPage(pageNum int, pageSize int) (stores []TStores, err error)

func (*TStores) AddStore

func (t *TStores) AddStore() error

func (*TStores) DeleteStore

func (t *TStores) DeleteStore() error

func (*TStores) GetStoreByStoreID

func (t *TStores) GetStoreByStoreID() error

func (*TStores) UpdateStore

func (t *TStores) UpdateStore() error

type TUser

type TUser struct {
	ID         bson.ObjectId `json:"user_id" bson:"_id"`
	Name       string        `json:"name" bson:"name"`
	NickName   string        `json:"user_name" bson:"user_name"`
	Age        int           `json:"user_age" bson:"user_age"`
	Gender     int           `json:"user_gender" bson:"user_gender"`
	City       string        `json:"user_city" bson:"user_city"`
	Timestamp  int64         `json:"user_timestamp" bson:"user_timestamp"`
	Historysum float64       `json:"user_historysum" bson:"user_historysum"`
}

func GetAllUsers

func GetAllUsers() (users []TUser, err error)

func GetUsersByPage

func GetUsersByPage(pageNum int, pageSize int) (users []TUser, err error)

func (*TUser) AddUser

func (t *TUser) AddUser() error

func (*TUser) DeleteUser

func (t *TUser) DeleteUser() error

func (*TUser) UpdateUser

func (t *TUser) UpdateUser() error

type User

type User struct {
	UserName   string
	UserClaims []Claims
}

type UserMsg

type UserMsg struct {
	Roles        []string
	Introduction string
	Avatar       string
	Name         string
	ID           string
}

Jump to

Keyboard shortcuts

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