sqlitestore

package module
v0.0.0-...-d619ce2 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPostNotFound = errors.New("post not found")

Functions

This section is empty.

Types

type SQLiteStore

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

SQLiteStore is a SQLite implementation of the downcache.CacheStore interface.

func NewSQLiteStore

func NewSQLiteStore(db *sql.DB, dbPath, tableName string) *SQLiteStore

NewSQLiteStore creates a new SQLiteStore instance.

func (*SQLiteStore) Clear

func (s *SQLiteStore) Clear(_ context.Context) error

func (*SQLiteStore) Close

func (s *SQLiteStore) Close() error

func (*SQLiteStore) Create

func (s *SQLiteStore) Create(_ context.Context, post *downcache.Post) (*downcache.Post, error)

Create creates a new post in the database

func (*SQLiteStore) DBPath

func (s *SQLiteStore) DBPath() string

func (*SQLiteStore) Delete

func (s *SQLiteStore) Delete(_ context.Context, postType, slug string) error

func (*SQLiteStore) Get

func (s *SQLiteStore) Get(_ context.Context, postType, slug string) (*downcache.Post, error)

func (*SQLiteStore) GetTaxonomies

func (s *SQLiteStore) GetTaxonomies(_ context.Context) ([]string, error)

func (*SQLiteStore) GetTaxonomyTerms

func (s *SQLiteStore) GetTaxonomyTerms(_ context.Context, taxonomy string) ([]string, error)

func (*SQLiteStore) Init

func (s *SQLiteStore) Init() error

Init initializes the SQLiteStore, creating the necessary tables or indexes if they do not exist.

func (*SQLiteStore) Search

func (*SQLiteStore) Update

func (s *SQLiteStore) Update(_ context.Context, oldType, oldSlug string, post *downcache.Post) error

Update updates an existing post in the database TODO: Use the oldType and oldSlug parameters to update the post via post_id and then update the post_id to the new post_id if the post_type or slug has changed.

Jump to

Keyboard shortcuts

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