cellar

package module
v0.0.0-...-dfdfd72 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = fmt.Errorf("missing record")

ErrNotFound is the error returned when attempting to load a record that does not exist.

Functions

func NewSommelier

func NewSommelier(logger *log.Logger) sommelier.Service

NewSommelier returns the sommelier service implementation.

func NewStorage

func NewStorage(db *bolt.DB, logger *log.Logger) (storage.Service, error)

NewStorage returns the storage service implementation.

func NewSwagger

func NewSwagger(logger *log.Logger) swagger.Service

NewSwagger returns the swagger service implementation.

func StorageMultiAddDecoderFunc

func StorageMultiAddDecoderFunc(mr *multipart.Reader, p *[]*storage.Bottle) error

StorageMultiAddDecoderFunc implements the multipart decoder for service "storage" endpoint "multi_add". The decoder must populate the argument p after encoding.

func StorageMultiAddEncoderFunc

func StorageMultiAddEncoderFunc(mw *multipart.Writer, p []*storage.Bottle) error

StorageMultiAddEncoderFunc implements the multipart encoder for service "storage" endpoint "multi_add".

func StorageMultiUpdateDecoderFunc

func StorageMultiUpdateDecoderFunc(mr *multipart.Reader, p **storage.MultiUpdatePayload) error

StorageMultiUpdateDecoderFunc implements the multipart decoder for service "storage" endpoint "multi_update". The decoder must populate the argument p after encoding.

func StorageMultiUpdateEncoderFunc

func StorageMultiUpdateEncoderFunc(mw *multipart.Writer, p *storage.MultiUpdatePayload) error

StorageMultiUpdateEncoderFunc implements the multipart encoder for service "storage" endpoint "multi_update".

Types

type Bolt

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

Bolt is the database driver.

func NewBoltDB

func NewBoltDB(client *bolt.DB) (*Bolt, error)

NewBoltDB creates a Bolt DB database driver given an underlying client.

func (*Bolt) Delete

func (b *Bolt) Delete(bucket, id string) error

Delete deletes a record by ID.

func (*Bolt) Load

func (b *Bolt) Load(bucket, id string, data interface{}) error

Load reads a record by ID. data is unmarshaled into and should hold a pointer.

func (*Bolt) LoadAll

func (b *Bolt) LoadAll(bucket string, data interface{}) error

LoadAll returns all the records in the given bucket. data should be a pointer to a slice. Don't do this in a real service :-)

func (*Bolt) NewID

func (b *Bolt) NewID(bucket string) (string, error)

NewID returns a unique ID for the given bucket.

func (*Bolt) Save

func (b *Bolt) Save(bucket, id string, data interface{}) error

Save writes the record to the DB and returns the corresponding new ID. data must contain a value that can be marshaled by the encoding/json package.

Jump to

Keyboard shortcuts

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