storage

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2019 License: GPL-3.0, GPL-3.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AESEncryptedStorage

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

AESEncryptedStorage is a storage type which is backed by a json-faile. The json-file contains key-value mappings, where the keys are _not_ encrypted, only the values are.

func NewAESEncryptedStorage

func NewAESEncryptedStorage(filename string, key []byte) *AESEncryptedStorage

NewAESEncryptedStorage creates a new encrypted storage backed by the given file/key

func (*AESEncryptedStorage) Get

func (s *AESEncryptedStorage) Get(key string) string

Get returns the previously stored value, or the empty string if it does not exist or key is of 0-length

func (*AESEncryptedStorage) Put

func (s *AESEncryptedStorage) Put(key, value string)

Put stores a value by key. 0-length keys results in no-op

type EphemeralStorage

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

EphemeralStorage is an in-memory storage that does not persist values to disk. Mainly used for testing

func (*EphemeralStorage) Get

func (s *EphemeralStorage) Get(key string) string

func (*EphemeralStorage) Put

func (s *EphemeralStorage) Put(key, value string)

type Storage

type Storage interface {
	// Put stores a value by key. 0-length keys results in no-op
	Put(key, value string)
	// Get returns the previously stored value, or the empty string if it does not exist or key is of 0-length
	Get(key string) string
}

func NewEphemeralStorage

func NewEphemeralStorage() Storage

Jump to

Keyboard shortcuts

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