model

package
v0.0.0-...-93a91a8 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGoods

func AddGoods(userId, price int, keyword, content, location, address string) error

func AddUser

func AddUser(phone, password, nikeName string, age int) error

func Close

func Close()

func EditUser

func EditUser(id int, phone, password, nikeName string, age, status int) error

func HasGoodsByID

func HasGoodsByID(id int) (bool, error)

func HasUserByID

func HasUserByID(id int) (bool, error)

func HasUserByPhone

func HasUserByPhone(phone string) (bool, error)

func Setup

func Setup()

Types

type Goods

type Goods struct {
	Model
	FkUserGoods int    `json:"fk_user_goods"`
	Price       int    `json:"price"`
	Keyword     string `json:"keyword"`
	Content     string `json:"content"`
	Image       string `json:"image"`
	Location    string `json:"location"`
	Address     string `json:"address"`
	Status      int    `json:"status"`
}

func GetGoods

func GetGoods(id int) (*Goods, error)

type GoodsTo

type GoodsTo struct {
	Goods
	NikeName string `json:"nike_name"`
}

func GetAllGoods

func GetAllGoods(offset, limit int) ([]GoodsTo, error)

type Model

type Model struct {
	ID         int64 `gorm:"primary_key" json:"id"`
	CreatedOn  int   `json:"created_on"`
	ModifiedOn int   `json:"modified_on"`
}

type User

type User struct {
	Model
	Phone    string `json:"phone"`
	Password string `json:"password"`
	NikeName string `json:"nike_name"`
	Age      int    `json:"age"`
	Status   int    `json:"status"`
}

type UserTo

type UserTo struct {
	User
	Password bool `json:"password,omitempty"`
}

func GetUser

func GetUser(id int) (*UserTo, error)

func GetUserByPhoneAndPassword

func GetUserByPhoneAndPassword(phone, password string) (*UserTo, error)

Jump to

Keyboard shortcuts

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