-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbook.go
77 lines (73 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
package main
import (
"fmt"
_ "fmt"
)
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: "Atomic Habits",
Author: "James Clear",
YearPublished: 2020,
},
{
ID: 2,
Title: "Elon Musk",
Author: "Ashely",
YearPublished: 2019,
},
{
ID: 3,
Title: "Deep Work",
Author: "Unknown",
YearPublished: 2020,
},
{
ID: 4,
Title: "Live like a monk",
Author: "Jay shetty",
YearPublished: 2019,
},
{
ID: 5,
Title: "C",
Author: "Dennis Ritche",
YearPublished: 1985,
},
{
ID: 6,
Title: "C++",
Author: "Strostorp",
YearPublished: 1990,
}, {
ID: 7,
Title: "Java",
Author: "James Gosling",
YearPublished: 1993,
}, {
ID: 8,
Title: "Python",
Author: "Not getting",
YearPublished: 1990,
}, {
ID: 9,
Title: "Hello",
Author: "world",
YearPublished: 2019,
}, {
ID: 10,
Title: "World",
Author: "hello",
YearPublished: 2019,
},
}