model

package
v0.0.0-...-a8d68db Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: Apache-2.0 Imports: 9 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Engine *xorm.Engine
View Source
var SqlxDB *sqlx.DB

Functions

func AddProduct

func AddProduct(pro *Product) error

func AddProductType

func AddProductType(pro *Producttype) error

func GetUserCount

func GetUserCount() (int64, error)

Types

type Order

type Order struct {
	Id       int64        `json:"id"       xorm:"not null pk autoincr"`
	Orderno  string       `json:"orderno"  xorm:"not null unique"`
	Customno string       `json:"customno" xorm:"index default ''"`
	UserId   int          `json:"user_id"`
	UserName string       `json:"user_name"`
	Desc     string       `json:"desc"   xorm:"TEXT"`
	Totamt   float64      `json:"totamt"   xorm:"default 0.00 Float"`
	Trueamt  float64      `json:"trueamt"  xorm:"default 0.00 Float"`
	Payamt   float64      `json:"payamt"   xorm:"Float"`
	Retamt   float64      `json:"retamt"   xorm:"default 0.00 Float"`
	Cdate    Time         `json:"cdate"    xorm:"created"`
	Udate    Time         `json:"udate"    xorm:"updated index"`
	Items    []*OrderItem `json:"items"    xorm:"-"`
}

type OrderItem

type OrderItem struct {
	Id          int64   `json:"id"           xorm:"pk autoincr"`
	OrderId     int64   `json:"order_id"     xorm:"not null index"`
	ProductId   int64   `json:"product_id"`
	ProductNo   string  `json:"product_no"   xorm:"default '' VARCHAR(80) index"`
	ProductDesc string  `json:"product_desc" xorm:"default '' TEXT"`
	Saleprice   float64 `json:"saleprice"    xorm:" default 0 Float"`
	Trueprice   float64 `json:"trueprice"    xorm:"default 0 Float"`
	Qty         float64 `json:"qty"          xorm:"default 0"`
	Cdate       Time    `json:"cdate"        xorm:"created"`
	Udate       Time    `json:"udate"        xorm:"updated"`
}

type Product

type Product struct {
	Id              int64   `json:"id"         xorm:"not null pk autoincr"`
	No              string  `json:"no"         xorm:"not null VARCHAR(200) unique"`
	Desc            string  `json:"desc"     xorm:"not null  VARCHAR(200) index"`
	Picurl          string  `json:"picurl"     xorm:"TEXT"`
	Price           float64 `json:"price"      xorm:"default 0 Float"`
	Saleprice       float64 `json:"saleprice"  xorm:"default 0 Float"`
	ProducttypeId   int     `json:"producttype_id" `
	ProducttypeName string  `json:"producttype_name"`
	Qtycan          float64 `json:"qtycan"     xorm:"default 0"`
	Unit            string  `json:"unit"  xorm:"VARCHAR(20)"`
	Remark          string  `json:"remark"  xorm:"TEXT"`
	Cdate           Time    `json:"cdate"      xorm:"created"`
	Udate           Time    `json:"udate"      xorm:"updated"`
}

type Producttype

type Producttype struct {
	Id    int64  `json:"id"         xorm:"not null pk autoincr"`
	Name  string `json:"name"       xorm:"not null VARCHAR(500) unique"`
	Cdate Time   `json:"cdate"      xorm:"created"`
	Udate Time   `json:"udate"      xorm:"updated"`
}

type Time

type Time time.Time

func (*Time) GobDecode

func (t *Time) GobDecode(data []byte) error

func (Time) GobEncode

func (t Time) GobEncode() ([]byte, error)

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (*Time) ToDateString

func (t *Time) ToDateString() string

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) (err error)

type User

type User struct {
	Id       int64  `json:"id" 		xorm:"not null pk autoincr"`
	Name     string `json:"name" 	xorm:"not null VARCHAR(80) unique"`
	Nickname string `json:"nickname"`
	Pwd      string `json:"-" 		xorm:"not null VARCHAR(80)"`
	Rands    string `json:"rands" 	xorm:"VARCHAR(10)"`
	Salt     string `json:"salt" 	xorm:"VARCHAR(10)"`
	IsAdmin  bool   `json:"-"`
	Cdate    Time   `json:"cdate" 	xorm:"created"`
	Udate    Time   `json:"udate" 	xorm:"updated"`
}

func GetUserByNameWithPwd

func GetUserByNameWithPwd(name string, pwd string) *User

Jump to

Keyboard shortcuts

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