Documentation ¶
Index ¶
- Constants
- type CreateTimestamper
- type FeedCode
- type FeedFetcher
- type FeedItem
- type ImageSearchResult
- type ImageSearcher
- type LatestEntry
- type LatestEntryRepository
- type LineBot
- type LineBotEvent
- type LineBotEventType
- type LineBotMessageType
- type LineBotTextMessage
- type LineItem
- type LineItemRepository
- type LineNotification
- type LineNotificationRepository
- type LineNotify
- type LineNotifyMessage
- type LineNotifyRequest
- type LineNotifyToken
- type PersistenceBeforeSaver
- type PersistenceHandler
- type PersistenceQuery
- type Reminder
- type ReminderRepository
- type ReminderType
- type TransactionOptions
- type Transactor
- type TweetItem
- type TweetItemRepository
- type TweetRequest
- type TweetResponse
- type Tweeter
- type UpdateTimestamper
- type UstreamStatus
- type UstreamStatusChecker
- type UstreamStatusRepository
Constants ¶
const ( LineBotEventTypeMessage LineBotEventType = "message" LineBotEventTypeFollow LineBotEventType = "follow" LineBotEventTypeUnfollow LineBotEventType = "unfollow" LineBotMessageTypeText LineBotMessageType = "text" )
const (
UstreamStatusID = "ustream_status"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateTimestamper ¶
CreateTimestamper provides set current timestamp to entity when save if not already set
type FeedCode ¶
type FeedCode string
FeedCode represents identify code of feed
const ( FeedCodeMomota FeedCode = "momota-sd" FeedCodeAriyasu FeedCode = "ariyasu-sd" FeedCodeTamai FeedCode = "tamai-sd" FeedCodeSasaki FeedCode = "sasaki-sd" FeedCodeTakagi FeedCode = "takagi-sd" FeedCodeHappyclo FeedCode = "happyclo" FeedCodeAeNews FeedCode = "aenews" FeedCodeYoutube FeedCode = "youtube" )
type FeedFetcher ¶
type FeedFetcher interface {
Fetch(code FeedCode, maxItemNum int, latestURL string) ([]FeedItem, error)
}
FeedFetcher interface
type FeedItem ¶
type FeedItem struct { Title string `validate:"required"` URL string `validate:"required,url"` EntryTitle string `validate:"required"` EntryURL string `validate:"required,url"` ImageURLs []string VideoURLs []string PublishedAt time.Time `validate:"required"` }
FeedItem represents an entry in the feed
type ImageSearchResult ¶
ImageSearchResult represents custom search image result
type ImageSearcher ¶
type ImageSearcher interface {
Search(string) (ImageSearchResult, error)
}
ImageSearcher represents google custom search image api
type LatestEntry ¶
type LatestEntry struct { ID string `datastore:"-" goon:"id"` Code FeedCode `validate:"required"` URL string `validate:"required,url"` PublishedAt time.Time `validate:"required"` CreatedAt time.Time `validate:"required"` UpdatedAt time.Time `validate:"required"` }
LatestEntry for confirm last updated entry url
func NewLatestEntry ¶
func NewLatestEntry(urlStr string) (*LatestEntry, error)
NewLatestEntry builds *LatestEntry given url
func (*LatestEntry) GetCreatedAt ¶
func (l *LatestEntry) GetCreatedAt() time.Time
GetCreatedAt gets CreatedAt
func (*LatestEntry) SetCreatedAt ¶
func (l *LatestEntry) SetCreatedAt(t time.Time)
SetCreatedAt sets given time to CreatedAt
func (*LatestEntry) SetUpdatedAt ¶
func (l *LatestEntry) SetUpdatedAt(t time.Time)
SetUpdatedAt sets given time to UpdatedAt
type LatestEntryRepository ¶
type LatestEntryRepository interface { Save(*LatestEntry) error FindOrNewByURL(string) (*LatestEntry, error) GetURL(string) string }
LatestEntryRepository interface
type LineBotEvent ¶
type LineBotEvent struct { ReplyToken string Type LineBotEventType MessageType LineBotMessageType TextMessage LineBotTextMessage }
LineBotEvent represents line bot event
type LineBotEventType ¶
type LineBotEventType string
LineBotEventType represents line bot event type
type LineBotMessageType ¶
type LineBotMessageType string
LineBotMessageType represents line bot message type
type LineBotTextMessage ¶
LineBotTextMessage represents line bot text message
type LineItem ¶
type LineItem struct { ID string `datastore:"-" goon:"id" validate:"required"` Title string `validate:"required"` URL string `validate:"required,url"` PublishedAt time.Time `validate:"required"` ImageURLs string `datastore:",noindex"` VideoURLs string `datastore:",noindex"` CreatedAt time.Time `validate:"required"` }
LineItem represents line notification history
func NewLineItem ¶
NewLineItem returns LineItem given FeedItem
func (*LineItem) GetCreatedAt ¶
GetCreatedAt gets CreatedAt
func (*LineItem) SetCreatedAt ¶
SetCreatedAt sets given time to CreatedAt
type LineItemRepository ¶
type LineItemRepository interface { Exists(string) bool Find(string) (*LineItem, error) Save(*LineItem) error Tx(PersistenceHandler) LineItemRepository }
LineItemRepository interface
type LineNotification ¶
type LineNotification struct { ID string `datastore:"-" goon:"id" validate:"required"` TokenCrypt string `datastore:",noindex" validate:"required"` Admin bool CreatedAt time.Time `validate:"required"` }
LineNotification represents user tokens that published by LINE Notify the token is encrypted
func NewLineNotification ¶
func NewLineNotification(tokenKey, token string) (*LineNotification, error)
NewLineNotification returns LineNotification given key and token
func (*LineNotification) GetCreatedAt ¶
func (l *LineNotification) GetCreatedAt() time.Time
GetCreatedAt gets CreatedAt
func (*LineNotification) SetCreatedAt ¶
func (l *LineNotification) SetCreatedAt(t time.Time)
SetCreatedAt sets given time to CreatedAt
type LineNotificationRepository ¶
type LineNotificationRepository interface { FindAll() ([]*LineNotification, error) Save(*LineNotification) error Delete(string) error }
LineNotificationRepository interface
type LineNotify ¶
type LineNotify interface {
Notify(string, LineNotifyMessage) error
}
LineNotify interface
type LineNotifyMessage ¶
type LineNotifyMessage struct { Text string `validate:"required"` ImageURL string `validate:"omitempty,url"` }
LineNotifyMessage represents text message and image
type LineNotifyRequest ¶
type LineNotifyRequest struct { ID string `validate:"required"` AccessToken string `validate:"required"` Messages []LineNotifyMessage `validate:"min=1,dive"` }
LineNotifyRequest represents request that notification message
type LineNotifyToken ¶
LineNotifyToken interface
type PersistenceBeforeSaver ¶
type PersistenceBeforeSaver interface {
BeforeSave()
}
PersistenceBeforeSaver hook
type PersistenceHandler ¶
type PersistenceHandler interface { Kind(interface{}) string Put(interface{}) error PutMulti(interface{}) error Get(interface{}) error GetMulti(interface{}) error Delete(interface{}) error DeleteMulti(interface{}) error NewQuery(string) PersistenceQuery GetAll(PersistenceQuery, interface{}) error FlushLocalCache() }
PersistenceHandler represents persist operations
type PersistenceQuery ¶
type PersistenceQuery interface {
Filter(string, interface{}) PersistenceQuery
}
PersistenceQuery interface
type Reminder ¶
type Reminder struct { ID int64 `datastore:"-" goon:"id"` Text string `validate:"required"` Type ReminderType Enabled bool // Once RemindAt time.Time `datastore:",noindex"` // Weekly Weekday time.Weekday `datastore:",noindex"` Hour int `datastore:",noindex"` Minute int `datastore:",noindex"` }
Reminder represents any remind information
func NewReminderOnce ¶
NewReminderOnce builds one-time reminder
func NewReminderWeekly ¶
NewReminderWeekly builds weekly reminder
type ReminderRepository ¶
ReminderRepository interface
type ReminderType ¶
type ReminderType int
ReminderType type
const ( ReminderOneTime ReminderType = iota ReminderWeekly )
type TransactionOptions ¶
TransactionOptions represents transaction options (TODO: want to eliminate datastore dependence but no ideas)
type Transactor ¶
type Transactor interface {
RunInTransaction(func(PersistenceHandler) error, *TransactionOptions) error
}
Transactor provides transaction across entities
type TweetItem ¶
type TweetItem struct { ID string `datastore:"-" goon:"id" validate:"required"` Title string `validate:"required"` URL string `validate:"required,url"` PublishedAt time.Time `validate:"required"` ImageURLs string `datastore:",noindex"` VideoURLs string `datastore:",noindex"` CreatedAt time.Time `validate:"required"` }
TweetItem represents tweet history
func NewTweetItem ¶
NewTweetItem returns TweetItem given FeedItem
func (*TweetItem) GetCreatedAt ¶
GetCreatedAt gets CreatedAt
func (*TweetItem) SetCreatedAt ¶
SetCreatedAt sets given time to CreatedAt
type TweetItemRepository ¶
type TweetItemRepository interface { Exists(string) bool Find(string) (*TweetItem, error) Save(*TweetItem) error Tx(PersistenceHandler) TweetItemRepository }
TweetItemRepository interface
type TweetRequest ¶
type TweetRequest struct { InReplyToStatusID string Text string ImageURLs []string `validate:"dive,omitempty,url"` VideoURL string `validate:"omitempty,url"` }
TweetRequest represents request that tweet message, img urls and video url data
type TweetResponse ¶
type TweetResponse struct {
IDStr string
}
TweetResponse represents response tweet data
type Tweeter ¶
type Tweeter interface {
Tweet(TweetRequest) (TweetResponse, error)
}
Tweeter interface
type UpdateTimestamper ¶
UpdateTimestamper provides set current timestamp to entity when save
type UstreamStatus ¶
UstreamStatus represents ustream status
func NewUstreamStatus ¶
func NewUstreamStatus() *UstreamStatus
NewUstreamStatus returns UstreamStatus
type UstreamStatusChecker ¶
UstreamStatusChecker interface
type UstreamStatusRepository ¶
type UstreamStatusRepository interface { Find(string) (*UstreamStatus, error) Save(*UstreamStatus) error }
UstreamStatusRepository interface