-
Notifications
You must be signed in to change notification settings - Fork 0
/
book.go
81 lines (77 loc) · 1.37 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package main
import "fmt"
// Book comment
type Book struct {
ID int
Title string
Author string
YearPublished int
}
func (b Book) String() string {
return fmt.Sprintf(
"Title: \t\t%q\n"+
"Author: \t\t%q\n"+
"Published: \t%v\n", b.Title, b.Author, b.YearPublished)
}
var books = []Book{
{
ID: 1,
Title: "Title 1",
Author: "Author 1",
YearPublished: 1979,
},
{
ID: 2,
Title: "Title 2",
Author: "Author 2",
YearPublished: 1980,
},
{
ID: 3,
Title: "Title 3",
Author: "Author 3",
YearPublished: 1983,
},
{
ID: 4,
Title: "Title 4",
Author: "Author 4",
YearPublished: 1979,
},
{
ID: 5,
Title: "Title 5",
Author: "Author 5",
YearPublished: 1985,
},
{
ID: 6,
Title: "Title 6",
Author: "Author 6",
YearPublished: 1986,
},
{
ID: 7,
Title: "Title 7",
Author: "Author 7",
YearPublished: 1987,
},
{
ID: 8,
Title: "Title 8",
Author: "Author 8",
YearPublished: 1988,
},
{
ID: 9,
Title: "Title 9",
Author: "Author 9",
YearPublished: 1989,
},
{
ID: 10,
Title: "Title 10",
Author: "Author 10",
YearPublished: 2020,
},
}