filestorage

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(location string, hash crypto.Hash) storages.Storage

New file storage where each item stores in single file with path based on hashed key. Additionally near each file, meta file also generates

func NewDefault

func NewDefault(location string) storages.Storage

Same as NewHash but with SHA256 by default

func NewEncodedFile

func NewEncodedFile(filename string, encoderFunc EncoderFunc, decoderFunc DecoderFunc) (*encodedNamespace, error)

New single file storage with custom encoder and decoder

func NewFlat

func NewFlat(location string) storages.NamespacedStorage

func NewJSONFile

func NewJSONFile(filename string) (*encodedNamespace, error)

New single file storage with JSON encoding

Types

type DecoderFunc

type DecoderFunc func(data []byte, value interface{}) error

Decode bytes to value

type EncoderFunc

type EncoderFunc func(value interface{}) ([]byte, error)

Converter from some data to bytes

Jump to

Keyboard shortcuts

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