model

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Ensure that a post doesn't get synced more than once every SyncCooldown.
	SyncCooldown = 2 * time.Hour
)

Variables

This section is empty.

Functions

func GenerateSessionID added in v0.4.0

func GenerateSessionID() (string, error)

Generate a random, crypto-safe session ID.

Types

type Account

type Account struct {
	// contains filtered or unexported fields
}

func LoadAccount

func LoadAccount(id uuid.UUID, username string, isAdmin bool, createdAt, updatedAt time.Time) *Account

func NewAccount

func NewAccount(username string) (*Account, error)

func (*Account) CheckDelete

func (a *Account) CheckDelete() error

func (*Account) CreatedAt

func (a *Account) CreatedAt() time.Time

func (*Account) ID

func (a *Account) ID() uuid.UUID

func (*Account) IsAdmin

func (a *Account) IsAdmin() bool

func (*Account) UpdatedAt

func (a *Account) UpdatedAt() time.Time

func (*Account) Username

func (a *Account) Username() string

type Blog

type Blog struct {
	// contains filtered or unexported fields
}

func LoadBlog

func LoadBlog(id uuid.UUID, feedURL, siteURL, title, etag, lastModified string, syncedAt, createdAt, updatedAt time.Time) *Blog

func NewBlog

func NewBlog(feedURL, siteURL, title, etag, lastModified string, syncedAt time.Time) (*Blog, error)

func (*Blog) CanBeSynced added in v0.5.2

func (b *Blog) CanBeSynced(now time.Time) bool

func (*Blog) CheckDelete

func (b *Blog) CheckDelete() error

func (*Blog) CreatedAt

func (b *Blog) CreatedAt() time.Time

func (*Blog) ETag

func (b *Blog) ETag() string

func (*Blog) FeedURL

func (b *Blog) FeedURL() string

func (*Blog) ID

func (b *Blog) ID() uuid.UUID

func (*Blog) LastModified

func (b *Blog) LastModified() string

func (*Blog) SetETag

func (b *Blog) SetETag(etag string) error

func (*Blog) SetLastModified

func (b *Blog) SetLastModified(lastModified string) error

func (*Blog) SetSyncedAt

func (b *Blog) SetSyncedAt(syncedAt time.Time)

func (*Blog) SetUpdatedAt

func (b *Blog) SetUpdatedAt(updatedAt time.Time) error

func (*Blog) SiteURL

func (b *Blog) SiteURL() string

func (*Blog) SyncedAt

func (b *Blog) SyncedAt() time.Time

func (*Blog) Title

func (b *Blog) Title() string

func (*Blog) UpdatedAt

func (b *Blog) UpdatedAt() time.Time

type Page added in v0.5.0

type Page struct {
	// contains filtered or unexported fields
}

func LoadPage added in v0.5.0

func LoadPage(id uuid.UUID, url, title, content string, createdAt, updatedAt time.Time) *Page

func NewPage added in v0.5.0

func NewPage(url, title, content string) (*Page, error)

func (*Page) CheckDelete added in v0.5.0

func (p *Page) CheckDelete() error

func (*Page) Content added in v0.5.0

func (p *Page) Content() string

func (*Page) CreatedAt added in v0.5.0

func (p *Page) CreatedAt() time.Time

func (*Page) ID added in v0.5.0

func (p *Page) ID() uuid.UUID

func (*Page) SetContent added in v0.5.0

func (p *Page) SetContent(content string) error

func (*Page) SetUpdatedAt added in v0.5.0

func (p *Page) SetUpdatedAt(updatedAt time.Time) error

func (*Page) Title added in v0.5.0

func (p *Page) Title() string

func (*Page) URL added in v0.5.0

func (p *Page) URL() string

func (*Page) UpdatedAt added in v0.5.0

func (p *Page) UpdatedAt() time.Time

type Post

type Post struct {
	// contains filtered or unexported fields
}

func LoadPost

func LoadPost(id, blogID uuid.UUID, url, title, content string, publishedAt, createdAt, updatedAt time.Time) *Post

func NewPost

func NewPost(blog *Blog, url, title, content string, publishedAt time.Time) (*Post, error)

func (*Post) BlogID

func (p *Post) BlogID() uuid.UUID

func (*Post) CheckDelete

func (p *Post) CheckDelete() error

func (*Post) Content

func (p *Post) Content() string

func (*Post) CreatedAt

func (p *Post) CreatedAt() time.Time

func (*Post) ID

func (p *Post) ID() uuid.UUID

func (*Post) PublishedAt

func (p *Post) PublishedAt() time.Time

func (*Post) SetContent

func (p *Post) SetContent(content string) error

func (*Post) SetPublishedAt added in v0.5.2

func (p *Post) SetPublishedAt(publishedAt time.Time) error

func (*Post) SetTitle added in v0.5.2

func (p *Post) SetTitle(title string) error

func (*Post) SetUpdatedAt

func (p *Post) SetUpdatedAt(updatedAt time.Time) error

func (*Post) Title

func (p *Post) Title() string

func (*Post) URL

func (p *Post) URL() string

func (*Post) UpdatedAt

func (p *Post) UpdatedAt() time.Time

type Session added in v0.4.0

type Session struct {
	// contains filtered or unexported fields
}

func LoadSession added in v0.4.0

func LoadSession(id, accountID uuid.UUID, hash string, expiresAt, createdAt, updatedAt time.Time) *Session

func NewSession added in v0.4.0

func NewSession(account *Account, ttl time.Duration) (*Session, string, error)

func (*Session) AccountID added in v0.4.0

func (s *Session) AccountID() uuid.UUID

func (*Session) CheckDelete added in v0.4.0

func (s *Session) CheckDelete() error

func (*Session) CreatedAt added in v0.4.0

func (s *Session) CreatedAt() time.Time

func (*Session) ExpiresAt added in v0.4.0

func (s *Session) ExpiresAt() time.Time

func (*Session) Hash added in v0.4.0

func (s *Session) Hash() string

func (*Session) ID added in v0.4.0

func (s *Session) ID() uuid.UUID

func (*Session) UpdatedAt added in v0.4.0

func (s *Session) UpdatedAt() time.Time

type Tag

type Tag struct {
	// contains filtered or unexported fields
}

func LoadTag

func LoadTag(id uuid.UUID, name string, createdAt, updatedAt time.Time) *Tag

func NewTag

func NewTag(name string) (*Tag, error)

func (*Tag) CheckDelete

func (t *Tag) CheckDelete() error

func (*Tag) CreatedAt

func (t *Tag) CreatedAt() time.Time

func (*Tag) ID

func (t *Tag) ID() uuid.UUID

func (*Tag) Name

func (t *Tag) Name() string

func (*Tag) SetUpdatedAt

func (t *Tag) SetUpdatedAt(updatedAt time.Time) error

func (*Tag) UpdatedAt

func (t *Tag) UpdatedAt() time.Time

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL