Library/models/publisher.go

21 lines
611 B
Go
Raw Permalink Normal View History

package models
2017-11-08 09:55:17 +00:00
// Publisher holds publisher informations
type Publisher struct {
2017-11-29 15:23:19 +00:00
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"`
Name string `xorm:"varchar(250) not null" json:"name"`
Created int64 `xorm:"created" json:"created"`
Updated int64 `xorm:"updated" json:"updated"`
}
2017-11-08 09:55:17 +00:00
// TableName returns the table name for publishers struct
func (Publisher) TableName() string {
return "publishers"
}
2017-11-08 09:55:17 +00:00
// GetPublisherByID returns a publisher by its ID
func GetPublisherByID(id int64) (publisher Publisher, exists bool, err error) {
2017-11-30 14:48:03 +00:00
exists, err = x.Id(id).Get(&publisher)
return
2017-11-07 15:35:10 +00:00
}