package models // Publisher holds publisher informations type Publisher struct { ID int64 `xorm:"int(11) autoincr not null unique pk"` Name string `xorm:"varchar(250) not null"` Created int64 `xorm:"created"` Updated int64 `xorm:"updated"` } // TableName returns the table name for publishers struct func (Publisher) TableName() string { return "publishers" } // GetPublisherByID returns a publisher by its ID func GetPublisherByID(id int64) (publisher Publisher, exists bool, err error) { has, err := x.Id(id).Get(&publisher) return publisher, has, err }