storage

package
v0.0.0-...-8b6083e Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StatusRepresentations = map[ItemStatus]string{
	UNREAD:  "unread",
	READ:    "read",
	STARRED: "starred",
}
View Source
var StatusValues = map[string]ItemStatus{
	"unread":  UNREAD,
	"read":    READ,
	"starred": STARRED,
}

Functions

func TableExists

func TableExists(db *sql.DB, table string) bool

Types

type Channel

type Channel struct {
	Id         int64
	Name       string
	UserId     int64
	SourceType int64
	SourceId   int64

	CreatedAt time.Time
}

type Item

type Item struct {
	Id          int64 `gorm:"primaryKey"`
	Guid        string
	ChannelId   int64
	Title       string
	Description string
	Link        string
	Author      string
	PubDate     time.Time
	Category    string
	Comments    string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

type ItemStatus

type ItemStatus int
const (
	UNREAD  ItemStatus = 0
	READ    ItemStatus = 1
	STARRED ItemStatus = 2
)

func (ItemStatus) MarshalJSON

func (s ItemStatus) MarshalJSON() ([]byte, error)

func (*ItemStatus) UnmarshalJSON

func (s *ItemStatus) UnmarshalJSON(b []byte) error

type Storage

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

func New

func New(dbname string, user string, password string) (*Storage, error)

func (*Storage) CreateChannel

func (s *Storage) CreateChannel(name string) *Channel

func (*Storage) CreateItems

func (s *Storage) CreateItems(items []Item) bool

func (*Storage) DeleteChannel

func (s *Storage) DeleteChannel(feedId int64) bool

func (*Storage) GetChannel

func (s *Storage) GetChannel(id int64) *Channel

func (*Storage) GetItem

func (s *Storage) GetItem(id int64) *Item

func (*Storage) ListChannels

func (s *Storage) ListChannels() []Channel

func (*Storage) ListItems

func (s *Storage) ListItems() []Item

func (*Storage) MarkItemAsRead

func (s *Storage) MarkItemAsRead(id int64) bool

func (*Storage) RenameChannel

func (s *Storage) RenameChannel(feedId int64, newTitle string) bool

Jump to

Keyboard shortcuts

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