Documentation
¶
Overview ¶
Package model contains all data structures used by the application.
Index ¶
- Constants
- func OppositeDirection(direction string) string
- func Themes() map[string]string
- func ValidateDirection(direction string) error
- func ValidateEntryOrder(order string) error
- func ValidateEntryStatus(status string) error
- func ValidateRange(offset, limit int) error
- func ValidateTheme(theme string) error
- type Categories
- type Category
- type Enclosure
- type EnclosureList
- type Entries
- type Entry
- type Feed
- type FeedIcon
- type Feeds
- type Icon
- type Icons
- type Integration
- type Job
- type JobList
- type Session
- type SessionData
- type User
- type UserSession
- type UserSessions
- type Users
Constants ¶
const ( EntryStatusUnread = "unread" EntryStatusRead = "read" EntryStatusRemoved = "removed" DefaultSortingOrder = "published_at" DefaultSortingDirection = "asc" )
Entry statuses
Variables ¶
This section is empty.
Functions ¶
func OppositeDirection ¶
OppositeDirection returns the opposite sorting direction.
func ValidateDirection ¶
ValidateDirection makes sure the sorting direction is valid.
func ValidateEntryOrder ¶
ValidateEntryOrder makes sure the sorting order is valid.
func ValidateEntryStatus ¶
ValidateEntryStatus makes sure the entry status is valid.
func ValidateRange ¶
ValidateRange makes sure the offset/limit values are valid.
Types ¶
type Category ¶
type Category struct { ID int64 `json:"id,omitempty"` Title string `json:"title,omitempty"` UserID int64 `json:"user_id,omitempty"` FeedCount int `json:"nb_feeds,omitempty"` }
Category represents a category in the system.
func (Category) ValidateCategoryCreation ¶
ValidateCategoryCreation validates a category during the creation.
func (Category) ValidateCategoryModification ¶
ValidateCategoryModification validates a category during the modification.
type Enclosure ¶
type Enclosure struct { ID int64 `json:"id"` UserID int64 `json:"user_id"` EntryID int64 `json:"entry_id"` URL string `json:"url"` MimeType string `json:"mime_type"` Size int64 `json:"size"` }
Enclosure represents an attachment.
type EnclosureList ¶
type EnclosureList []*Enclosure
EnclosureList represents a list of attachments.
type Entry ¶
type Entry struct { ID int64 `json:"id"` UserID int64 `json:"user_id"` FeedID int64 `json:"feed_id"` Status string `json:"status"` Hash string `json:"hash"` Title string `json:"title"` URL string `json:"url"` CommentsURL string `json:"comments_url"` Date time.Time `json:"published_at"` Content string `json:"content"` Author string `json:"author"` Starred bool `json:"starred"` Enclosures EnclosureList `json:"enclosures,omitempty"` Feed *Feed `json:"feed,omitempty"` Category *Category `json:"category,omitempty"` }
Entry represents a feed item in the system.
type Feed ¶
type Feed struct { ID int64 `json:"id"` UserID int64 `json:"user_id"` FeedURL string `json:"feed_url"` SiteURL string `json:"site_url"` Title string `json:"title"` CheckedAt time.Time `json:"checked_at"` EtagHeader string `json:"etag_header"` LastModifiedHeader string `json:"last_modified_header"` ParsingErrorMsg string `json:"parsing_error_message"` ParsingErrorCount int `json:"parsing_error_count"` ScraperRules string `json:"scraper_rules"` RewriteRules string `json:"rewrite_rules"` Crawler bool `json:"crawler"` Category *Category `json:"category,omitempty"` Entries Entries `json:"entries,omitempty"` Icon *FeedIcon `json:"icon"` }
Feed represents a feed in the database.
type Icon ¶
type Icon struct { ID int64 `json:"id"` Hash string `json:"hash"` MimeType string `json:"mime_type"` Content []byte `json:"content"` }
Icon represents a website icon (favicon)
type Integration ¶
type Integration struct { UserID int64 PinboardEnabled bool PinboardToken string PinboardTags string PinboardMarkAsUnread bool InstapaperEnabled bool InstapaperUsername string InstapaperPassword string FeverEnabled bool FeverUsername string FeverPassword string FeverToken string WallabagEnabled bool WallabagURL string WallabagClientID string WallabagClientSecret string WallabagUsername string WallabagPassword string NunuxKeeperEnabled bool NunuxKeeperURL string NunuxKeeperAPIKey string }
Integration represents user integration settings.
type Session ¶
type Session struct { ID string Data *SessionData }
Session represents a session in the system.
type SessionData ¶
type SessionData struct { CSRF string `json:"csrf"` OAuth2State string `json:"oauth2_state"` FlashMessage string `json:"flash_message"` FlashErrorMessage string `json:"flash_error_message"` Language string `json:"language"` }
SessionData represents the data attached to the session.
func (*SessionData) Scan ¶
func (s *SessionData) Scan(src interface{}) error
Scan converts raw JSON data.
func (SessionData) String ¶
func (s SessionData) String() string
type User ¶
type User struct { ID int64 `json:"id"` Username string `json:"username"` Password string `json:"password,omitempty"` IsAdmin bool `json:"is_admin"` Theme string `json:"theme"` Language string `json:"language"` Timezone string `json:"timezone"` EntryDirection string `json:"entry_sorting_direction"` LastLoginAt *time.Time `json:"last_login_at,omitempty"` Extra map[string]string `json:"extra"` }
User represents a user in the system.
func (*User) UseTimezone ¶
UseTimezone converts last login date to the given timezone.
func (User) ValidatePassword ¶
ValidatePassword validates user password requirements.
func (User) ValidateUserCreation ¶
ValidateUserCreation validates new user.
func (User) ValidateUserLogin ¶
ValidateUserLogin validates user credential requirements.
func (User) ValidateUserModification ¶
ValidateUserModification validates user modification payload.
type UserSession ¶
type UserSession struct { ID int64 UserID int64 Token string CreatedAt time.Time UserAgent string IP string }
UserSession represents a user session in the system.
func (*UserSession) String ¶
func (u *UserSession) String() string
func (*UserSession) UseTimezone ¶
func (u *UserSession) UseTimezone(tz string)
UseTimezone converts creation date to the given timezone.
type UserSessions ¶
type UserSessions []*UserSession
UserSessions represents a list of sessions.
func (UserSessions) UseTimezone ¶
func (u UserSessions) UseTimezone(tz string)
UseTimezone converts creation date of all sessions to the given timezone.