storage

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package storage handles data persistence using SQLite

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB wraps the SQLite database connection

func New

func New(path string) (*DB, error)

New creates a new database connection at the specified path

func NewDefault

func NewDefault() (*DB, error)

NewDefault creates a new database connection at the default XDG state location

func (*DB) ClearFeedCache

func (db *DB) ClearFeedCache() error

ClearFeedCache removes all cached feed content

func (*DB) Close

func (db *DB) Close() error

Close closes the database connection

func (*DB) GetCacheTime

func (db *DB) GetCacheTime() (*time.Time, error)

GetCacheTime retrieves the last fetch time from the database

func (*DB) LoadFeedCache

func (db *DB) LoadFeedCache(url string) ([]byte, error)

LoadFeedCache retrieves cached feed content from the database

func (*DB) LoadPostReadStatuses

func (db *DB) LoadPostReadStatuses() (map[string]bool, error)

LoadPostReadStatuses returns a map of UUID to read status

func (*DB) SaveFeedCache

func (db *DB) SaveFeedCache(url string, content []byte) error

SaveFeedCache stores the fetched feed content in the database

func (*DB) SavePostReadStatus

func (db *DB) SavePostReadStatus(uuid, feedURL string, read bool) error

SavePostReadStatus saves the read status for a single post

func (*DB) SavePostReadStatuses

func (db *DB) SavePostReadStatuses(statuses []PostReadStatus) error

SavePostReadStatuses saves multiple read statuses in a single transaction

func (*DB) SetCacheTime

func (db *DB) SetCacheTime() error

SetCacheTime stores the current time as the last fetch time

type PostReadStatus

type PostReadStatus struct {
	UUID    string
	FeedURL string
	Read    bool
}

PostReadStatus represents a post's read status in the database

Jump to

Keyboard shortcuts

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