Documentation ¶
Index ¶
- Variables
- type Bucket
- func (b *Bucket) Count() (int, error)
- func (b *Bucket) Get(id, val interface{}) error
- func (b *Bucket) Init() error
- func (b *Bucket) Put(val Sequencer) error
- func (b *Bucket) PutWithKey(key, val interface{}) error
- func (b *Bucket) UpdateEach(fn EachFunc) error
- func (b *Bucket) ViewEach(fn EachFunc) error
- type DB
- func (d *DB) Bucket(name string) *Bucket
- func (d *DB) Count(bucket string) (int, error)
- func (d *DB) Get(bucket string, id, val interface{}) error
- func (d *DB) Init(buckets ...string) error
- func (d *DB) Put(bucket string, val Sequencer) error
- func (d *DB) PutWithKey(bucket string, key, val interface{}) error
- func (d *DB) UpdateEach(bucket string, fn EachFunc) error
- func (d *DB) ViewEach(bucket string, fn EachFunc) error
- type EachFunc
- type GobSerializer
- type JSONSerializer
- type Options
- type Sequencer
- type Serializer
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = &Options{ Bolt: bbolt.DefaultOptions, Serializer: JSONSerializer{}, }
DefaultOptions are the default options used to init Shock
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
Bucket is a shorthand way to group a database bucket together
func (*Bucket) PutWithKey ¶ added in v0.0.3
PutWithKey adds a new value with the specified key to the bucket
func (*Bucket) UpdateEach ¶
UpdateEach iterates over each object in the bucket in write mode
type DB ¶
type DB struct { Bolt *bbolt.DB Serializer Serializer }
DB is a Shock (BBolt) database
func (*DB) PutWithKey ¶ added in v0.0.3
PutWithKey adds a new value to the bucket with a defined key
func (*DB) UpdateEach ¶
UpdateEach iterates over each object in a bucket in write mode
type GobSerializer ¶ added in v0.0.4
type GobSerializer struct{}
GobSerializer is a Serializer that uses gob
func (GobSerializer) Marshal ¶ added in v0.0.4
func (g GobSerializer) Marshal(v interface{}) ([]byte, error)
Marshal encodes an object to gob
func (GobSerializer) Unmarshal ¶ added in v0.0.4
func (g GobSerializer) Unmarshal(data []byte, v interface{}) error
Unmarshal decodes an object from gob
type JSONSerializer ¶
type JSONSerializer struct{}
JSONSerializer is a Serializer that uses JSON
func (JSONSerializer) Marshal ¶
func (j JSONSerializer) Marshal(v interface{}) ([]byte, error)
Marshal encodes an object to JSON
func (JSONSerializer) Unmarshal ¶
func (j JSONSerializer) Unmarshal(data []byte, v interface{}) error
Unmarshal decodes an object from JSON
type Options ¶
type Options struct { Bolt *bbolt.Options Serializer Serializer }
Options are Shock init options