Help us shape the future of Go! Take the 2026 Go Developer Survey

a4db

package module
v0.0.0-...-6a58527 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

README

A4DB

Paper DB

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCollectionAlreadyExists = errors.New("collection already exists")
	ErrCollectionDoesNotExist  = errors.New("no such collection")
)

Functions

This section is empty.

Types

type DB

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

func NewDB

func NewDB(folder string) (*DB, error)

func (DB) CollectionPath

func (db DB) CollectionPath(name string) string

func (*DB) CreateCollection

func (db *DB) CreateCollection(name string) error

func (*DB) DropCollection

func (db *DB) DropCollection(name string) error

func (*DB) GetCollection

func (db *DB) GetCollection(name string) (*collection, error)

func (*DB) HasCollection

func (db *DB) HasCollection(name string) bool

func (*DB) InsertObjInto

func (db *DB) InsertObjInto(collectionName string, o *Object) (objectID, error)

func (*DB) InsertObjIntoCollection

func (db *DB) InsertObjIntoCollection(c *collection, o *Object) (objectID, error)

func (*DB) InsertObjectsInto

func (db *DB) InsertObjectsInto(collectionName string, objects ...*Object) ([]objectID, error)

func (*DB) QueryCollection

func (db *DB) QueryCollection(name string) (*Query, error)

func (*DB) Stats

func (db *DB) Stats() []string

func (*DB) StatsPrint

func (db *DB) StatsPrint(w io.Writer) error

type Field

type Field struct {
	Name string
}

func (Field) Equal

func (f Field) Equal(value interface{}) condition

func (Field) Exists

func (f Field) Exists() condition

func (Field) Greater

func (f Field) Greater(value interface{}) condition

func (Field) GreaterOrEqual

func (f Field) GreaterOrEqual(value interface{}) condition

func (Field) In

func (f Field) In(values ...interface{}) condition

func (Field) LessThan

func (f Field) LessThan(value interface{}) condition

func (Field) LessThanOrEqual

func (f Field) LessThanOrEqual(value interface{}) condition

func (Field) NotEqual

func (f Field) NotEqual(value interface{}) condition

type Object

type Object map[string]interface{}

func NewObjectFromOne

func NewObjectFromOne(s interface{}) (*Object, error)

func NewObjectNil

func NewObjectNil() *Object

func NewObjectWContent

func NewObjectWContent(c map[string]interface{}) *Object

func NewObjectsFromMany

func NewObjectsFromMany(s interface{}) ([]*Object, error)

func (Object) Copy

func (o Object) Copy() *Object

func (Object) GetObjID

func (o Object) GetObjID() objectID

func (Object) GetValueForField

func (o Object) GetValueForField(name string) interface{}

TODO: add error

func (Object) HasField

func (o Object) HasField(name string) bool

func (Object) SetField

func (o Object) SetField(name string, value interface{}) error

Set maps a field to a value. Nested fields can be accessed using dot.

func (Object) Unmarshal

func (o Object) Unmarshal(v interface{}) error

Unmarshal stores the object in the value pointed by v.

func (Object) Write

func (o Object) Write(w io.Writer) error

type Objects

type Objects []*Object

func (Objects) WriteTo

func (o Objects) WriteTo(w io.Writer) error

type Query

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

func (*Query) Count

func (q *Query) Count() int

func (*Query) Delete

func (q *Query) Delete() uint

func (*Query) DeleteById

func (q *Query) DeleteById(id objectID) error

func (*Query) FindAll

func (q *Query) FindAll() Objects

func (*Query) GetObjbyID

func (q *Query) GetObjbyID(id objectID) *Object

func (*Query) Matchcondition

func (q *Query) Matchcondition(p condition) *Query

func (*Query) Update

func (q *Query) Update(updateMap map[string]interface{}) error

func (*Query) Where

func (q *Query) Where(c condition) *Query

Where returns a new Query which selects all the objects fullfilling both the base query and the provided condition.

Jump to

Keyboard shortcuts

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