Documentation ¶
Index ¶
- Constants
- Variables
- func CheckExists(b Bucket, key []byte) func(*bolt.Tx) error
- func CheckNotExist(b Bucket, key []byte) func(*bolt.Tx) error
- func Delete(b Bucket, key []byte) func(*bolt.Tx) error
- func Error(err error) func(*bolt.Tx) error
- func Errorf(fmt string, vs ...interface{}) func(*bolt.Tx) error
- func ForEach(b Bucket, f func(k, v []byte) error) func(tx *bolt.Tx) error
- func Get(b Bucket, key []byte) func(*bolt.Tx) ([]byte, error)
- func GetNestedBucket(b *bolt.Bucket, buckets ...Bucket) (*bolt.Bucket, error)
- func IsExists(err error) bool
- func IsMissing(err error) bool
- func IsMissingBucket(err error) bool
- func Itob(v int) []byte
- func MakeNestedBucket(b *bolt.Bucket, buckets ...Bucket) (*bolt.Bucket, error)
- func Marshal(b Bucket, from interface{}, key []byte) func(*bolt.Tx) error
- func Migrate(v Version) func(*bolt.Tx) error
- func MigrateFrom(tx *bolt.Tx, from, to Version) error
- func Prep(buckets ...Bucket) func(*bolt.Tx) error
- func Put(b Bucket, key, val []byte) func(*bolt.Tx) error
- func PutV(v Version) func(*bolt.Tx) error
- func SetupBuckets(buckets ...Bucket) func(*bolt.Tx) error
- func Unmarshal(b Bucket, to interface{}, key []byte) func(*bolt.Tx) error
- func Wrap(apps ...func(*bolt.Tx) error) func(*bolt.Tx) error
- type Bucket
- type Deleter
- type Deleters
- type ErrMissingBucket
- type ExistsError
- type ID
- type KeyError
- type LoadStoreDeleter
- type LoadStorer
- type Loader
- type Loaders
- type MissingError
- type Mutation
- type Resource
- type ResourceBox
- type Resourcer
- type Storer
- type Storers
- type Version
- type View
Constants ¶
const ( Ver001 = Version("0.0.1") VerAlpha001_2 = Version("0.0.1-alpha-2") VerNone = Version("") VerCurrent = Ver001 )
Variables ¶
var (
VersionBucket = []byte("version")
)
Functions ¶
func GetNestedBucket ¶
GetNestedBucket attempts to get the nested Bucket from the given Bucket, returning an error if it is missing.
func IsMissingBucket ¶
func MakeNestedBucket ¶
MakeNestedBucket creates the given Buckets on the given Bucket if they do not exist, returning any error, or the innermost nested Bucket.
Types ¶
type Bucket ¶
type Bucket []byte
Bucket is an identifier for a package constant to define the BoltDB bucket where a resource is stored.
TODO: nested Buckets?
type ErrMissingBucket ¶
type ErrMissingBucket []byte
func (ErrMissingBucket) Error ¶
func (e ErrMissingBucket) Error() string
type ExistsError ¶
type ExistsError KeyError
func (ExistsError) Error ¶
func (e ExistsError) Error() string
type ID ¶
ID is a JSON-serializable UUID.
func (ID) HashWith ¶
HashWith returns a V5 UUID (defined as the SHA-1 of the given ID and the given input string) as an ID.
func (ID) MarshalJSON ¶
MarshalJSON implements json.Marshalder on ID.
func (*ID) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler on ID.
type LoadStoreDeleter ¶
type LoadStorer ¶
LoadStorer is composed of a Loader and a Storer.
type Loader ¶
Loader is a reference to an entity in the DB which can be Loaded into the given argument. This would typically be implemented using an ID. Consider it equivalent to a reference type, where the "address" is a databased entity. The *bolt.Tx may be a Read or a Write transaction.
type MissingError ¶
type MissingError KeyError
func (MissingError) Error ¶
func (m MissingError) Error() string
type Resource ¶
type Resource string
Resource can be used for package constants, etc. to name a resource.
type ResourceBox ¶
type ResourceBox struct { Name Resource `json:"name"` Contents interface{} `json:"contents"` }
ResourceBox is a container for the bytes and type of some encoded Resource.
type Resourcer ¶
type Resourcer interface {
Resource() Resource
}
Resourcer is something which has a Resource.
type Storer ¶
Storer is an entity which can store its representation using a bolt Write transaction. Typically this should be implemented by an ID. A reference type should be passed so that Store can set its ID.