Struct definition
Signed-off-by: kolaente <konrad@kola-entertainments.de>
This commit is contained in:
parent
d26df6c160
commit
d29b619418
|
@ -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"
|
||||||
|
}
|
|
@ -2,20 +2,6 @@ package models
|
||||||
|
|
||||||
import "fmt"
|
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) {
|
func ListBooks() (books []*Book, err error) {
|
||||||
|
|
||||||
err = x.Find(&books)
|
err = x.Find(&books)
|
||||||
|
|
Loading…
Reference in New Issue