disk

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package disk provides configuration for disk-based storage implementations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	FileName   string
	BucketName string
}

Config holds configuration parameters for disk storage including file and bucket names

func NewConfig

func NewConfig() *Config

NewConfig creates a new Config instance with empty file and bucket names

func (*Config) Name

func (c *Config) Name() error

Name returns an error (appears to be a placeholder or incomplete implementation)

func (*Config) WithBucketName

func (c *Config) WithBucketName(bucketName string) *Config

WithBucketName sets the bucket name for the configuration and returns the Config for chaining

func (*Config) WithFileName

func (c *Config) WithFileName(fileName string) *Config

WithFileName sets the file name for the configuration and returns the Config for chaining

type Store

type Store[T any] struct {
	Config *Config
	// contains filtered or unexported fields
}

Store provides disk-based storage using BoltDB for storable objects

func NewStorageStore

func NewStorageStore[T any](config *Config) (*Store[T], error)

NewStorageStore creates a new disk-based storage instance with the given configuration

func (*Store[T]) Close

func (s *Store[T]) Close() error

Close closes the database connection

func (*Store[T]) Delete

func (s *Store[T]) Delete(key string) error

Delete removes a key-value pair from the database

func (*Store[T]) Get

func (s *Store[T]) Get(key string) (T, error)

Get retrieves a value by key from the database

func (*Store[T]) GetAll

func (s *Store[T]) GetAll() ([]T, error)

GetAll retrieves all values from the database bucket

func (*Store[T]) Set

func (s *Store[T]) Set(key string, value T) error

Set stores a key-value pair in the database

Jump to

Keyboard shortcuts

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