database

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

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

Go to latest
Published: Nov 21, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("url not found in database")

Functions

This section is empty.

Types

type Database

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

func New

func New(ctx context.Context, configuration config.Configuration, logger *slog.Logger) (*Database, error)

func (*Database) Close

func (db *Database) Close(timeout time.Duration) error

func (*Database) GetLastContent

func (db *Database) GetLastContent(ctx context.Context, name, url string) (int64, []byte, error)

func (*Database) InsertWatch

func (db *Database) InsertWatch(ctx context.Context, name, url string, content []byte) (int64, error)

func (*Database) PrepareDatabase

func (db *Database) PrepareDatabase(ctx context.Context, c config.Configuration) ([]config.WatchConfig, int, error)

PrepareDatabase cleans up old entries and returns new ones

func (*Database) UpdateLastContent

func (db *Database) UpdateLastContent(ctx context.Context, id int64, content []byte) error

type Interface

type Interface interface {
	Close(timeout time.Duration) error
	GetLastContent(ctx context.Context, name, url string) (int64, []byte, error)
	InsertWatch(ctx context.Context, name, url string, content []byte) (int64, error)
	UpdateLastContent(ctx context.Context, id int64, content []byte) error
	PrepareDatabase(ctx context.Context, c config.Configuration) ([]config.WatchConfig, int, error)
}

type MockDB

type MockDB struct{}

func NewMockDB

func NewMockDB() *MockDB

func (*MockDB) Close

func (*MockDB) Close(_ time.Duration) error

func (*MockDB) GetLastContent

func (*MockDB) GetLastContent(_ context.Context, _, _ string) (int64, []byte, error)

func (*MockDB) InsertWatch

func (*MockDB) InsertWatch(_ context.Context, _, _ string, _ []byte) (int64, error)

func (*MockDB) PrepareDatabase

func (*MockDB) PrepareDatabase(_ context.Context, _ config.Configuration) ([]config.WatchConfig, int, error)

func (*MockDB) UpdateLastContent

func (*MockDB) UpdateLastContent(_ context.Context, _ int64, _ []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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