models

package
v0.0.0-...-dc8ef24 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MarkerRead
	MarkerUnread
	MarkerAny
)

Markers identify the visibility status of entities

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	ID        ID        `json:"id" gorm:"primary_key"`
	CreatedAt time.Time `json:"-"`
	UpdatedAt time.Time `json:"-"`

	Key  string     `json:"token"`
	Type APIKeyType `json:"-"`

	User    User      `json:"-"`
	UserID  ID        `json:"-"`
	Expires time.Time `json:"expires"`
}

APIKey represents an SQL schema for JSON Web Tokens created for User objects.

type APIKeyPair

type APIKeyPair struct {
	RefreshKey string `json:"refreshToken"`
	AccessKey  string `json:"accessToken"`
}

APIKeyPair collects a refresh and access token

type APIKeyType

type APIKeyType = int

APIKeyType alias

const (
	RefreshKey APIKeyType = iota
	AccessKey
)

APIKeyTypes identifies the kind of access or purpose of a key

type Category

type Category struct {
	ID        ID        `json:"id" gorm:"primary_key"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`

	User   User `json:"-"`
	UserID ID   `json:"-"`

	Feeds []Feed `json:"-"`

	Name string `json:"name"`
}

Category represents a container for Feed entities.

type Entry

type Entry struct {
	ID        ID        `json:"id" gorm:"primary_key"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`

	User   User `json:"-"`
	UserID ID   `json:"-"`

	Feed   Feed `json:"-"`
	FeedID ID   `json:"-"`

	Tags []Tag `json:"tags,omitempty" gorm:"many2many:entry_tags;"`

	GUID      string    `json:"-"`
	Title     string    `json:"title"`
	Link      string    `json:"link"`
	Author    string    `json:"author,omitempty"`
	Published time.Time `json:"published"`
	Saved     bool      `json:"isSaved"`
	Mark      Marker    `json:"markedAs"`
}

Entry represents subscription items obtained from Feed objects.

type Feed

type Feed struct {
	ID        ID        `json:"id" gorm:"primary_key"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`

	Category   Category `json:"category,omitempty"`
	CategoryID ID       `json:"-"`

	User   User `json:"-"`
	UserID ID   `json:"-"`

	Entries []Entry `json:"-"`

	Title        string    `json:"title"`
	Description  string    `json:"description,omitempty"`
	Subscription string    `json:"subscription"`
	Source       string    `json:"source,omitempty"`
	TTL          int       `json:"ttl,omitempty"`
	Etag         string    `json:"-"`
	LastUpdated  time.Time `json:"-"`
	Status       string    `json:"status,omitempty"`
}

Feed represents an Atom or RSS feed subscription.

type ID

type ID = string

ID type alias

type Marker

type Marker = int

Marker type alias

func MarkerFromString

func MarkerFromString(marker string) Marker

MarkerFromString converts a string to a Marker type

type OPML

type OPML struct {
	XMLName xml.Name `xml:"opml"`
	Body    OPMLBody `xml:"body"`
}

OPML collects all elements of an OPML file.

type OPMLBody

type OPMLBody struct {
	XMLName xml.Name      `xml:"body"`
	Items   []OPMLOutline `xml:"outline"`
}

An OPMLBody represents an OPML Body element.

type OPMLOutline

type OPMLOutline struct {
	XMLName xml.Name      `xml:"outline"`
	Type    string        `xml:"type,attr"`
	Text    string        `xml:"text,attr"`
	Title   string        `xml:"title,attr"`
	HTMLUrl string        `xml:"htmlUrl,attr"`
	XMLUrl  string        `xml:"xmlUrl,attr"`
	Items   []OPMLOutline `xml:"outline"`
}

An OPMLOutline represents an OPML Outline element.

type Page

type Page struct {
	FilterID       string
	ContinuationID string
	Count          int
	Newest         bool
	Marker         Marker
}

type Stats

type Stats struct {
	Unread int `json:"unread"`
	Read   int `json:"read"`
	Saved  int `json:"saved"`
	Total  int `json:"total"`
}

Stats represents statistics related to various attributes of Feed, Entry, and Category objects.

type Tag

type Tag struct {
	ID        ID        `json:"id" gorm:"primary_key"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`

	Name string `json:"name"`

	User   User `json:"-"`
	UserID ID   `json:"-"`

	Entries []Entry `json:"entries,omitempty" gorm:"many2many:entry_tags;"`
}

Tag represents an identifier object that can be applied to Entry objects.

type User

type User struct {
	ID        ID         `json:"id" gorm:"primary_key"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `json:"deleted_at" sql:"index"`

	Categories []Category `json:"categories,omitempty"`
	Feeds      []Feed     `json:"feeds,omitempty"`
	Entries    []Entry    `json:"entries,omitempty"`
	APIKeys    []APIKey   `json:"-"`
	Tags       []Tag      `json:"tags,omitempty"`

	Username     string `json:"username"`
	Email        string `json:"email"`
	PasswordHash []byte `json:"-"`
	PasswordSalt []byte `json:"-"`
}

User represents a user and owner of all other entities.

Jump to

Keyboard shortcuts

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