key

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SelectorChar = '*'
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Converter

type Converter interface {
	Convert(key string) string
}

handles the conversion of keys, queries and key to satisfiable formats for the repository

type ConverterPipeline

type ConverterPipeline struct {
	Hooks []func(string) string
}

implements Converter converts key in steps, in a pipeline manner

func NewConverterPipeline

func NewConverterPipeline() *ConverterPipeline

func (*ConverterPipeline) AddHook

func (p *ConverterPipeline) AddHook(hooks ...func(string) string) *ConverterPipeline

func (*ConverterPipeline) Convert

func (p *ConverterPipeline) Convert(pattern string) string

type ErrKeyAlreadyExists

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

error that is returned from the repository when a key already exists in the repository

func NewErrKeyAlreadyExist

func NewErrKeyAlreadyExist(key Key) *ErrKeyAlreadyExists

func (*ErrKeyAlreadyExists) Error

func (e *ErrKeyAlreadyExists) Error() string

type ErrKeyNotFound

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

error that is returned from the repository when a key is required and is not found

func NewErrKeyNotFound

func NewErrKeyNotFound(key Key) *ErrKeyNotFound

func (*ErrKeyNotFound) Error

func (e *ErrKeyNotFound) Error() string

type ErrSelectorKeyNotAllowed

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

error that is returned from the repository when a selector key cannot be accepted as input

func NewErrSelectorKeyNotAllowed

func NewErrSelectorKeyNotAllowed(key Key) *ErrSelectorKeyNotAllowed

func (*ErrSelectorKeyNotAllowed) Error

func (e *ErrSelectorKeyNotAllowed) Error() string

type Key

type Key string

func New

func New(pattern string, converter Converter, validator Validator) *Key

func (*Key) IsRaw

func (k *Key) IsRaw() bool

func (*Key) IsSelector

func (k *Key) IsSelector() bool

func (*Key) Size

func (k *Key) Size() int

type Validator

type Validator interface {
	Validate(pattern string) error
}

validates the Pattern of keys

type ValidatorPipeline

type ValidatorPipeline struct {
	Hooks []func(string) error
}

implements Validator validates keys in steps, in a pipeline manner

func NewValidatorPipeline

func NewValidatorPipeline() *ValidatorPipeline

func (*ValidatorPipeline) AddHook

func (v *ValidatorPipeline) AddHook(hooks ...func(string) error) *ValidatorPipeline

func (*ValidatorPipeline) Validate

func (v *ValidatorPipeline) Validate(pattern string) error

Jump to

Keyboard shortcuts

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