26 lines
335 B
Go
26 lines
335 B
Go
package model
|
|
|
|
import (
|
|
"github.com/jinzhu/gorm"
|
|
)
|
|
|
|
type Company struct {
|
|
gorm.Model
|
|
Name string
|
|
}
|
|
|
|
func GetCompanies() ([]*Company) {
|
|
|
|
comapnies := make([]*Company, 0)
|
|
GetDB().Find(&comapnies)
|
|
|
|
return comapnies
|
|
}
|
|
|
|
func (company *Company) Create() (*Company) {
|
|
|
|
GetDB().Create(company)
|
|
GetDB().Save(company)
|
|
|
|
return company;
|
|
} |