models

package
v0.0.0-...-f2d197a Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2015 License: MIT Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailSponsor

type EmailSponsor struct {
	gorm.Model
	SponsorId uint   `schema:"-" gorm:"primary_key" sql:"type:integer REFERENCES sponsors(id)"`
	Email     string `sql:"type:varchar(100);unique_index"` // Set field's sql type, tag `unique_index` will create unique index
}

type EmailSupplier

type EmailSupplier struct {
	gorm.Model
	SupplierID uint   `schema:"-" gorm:"primary_key" sql:"type:integer REFERENCES Suppliers(id)"`
	Email      string `sql:"type:varchar(100);unique_index"` // Set field's sql type, tag `unique_index` will create unique index
}

type Order

type Order struct {
	gorm.Model
	Supplier    Supplier    `schema:"-"`
	SupplierId  uint        `schema:"-" sql:"type:integer REFERENCES Suppliers(id)"`
	SponsorId   uint        `schema:"-" sql:"type:integer REFERENCES Sponsors(id)"`
	Sponsor     Sponsor     `schema:"-"`
	Value       float32     `schema:"value" sql:"type:numeric(7,2);not null"`
	DueDateBase time.Time   `schema: "duedatebase" sql:"not null;DEFAULT:current_timestamp"`
	OrderItems  []OrderItem `schema:"-"`
}

type OrderItem

type OrderItem struct {
	OrderId    uint    `schema:"-" gorm:"primary_key" sql:"type:integer REFERENCES orders(id)"`
	ProductId  uint    `schema:"-" gorm:"primary_key" sql:"type:integer REFERENCES products(id)"`
	Qty        float32 `schema:"qty" sql:"type:numeric(7,3)"`
	TotalPrice float32 `schema:"totalprice" sql:"type:numeric(7,2)"`
}

type Product

type Product struct {
	gorm.Model
	Name       string   `schema:"name" sql:"type:varchar(100);not null"`
	Supplier   Supplier `schema:"-"`
	SupplierId uint     `sql:"type:integer REFERENCES Suppliers(id)"`
	Price      float32  `schema:"price" sql:"type:numeric(7,2);not null"`
	Unit       string   `schema:"unit" sql:size:3`
}
type Sponsor struct {
	gorm.Model
	Name     string         `schema:"name" sql:"type:varchar(100);not null"`
	PhoneExt uint           `schema:"phonext" sql:not null"` // Phone Extension
	Note     string         `schema:"note" sql:"type:varchar(250);DEFAULT:'Caution'"`
	Emails   []EmailSponsor `schema:"-"`
}

type Supplier

type Supplier struct {
	gorm.Model
	Name        string          `schema:"name" sql:"type:varchar(100);not null"`
	PhoneNumber string          `schema:"-"`
	Note        string          `schema:"note" sql:"type:varchar(250);"`
	Emails      []EmailSupplier `schema:"-"`
}

Jump to

Keyboard shortcuts

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