Implemented new models

Signed-off-by: kolaente <konrad@kola-entertainments.de>
This commit is contained in:
konrad 2017-10-10 11:20:16 +02:00 committed by kolaente
parent c5592ad45b
commit f8a6b57c33
3 changed files with 27 additions and 0 deletions

13
models/author.go Normal file
View File

@ -0,0 +1,13 @@
package models
type Author struct {
ID int64 `xorm:"int(11) autoincr not null unique pk"`
Forename string `xorm:"varchar(250)"`
Lastame string `xorm:"varchar(250) not null"`
Created int64 `xorm:"created"`
Updated int64 `xorm:"updated"`
}
func (Author) TableName() string {
return "authors"
}

View File

@ -29,6 +29,8 @@ func SetEngine() (err error) {
// Sync dat shit
x.Sync(&Book{})
x.Sync(&User{})
x.Sync(&Publisher{})
x.Sync(&Author{})
x.ShowSQL(true)
return nil

12
models/publisher.go Normal file
View File

@ -0,0 +1,12 @@
package models
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"`
}
func (Publisher) TableName() string {
return "publishers"
}