From f8a6b57c33247ae531aacb3ad8aedee006052e6e Mon Sep 17 00:00:00 2001 From: konrad Date: Tue, 10 Oct 2017 11:20:16 +0200 Subject: [PATCH] Implemented new models Signed-off-by: kolaente --- models/author.go | 13 +++++++++++++ models/models.go | 2 ++ models/publisher.go | 12 ++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 models/author.go create mode 100644 models/publisher.go diff --git a/models/author.go b/models/author.go new file mode 100644 index 0000000..1df3ff9 --- /dev/null +++ b/models/author.go @@ -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" +} \ No newline at end of file diff --git a/models/models.go b/models/models.go index 70a251d..56d1795 100644 --- a/models/models.go +++ b/models/models.go @@ -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 diff --git a/models/publisher.go b/models/publisher.go new file mode 100644 index 0000000..02bea31 --- /dev/null +++ b/models/publisher.go @@ -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" +} \ No newline at end of file