From d29b6194189933d7531249c41e1317e0358cf754 Mon Sep 17 00:00:00 2001 From: konrad Date: Mon, 9 Oct 2017 18:29:46 +0200 Subject: [PATCH] Struct definition Signed-off-by: kolaente --- models/book.go | 15 +++++++++++++++ models/books_list.go | 14 -------------- 2 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 models/book.go diff --git a/models/book.go b/models/book.go new file mode 100644 index 0000000..9c64345 --- /dev/null +++ b/models/book.go @@ -0,0 +1,15 @@ +package models + +type Book struct { + ID int64 `xorm:"int(11) autoincr not null unique pk"` + Title string `xorm:"varchar(250) not null"` + Isbn string `xorm:"varchar(30)"` + Year int64 `xorm:"int(11)"` + Price float64 `xorm:"double"` + Status int64 `xorm:"int(11)"` + Publisher int64 `xorm:"int(11)"` +} + +func (Book) TableName() string{ + return "books" +} \ No newline at end of file diff --git a/models/books_list.go b/models/books_list.go index 2a2ca43..4a06230 100644 --- a/models/books_list.go +++ b/models/books_list.go @@ -2,20 +2,6 @@ package models import "fmt" -type Book struct { - ID int64 `xorm:"int(11) autoincr not null unique pk"` - Title string `xorm:"varchar(250) not null"` - Isbn string `xorm:"varchar(30)"` - Year int64 `xorm:"int(11)"` - Price float64 `xorm:"double"` - Status int64 `xorm:"int(11)"` - Publisher int64 `xorm:"int(11)"` -} - -func (Book) TableName() string{ - return "books" -} - func ListBooks() (books []*Book, err error) { err = x.Find(&books)