kvdb

package
v0.0.0-...-f456d84 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBadRequestError

func IsBadRequestError(err error) bool

IsBadRequestError returns true if the error, or any of the wrapped errors is of type BadRequestError

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError returns true if the error, or any of the wrapped errors is of type BadRequestError

func NewBadRequestError

func NewBadRequestError(message string) error

NewBadRequestError returns a new BadRequestError given an error message

func NewNotFoundError

func NewNotFoundError(missingKey string) error

NewNotFoundError returns a new error for the missing key

Types

type BadRequestError

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

BadRequestError represents an error by the consumer of the database

func (*BadRequestError) Error

func (b *BadRequestError) Error() string

type NotFoundError

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

NotFoundError indicates that no value was found for the given key

func (*NotFoundError) Error

func (n *NotFoundError) Error() string

type Store

type Store interface {
	// Get returns the value for the given key or any error encountered. If the
	// key was not found it will return a NotFoundError.
	Get(key string) ([]byte, error)
	// Put stores the value. It will return an BadRequestError if the provided
	// data was invalid or any other error encountered.
	Put(key string, value []byte) error
	// Delete deletes the value for the given key
	Delete(key string) error
	// Close closes the database and returns when all internal processes
	// has stopped. It returns any error encountered.
	Close() error
	// Returns true if the error signals that the given key was not found.
	IsNotFoundError(err error) bool
	// Returns true if the error signals that the consumer did something wrong.
	IsBadRequestError(err error) bool
}

Store defines the kvdb public interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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