datastore

package
v0.0.0-...-3ee5860 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogger

func SetLogger(logger zerolog.Logger)

Types

type Datastore

type Datastore interface {
	AddFeed(
		ctx context.Context,
		feedURL string,
		title *string,
		desc *string,
		tags []string,
		isStarred *bool,
		pullTimeout *time.Duration,
	) (
		feed *entity.Feed,
		added bool,
		err error,
	)

	EditFeeds(
		ctx context.Context,
		ops []*entity.FeedEditOp,
	) (
		feeds []*entity.Feed,
		err error,
	)

	ListFeeds(
		ctx context.Context,
		maxEntriesPerFeed *uint32,
	) (
		feeds []*entity.Feed,
		err error,
	)

	PullFeeds(
		ctx context.Context,
		ids []entity.ID,
		entryReadStatus *bool,
		maxEntriesPerFeed *uint32,
		timeoutPerFeed *time.Duration,
	) (
		results <-chan entity.PullResult,
	)

	DeleteFeeds(
		ctx context.Context,
		ids []entity.ID,
	) (
		err error,
	)

	ListEntries(
		ctx context.Context,
		feedIDs []entity.ID,
		isBookmarked *bool,
	) (
		entries []*entity.Entry,
		err error,
	)

	EditEntries(
		ctx context.Context,
		ops []*entity.EntryEditOp,
	) (
		entries []*entity.Entry,
		err error,
	)

	GetEntry(
		ctx context.Context,
		id entity.ID,
	) (
		entry *entity.Entry,
		err error,
	)

	ExportSubscription(
		ctx context.Context,
		title *string,
	) (
		subscription *entity.Subscription,
		err error,
	)

	ImportSubscription(
		ctx context.Context,
		sub *entity.Subscription,
	) (
		processed int,
		imported int,
		err error,
	)

	GetGlobalStats(
		ctx context.Context,
	) (
		stats *entity.Stats,
		err error,
	)
}

Datastore describes the persistence layer interface.

type ID

type ID = uint32

type Parser

type Parser interface {
	ParseURLWithContext(feedURL string, ctx context.Context) (feed *gofeed.Feed, err error)
}

Parser captures the gofeed parser as a pluggable interface.

type SQLite

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

func NewSQLite

func NewSQLite(filename string) (*SQLite, error)

func (*SQLite) AddFeed

func (db *SQLite) AddFeed(
	ctx context.Context,
	feedURL string,
	title *string,
	desc *string,
	tags []string,
	isStarred *bool,
	pullTimeout *time.Duration,
) (*entity.Feed, bool, error)

AddFeed adds the given feed into the database.

func (*SQLite) DeleteFeeds

func (db *SQLite) DeleteFeeds(ctx context.Context, ids []entity.ID) error

func (*SQLite) EditEntries

func (db *SQLite) EditEntries(
	ctx context.Context,
	ops []*entity.EntryEditOp,
) ([]*entity.Entry, error)

EditEntries updates fields of an entry.

func (*SQLite) EditFeeds

func (db *SQLite) EditFeeds(
	ctx context.Context,
	ops []*entity.FeedEditOp,
) ([]*entity.Feed, error)

EditFeed updates fields of an feed.

func (*SQLite) ExportSubscription

func (db *SQLite) ExportSubscription(
	ctx context.Context,
	title *string,
) (*entity.Subscription, error)

func (*SQLite) GetEntry

func (db *SQLite) GetEntry(
	ctx context.Context,
	id entity.ID,
) (*entity.Entry, error)

func (*SQLite) GetGlobalStats

func (db *SQLite) GetGlobalStats(ctx context.Context) (*entity.Stats, error)

func (*SQLite) ImportSubscription

func (db *SQLite) ImportSubscription(
	ctx context.Context,
	sub *entity.Subscription,
) (processed int, imported int, err error)

func (*SQLite) ListEntries

func (db *SQLite) ListEntries(
	ctx context.Context,
	feedIDs []entity.ID,
	isBookmarked *bool,
) ([]*entity.Entry, error)

func (*SQLite) ListFeeds

func (db *SQLite) ListFeeds(
	ctx context.Context,
	maxEntriesPerFeed *uint32,
) ([]*entity.Feed, error)

func (*SQLite) PullFeeds

func (db *SQLite) PullFeeds(
	ctx context.Context,
	ids []entity.ID,
	entryReadStatus *bool,
	maxEntriesPerFeed *uint32,
	timeoutPerFeed *time.Duration,
) <-chan entity.PullResult

Directories

Path Synopsis
package migration contains SQL migration schemas.
package migration contains SQL migration schemas.

Jump to

Keyboard shortcuts

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