filestore

package
v0.0.0-...-157c9c8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrBktExists is returned when attempting to Put to key that defines a
	// bucket.
	ErrBktExists = lerr.Str("Bucket already exists at that key")

	// ErrValExists is returned when attempting to create a Store with a key
	// that defines a value.
	ErrValExists = lerr.Str("Value already exists at that key")
)

Variables

This section is empty.

Functions

func DecoderCast

func DecoderCast(name string) []byte

func DecoderRemoveExt

func DecoderRemoveExt(name string) []byte

func EncoderCast

func EncoderCast(b []byte) string

func NewFactory

func NewFactory(encoder, bktEncoder Encoder, decoder, bktDecoder Decoder) store.Factory

NewFactory creates a factory with the given encoders and decoders. If bktEncoder is nil, encoder will be used. If encoder is nil, EncoderCast is used. If bktDecoder is nil, decoder is used. If decoder is nil, DecoderCast is used.

Types

type Decoder

type Decoder func(string) []byte

Decoder is used to convert a directory or file path to a key.

type Encoder

type Encoder func([]byte) string

Encoder is used to convert []byte to string for directory and file paths.

func EncoderExt

func EncoderExt(ext string) Encoder

func EncoderMany

func EncoderMany(es ...Encoder) Encoder

func EncoderReplacer

func EncoderReplacer(oldnew ...string) Encoder

Jump to

Keyboard shortcuts

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