func (s *DB) All(to interface{}, options ...func(*index.Options)) error {
	return s.root.All(to, options...)
}
All get all the records of a bucket
package storm
import (
	"bytes"
	"encoding/binary"
	"os"
	"time"
	"github.com/asdine/storm/codec"
	"github.com/asdine/storm/codec/json"
	"github.com/asdine/storm/index"
	"github.com/asdine/storm/q"
	"github.com/boltdb/bolt"
)
const (
	dbinfo         = "__storm_db"
	metadataBucket = "__storm_metadata"
)
var defaultCodec = json.Codec
func Open(path string, stormOptions ...func(*DB) error) (*DB, error) {
	var err error
	s := &DB{
		Path:  path,
		codec: defaultCodec,
	}
	for _, option := range stormOptions {
		if err = option(s); err != nil {
			return nil, err
		}
	}
	if s.boltMode == 0 {
		s.boltMode = 0600
	}
	if s.boltOptions == nil {
		s.boltOptions = &bolt.Options{Timeout: 1 * time.Second}
	}
	s.root = &node{s: s, rootBucket: s.rootBucket, codec: s.codec, batchMode: s.batchMode}
	if s.Bolt == nil {
		s.Bolt, err = bolt.Open(path, s.boltMode, s.boltOptions)
		if err != nil {
			return nil, err
		}
		err = s.checkVersion()
		if err != nil {
			return nil, err
		}
	}
	return s, nil
}
type DB struct {
	Path string
	codec codec.MarshalUnmarshaler
	Bolt *bolt.DB
	boltMode os.FileMode
	boltOptions *bolt.Options
	autoIncrement bool
	root *node
	rootBucket []string
	batchMode bool
}
func (s *DB) From(root ...string) Node {
	newNode := *s.root
	newNode.rootBucket = root
	return &newNode
}
func (s *DB) WithTransaction(tx *bolt.Tx) Node {
	return s.root.WithTransaction(tx)
}
func (s *DB) Bucket() []string {
	return s.root.Bucket()
}
func (s *DB) Close() error {
	return s.Bolt.Close()
}
func (s *DB) Codec() codec.MarshalUnmarshaler {
	return s.codec
}
func (s *DB) WithCodec(codec codec.MarshalUnmarshaler) Node {
	n := s.From().(*node)
	n.codec = codec
	return n
}
func (s *DB) WithBatch(enabled bool) Node {
	n := s.From().(*node)
	n.batchMode = enabled
	return n
}
func (s *DB) Get(bucketName string, key interface{}, to interface{}) error {
	return s.root.Get(bucketName, key, to)
}
func (s *DB) Set(bucketName string, key interface{}, value interface{}) error {
	return s.root.Set(bucketName, key, value)
}
func (s *DB) Delete(bucketName string, key interface{}) error {
	return s.root.Delete(bucketName, key)
}
func (s *DB) GetBytes(bucketName string, key interface{}) ([]byte, error) {
	return s.root.GetBytes(bucketName, key)
}
func (s *DB) SetBytes(bucketName string, key interface{}, value []byte) error {
	return s.root.SetBytes(bucketName, key, value)
}
func (s *DB) Save(data interface{}) error {
	return s.root.Save(data)
}
func (s *DB) PrefixScan(prefix string) []Node {
	return s.root.PrefixScan(prefix)
}
func (s *DB) RangeScan(min, max string) []Node {
	return s.root.RangeScan(min, max)
}
func (s *DB) Select(matchers ...q.Matcher) Query {
	return s.root.Select(matchers...)
}
func (s *DB) Range(fieldName string, min, max, to interface{}, options ...func(*index.Options)) error {
	return s.root.Range(fieldName, min, max, to, options...)
}
func (s *DB) AllByIndex(fieldName string, to interface{}, options ...func(*index.Options)) error {
	return s.root.AllByIndex(fieldName, to, options...)
}