-
Notifications
You must be signed in to change notification settings - Fork 6
/
feeds.go
90 lines (74 loc) · 1.53 KB
/
feeds.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
82
83
84
85
86
87
88
89
90
package entities
import "github.com/sasha-s/go-deadlock"
type Feed struct {
deadlock.RWMutex
Subreddit string `json:"Subreddit"`
Title string `json:"Title"`
Author string `json:"Author"`
Pin bool `json:"Pin"`
PostType string `json:"PostType"`
ChannelID string `json:"ChannelID"`
}
func NewFeed(subreddit string, title string, author string, pin bool, postType string, channelID string) Feed {
return Feed{Subreddit: subreddit, Title: title, Author: author, Pin: pin, PostType: postType, ChannelID: channelID}
}
func (f Feed) SetSubreddit(subreddit string) Feed {
f.Subreddit = subreddit
return f
}
func (f Feed) GetSubreddit() string {
if f == (Feed{}) {
return ""
}
return f.Subreddit
}
func (f Feed) SetTitle(title string) Feed {
f.Title = title
return f
}
func (f Feed) GetTitle() string {
if f == (Feed{}) {
return ""
}
return f.Title
}
func (f Feed) SetAuthor(author string) Feed {
f.Author = author
return f
}
func (f Feed) GetAuthor() string {
if f == (Feed{}) {
return ""
}
return f.Author
}
func (f Feed) SetPin(pin bool) Feed {
f.Pin = pin
return f
}
func (f Feed) GetPin() bool {
if f == (Feed{}) {
return false
}
return f.Pin
}
func (f Feed) SetPostType(postType string) Feed {
f.PostType = postType
return f
}
func (f Feed) GetPostType() string {
if f == (Feed{}) {
return ""
}
return f.PostType
}
func (f Feed) SetChannelID(channelID string) Feed {
f.ChannelID = channelID
return f
}
func (f Feed) GetChannelID() string {
if f == (Feed{}) {
return ""
}
return f.ChannelID
}