2018-12-16 16:27:33 +01:00
|
|
|
package model
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/jinzhu/gorm"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Product struct {
|
|
|
|
gorm.Model
|
|
|
|
Name string
|
2018-12-20 20:50:01 +01:00
|
|
|
Company Company `json:",omitempty"`
|
2018-12-16 16:27:33 +01:00
|
|
|
CompanyID uint
|
|
|
|
Code string `gorm:"unique; unique_index"`
|
2018-12-20 20:50:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func GetProducts() ([]*Product) {
|
|
|
|
|
|
|
|
products := make([]*Product, 0)
|
|
|
|
GetDB().Find(&products)
|
|
|
|
|
|
|
|
return products
|
2018-12-16 16:27:33 +01:00
|
|
|
}
|