storage

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AESEncryptor

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

AESEncryptor implements AES-GCM encryption

func NewAESEncryptor

func NewAESEncryptor(key []byte) (*AESEncryptor, error)

func (*AESEncryptor) Decrypt

func (e *AESEncryptor) Decrypt(ciphertext []byte) ([]byte, error)

func (*AESEncryptor) Encrypt

func (e *AESEncryptor) Encrypt(plaintext []byte) ([]byte, error)

type DBStorage

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

DBStorage implements SQL database storage

func NewDBStorage

func NewDBStorage(driverName, dataSourceName, tableName string) (*DBStorage, error)

func (*DBStorage) Close

func (ds *DBStorage) Close() error

func (*DBStorage) Delete

func (ds *DBStorage) Delete(key string) error

func (*DBStorage) Exists

func (ds *DBStorage) Exists(key string) (bool, error)

func (*DBStorage) Load

func (ds *DBStorage) Load(key string) ([]byte, error)

func (*DBStorage) Save

func (ds *DBStorage) Save(key string, data []byte) error

type Encryptor

type Encryptor interface {
	Encrypt(plaintext []byte) ([]byte, error)
	Decrypt(ciphertext []byte) ([]byte, error)
}

Encryptor handles data encryption/decryption

type FileStorage

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

FileStorage implements local file storage

func NewFileStorage

func NewFileStorage(basePath string) (*FileStorage, error)

func (*FileStorage) Delete

func (fs *FileStorage) Delete(key string) error

func (*FileStorage) Exists

func (fs *FileStorage) Exists(key string) (bool, error)

func (*FileStorage) Load

func (fs *FileStorage) Load(key string) ([]byte, error)

func (*FileStorage) Save

func (fs *FileStorage) Save(key string, data []byte) error

type MongoStorage

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

MongoStorage implements MongoDB storage

func NewMongoStorage

func NewMongoStorage(uri, database, collection string) (*MongoStorage, error)

func (*MongoStorage) Delete

func (ms *MongoStorage) Delete(key string) error

func (*MongoStorage) Exists

func (ms *MongoStorage) Exists(key string) (bool, error)

func (*MongoStorage) Load

func (ms *MongoStorage) Load(key string) ([]byte, error)

func (*MongoStorage) Save

func (ms *MongoStorage) Save(key string, data []byte) error

type S3Storage

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

S3Storage implements S3-compatible storage

func NewS3Storage

func NewS3Storage(bucket, region string) (*S3Storage, error)

func (*S3Storage) Delete

func (s *S3Storage) Delete(key string) error

func (*S3Storage) Exists

func (s *S3Storage) Exists(key string) (bool, error)

func (*S3Storage) Load

func (s *S3Storage) Load(key string) ([]byte, error)

func (*S3Storage) Save

func (s *S3Storage) Save(key string, data []byte) error

type Storage

type Storage interface {
	Load(key string) ([]byte, error)
	Save(key string, data []byte) error
	Delete(key string) error
	Exists(key string) (bool, error)
}

Storage interface for different storage backends

type StorageManager

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

StorageManager

func NewStorageManager

func NewStorageManager(storage Storage, encryptor Encryptor) *StorageManager

func (*StorageManager) Delete

func (sm *StorageManager) Delete(key string) error

func (*StorageManager) Exists

func (sm *StorageManager) Exists(key string) (bool, error)

func (*StorageManager) Load

func (sm *StorageManager) Load(key string) ([]byte, error)

func (*StorageManager) Save

func (sm *StorageManager) Save(key string, data []byte) error

Jump to

Keyboard shortcuts

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