Documentation ¶
Index ¶
- Constants
- type Bucket
- type DB
- func (db *DB) Bucket(names ...string) Bucket
- func (db *DB) Close() error
- func (db *DB) CreateBucket(names ...string) (Bucket, error)
- func (db *DB) Export(w io.Writer, exclude ...string) error
- func (db *DB) ExportFile(fn string, exclude ...string) error
- func (db *DB) Group(mws ...mw.Middleware) Bucket
- func (db *DB) Import(r io.Reader) error
- type MiddlewareError
- type Options
- type Reader
- type ReaderFn
Constants ¶
View Source
const ( // ErrNoReaders is returned when a reader is requested, but none are available ErrNoReaders = oerrs.String("no readers available") // ErrClosing is returned when an action is performed while a database is shutting down ErrClosing = oerrs.String("database is shutting down") // ErrInvalidBucketType is returned when an invalid bucket type is provided ErrInvalidBucketType = oerrs.String("invalid bucket type") // ErrKeyExists is returned when the key exists for a write action with overwrite set to false ErrKeyExists = oerrs.String("key already exists") // ErrSamePath is returned when the same path is used for a bucket ErrSamePath = oerrs.String("same path") )
View Source
const ErrFileDoesNotExist = oerrs.String("file does not exist")
ErrFileDoesNotExist is returned when a file does not exist
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket interface { Append(key string, r io.Reader, middlewares ...mw.Middleware) (err error) AppendFunc(key string, fn func(w io.Writer) error, middlewares ...mw.Middleware) (err error) Bucket(names ...string) Bucket Buckets(rev bool) (out []string) CreateBucket(names ...string) (Bucket, error) Delete(key string) (err error) Rename(key string, nBkt Bucket, nKey string) (err error) DeleteBucket(name string) (err error) ForEach(fn func(key string, value io.Reader) error, middlewares ...mw.Middleware) error ForEachReverse(fn func(key string, value io.Reader) error, middlewares ...mw.Middleware) error Get(key string, middlewares ...mw.Middleware) (_ io.ReadCloser, err error) GetAndDelete(key string, fn func(r io.Reader) error, middlewares ...mw.Middleware) (err error) GetAndRename(key string, nBkt Bucket, nKey string, overwrite bool, fn ReaderFn, mws ...mw.Middleware) (err error) Group(mws ...mw.Middleware) Bucket Keys(reverse bool) (out []string) Name() string NextID() *big.Int Path() string Put(key string, r io.Reader, middlewares ...mw.Middleware) (err error) PutFunc(key string, fn func(w io.Writer) error, middlewares ...mw.Middleware) (err error) PutTimed(key string, r io.Reader, expireAfter time.Duration, middlewares ...mw.Middleware) (err error) PutTimedFunc(key string, fn func(w io.Writer) error, expireAfter time.Duration, middlewares ...mw.Middleware) (err error) Import(r io.Reader) (err error) Export(w io.Writer, exclude ...string) (err error) Stat(key string) (fi os.FileInfo, err error) SetExtraData(fileKey, key string, val string) error GetExtraData(fileKey, key string) (out string) ExtraData(fileKey string) (out map[string]string) AllExtraData() (out map[string]map[string]string) }
Bucket is the interface for Bucket-like containers (buckets and groups)
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) ExportFile ¶
ExportFile exports the entire database to a tar file. If the file has the gz suffix, it will be automatically compressed.
type MiddlewareError ¶
type MiddlewareError struct { Mw mw.Middleware Err error }
MiddlewareError represents an error that happened in a middleware
func (*MiddlewareError) Error ¶
func (wr *MiddlewareError) Error() string
type Options ¶
type Options struct { Middleware []mw.Middleware PlainFileNames bool }
Options allows a bit of customization for iodb.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.