storage

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package storage implements a set of functions to interact with the database.

Index

Constants

This section is empty.

Variables

View Source
var ErrDatabaseNotFound = errors.New("database not found")

Functions

func Migrate added in v0.21.0

func Migrate(db *sql.DB) error

Migrate executes database migrations. nolint: errcheck

func NewConnectionPool added in v0.21.0

func NewConnectionPool(dsn string, minConnections, maxConnections int, connectionLifetime time.Duration) (*sql.DB, error)

NewConnectionPool configures the database connection pool.

func Open

func Open(opts *config.Options, path string) (*bolt.DB, error)

Open open a bolt database on current directory in given path. It is the caller's responsibility to close it.

Types

type Storage

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

Storage handles all operations related to the database.

func NewStorage added in v0.21.0

func NewStorage(ds *sql.DB, db *bolt.DB) *Storage

NewStorage returns a new Storage. It is the caller's responsibility to close it.

func (*Storage) Close

func (s *Storage) Close() (err error)

Close the bolt database

func (*Storage) CreatePlayback

func (s *Storage) CreatePlayback(pb *entity.Playback) error

CreatePlayback creates a playback callback data.

func (*Storage) CreateWayback added in v0.21.0

func (s *Storage) CreateWayback(ctx context.Context, cols []wayback.Collect) error

func (*Storage) Ping added in v0.21.0

func (s *Storage) Ping() error

Ping checks if the database connection works.

func (*Storage) Playback

func (s *Storage) Playback(id uint64) (*entity.Playback, error)

Playback returns playback data of the given id.

func (*Storage) RemovePlayback

func (s *Storage) RemovePlayback(id uint64) error

RemovePlayback removes a playback callback entry by id.

Jump to

Keyboard shortcuts

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