Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

Commit 2ce5c37

Browse files
committed
Address go lint comments for the examples.
1 parent 5e0c586 commit 2ce5c37

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

examples/models.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/google/jsonapi"
88
)
99

10+
// Blog is a model representing a blog site
1011
type Blog struct {
1112
ID int `jsonapi:"primary,blogs"`
1213
Title string `jsonapi:"attr,title"`
@@ -17,6 +18,7 @@ type Blog struct {
1718
ViewCount int `jsonapi:"attr,view_count"`
1819
}
1920

21+
// Post is a model representing a post on a blog
2022
type Post struct {
2123
ID int `jsonapi:"primary,posts"`
2224
BlogID int `jsonapi:"attr,blog_id"`
@@ -25,19 +27,21 @@ type Post struct {
2527
Comments []*Comment `jsonapi:"relation,comments"`
2628
}
2729

30+
// Comment is a model representing a user submitted comment
2831
type Comment struct {
2932
ID int `jsonapi:"primary,comments"`
3033
PostID int `jsonapi:"attr,post_id"`
3134
Body string `jsonapi:"attr,body"`
3235
}
3336

34-
// Blog Links
37+
// JSONAPILinks implements the Linkable interface for a blog
3538
func (blog Blog) JSONAPILinks() *jsonapi.Links {
3639
return &jsonapi.Links{
3740
"self": fmt.Sprintf("https://example.com/blogs/%d", blog.ID),
3841
}
3942
}
4043

44+
// JSONAPIRelationshipLinks implements the RelationshipLinkable interface for a blog
4145
func (blog Blog) JSONAPIRelationshipLinks(relation string) *jsonapi.Links {
4246
if relation == "posts" {
4347
return &jsonapi.Links{
@@ -52,13 +56,14 @@ func (blog Blog) JSONAPIRelationshipLinks(relation string) *jsonapi.Links {
5256
return nil
5357
}
5458

55-
// Blog Meta
59+
// JSONAPIMeta implements the Metable interface for a blog
5660
func (blog Blog) JSONAPIMeta() *jsonapi.Meta {
5761
return &jsonapi.Meta{
5862
"detail": "extra details regarding the blog",
5963
}
6064
}
6165

66+
// JSONAPIRelationshipLinks implements the RelationshipMetable interface for a blog
6267
func (blog Blog) JSONAPIRelationshipMeta(relation string) *jsonapi.Meta {
6368
if relation == "posts" {
6469
return &jsonapi.Meta{

0 commit comments

Comments
 (0)