sample.gno
2.11 Kb ยท 94 lines
1package blog
2
3import (
4 "gno.land/p/lou/blog"
5)
6
7func CreateSampleBlog() *blog.Blog {
8 post1, err := blog.NewPost(
9 "ai-future",
10 "The Future of AI",
11 "Artificial Intelligence is transforming every industry, from healthcare to entertainment.",
12 "2024-03-01T10:00:00Z",
13 "g1pfyhn0d7g4tnp6wft9ge4cuu88ppr9u8mdggfs",
14 []string{"g1abcde12345"},
15 []string{"ai", "technology", "future"},
16 )
17 if err != nil {
18 panic(err)
19 }
20 comm, err := blog.NewComment(
21 "g1abcde12345",
22 "Exciting times ahead!",
23 )
24 if err != nil {
25 panic(err)
26 }
27 post1.AddComment(comm)
28
29 post2, err := blog.NewPost(
30 "blockchain-real-world",
31 "Blockchain in the Real World",
32 "Beyond cryptocurrencies, blockchain is finding uses in supply chains, voting systems, and more.",
33 "2023-12-15T08:30:00Z",
34 "g1pfyhn0d7g4tnp6wft9ge4cuu88ppr9u8mdggfs",
35 []string{"g1pfyhn0d7g4tnp6wft9ge4cuu88ppr9u8mdggfs"},
36 []string{"blockchain", "tech", "supplychain"},
37 )
38 if err != nil {
39 panic(err)
40 }
41 reply, err := blog.NewComment(
42 "g1ffzxha57dh0qgv9ma5v393ur0zexfvp6lsjpae",
43 "heyyy",
44 )
45 if err != nil {
46 panic(err)
47 }
48 comm2, err := blog.NewComment(
49 "g14x2crt492f84shxa9s7e5ulk7lnf2p3euz7r9n",
50 "This tech still needs better UX.",
51 )
52 if err != nil {
53 panic(err)
54 }
55 comm3, err := blog.NewComment(
56 "g1fjnxhv3v5x02j49fyl49epmhjyzscm8e4au94t",
57 "Absolutely, usability is key for adoption.",
58 )
59 if err != nil {
60 panic(err)
61 }
62 comm4, err := blog.NewComment(
63 "g14x2crt492f84shxa9s7e5ulk7lnf2p3euz7r9n",
64 "... still needs better UX.",
65 )
66 if err != nil {
67 panic(err)
68 }
69 post2.AddComment(comm2)
70 post2.AddComment(comm3)
71 post2.AddReply(comm2.ID(), reply)
72 post2.AddReply(reply.ID(), comm4)
73
74 post3, err := blog.NewPost(
75 "getting-things-done",
76 "Getting Things Done in 2025",
77 "With distractions everywhere, productivity tools are more essential than ever.",
78 "2025-01-10T09:15:00Z",
79 "g1pfyhn0d7g4tnp6wft9ge4cuu88ppr9u8mdggfs",
80 []string{"g1produser1"},
81 []string{"productivity", "lifehacks", "focus", "ai"},
82 )
83 if err != nil {
84 panic(err)
85 }
86 myBlog.AddPost(post1)
87 myBlog.AddPost(post2)
88 myBlog.AddPost(post3)
89 return myBlog
90}
91
92func Test(_ realm) {
93 CreateSampleBlog()
94}