-
Notifications
You must be signed in to change notification settings - Fork 0
/
book.go
55 lines (51 loc) · 1.85 KB
/
book.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package model
import "fmt"
/**
* @Author: super
* @Date: 2020-08-25 08:14
* @Description:
**/
type Book struct {
BookID int `gorm:"column:book_id" gorm:"PRIMARY_KEY" json:"book_id"`
Title string `gorm:"column:title" json:"title"`
SubTitle string `gorm:"column:sub_title" json:"sub_title"`
Img string `gorm:"column:img" json:"img"`
Author string `gorm:"column:author" json:"author"`
Publish string `gorm:"column:publish" json:"publish"`
Producer string `gorm:"column:producer" json:"producer"`
PublishYear string `gorm:"column:publish_year" gorm:"type:date" json:"publish_year"`
Pages int `gorm:"column:pages" json:"pages"`
Price float64 `gorm:"column:price" json:"price"`
Layout string `gorm:"column:layout" json:"layout"`
Series string `gorm:"column:series" json:"series"`
ISBN string `gorm:"column:isbn" json:"isbn"`
Score float64 `gorm:"column:score" json:"score"`
OriginalName string `gorm:"column:original_name" json:"original_name"`
Comments int `gorm:"column:comments" json:"comments"`
CommentUrl string `gorm:"column:comment_url" json:"comment_url"`
Url string `gorm:"column:url" json:"url"`
}
func (book Book) String() string {
return fmt.Sprintf("book_id: %d\n"+
"title: %s\n"+
"sub_title: %s\n"+
"img: %s\n"+
"author: %s\n"+
"publish: %s\n"+
"producer: %s\n"+
"publish_year: %s\n"+
"pages: %d\n"+
"price: %f\n"+
"layout: %s\n"+
"series: %s\n"+
"isbn: %s\n"+
"score: %f\n"+
"original_name: %s\n"+
"comments: %d\n"+
"comment_url: %s\n"+
"url: %s",
book.BookID, book.Title, book.SubTitle, book.Img,
book.Author, book.Publish, book.Producer, book.PublishYear,
book.Pages, book.Price, book.Layout, book.Series, book.ISBN,
book.Score, book.OriginalName, book.Comments, book.CommentUrl, book.Url)
}