package models
|
|
import "github.com/jinzhu/gorm"
|
|
type Program struct {
|
Name string `gorm:"column:name;primary_key;unique;not null;default:''" json:"name"` //程序名字
|
Version string `gorm:"column:version;not null;default:''" json:"version"` //程序版本
|
Md5sum string `gorm:"column:md5sum;not null;default:'';" json:"md5sum"` //md5
|
BuildTime string `gorm:"column:build_time;not null;default:''" json:"buildTime"` //build时间
|
CommitSha1 string `gorm:"column:commit_sha1;not null;default:'';" json:"commitSha1"` //commit sha1
|
}
|
|
type PlatformModel interface {
|
Insert(db *gorm.DB, p *Program) error
|
FindAll() ([]Program, error)
|
}
|
|
|
|
|
//func (Program) TableName() string {
|
// return "t_programs"
|
//}
|
//
|
//func (a *Program) FindAll() ([]Program, error) {
|
// var rows []Program
|
// if err := db.Table(a.TableName()).Find(&rows).Error; err != nil {
|
// return nil, err
|
// }
|
//
|
// return rows, nil
|
//}
|