database

package
v0.0.0-...-e82adf8 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2017 License: MIT Imports: 4 Imported by: 10

Documentation

Index

Constants

View Source
const (
	CardinalityOne  = 35
	CardinalityMany = 36
)

Variables

Functions

func FilterAvetAndVaet

func FilterAvetAndVaet(db *Db, datoms []index.Datom) ([]index.Datom, []index.Datom)

FilterAvetAndVaet returns the datoms that need to be placed in the avet and vaet indexes, respectively.

TODO: It needs a better name

Types

type AevtIndex

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

func (AevtIndex) Datoms

func (i AevtIndex) Datoms() index.Iterator

func (AevtIndex) Datoms2

func (i AevtIndex) Datoms2(attribute HasLookup, entity HasLookup, value interface{}) index.Iterator

func (AevtIndex) DatomsAt

func (i AevtIndex) DatomsAt(start, end index.Datom) index.Iterator

func (AevtIndex) SeekDatoms

func (i AevtIndex) SeekDatoms(start index.Datom) index.Iterator

type Attribute

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

func (Attribute) Cardinality

func (a Attribute) Cardinality() Cardinality

func (Attribute) Id

func (a Attribute) Id() int

func (Attribute) Ident

func (a Attribute) Ident() fressian.Keyword

func (Attribute) Indexed

func (a Attribute) Indexed() bool

func (Attribute) NoHistory

func (a Attribute) NoHistory() bool

func (Attribute) Type

func (a Attribute) Type() index.ValueType

func (Attribute) Unique

func (a Attribute) Unique() Unique

type AvetIndex

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

func (AvetIndex) Datoms

func (i AvetIndex) Datoms() index.Iterator

func (AvetIndex) Datoms2

func (i AvetIndex) Datoms2(attribute HasLookup, value interface{}, entity HasLookup) index.Iterator

func (AvetIndex) DatomsAt

func (i AvetIndex) DatomsAt(start, end index.Datom) index.Iterator

func (AvetIndex) SeekDatoms

func (i AvetIndex) SeekDatoms(start index.Datom) index.Iterator

type Cardinality

type Cardinality int

func (Cardinality) IsValid

func (c Cardinality) IsValid() bool

func (Cardinality) String

func (c Cardinality) String() string

type Db

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

func New

func New(eavt, aevt, avet, vaet *index.MergedIndex) *Db

func NewInMemory

func NewInMemory(eavt, aevt, avet, vaet *index.MemoryIndex) *Db

func (*Db) Aevt

func (db *Db) Aevt() AevtIndex

func (*Db) AsOf

func (db *Db) AsOf(t int) *Db

func (*Db) AsOfT

func (db *Db) AsOfT() int

func (*Db) AsOfTime

func (db *Db) AsOfTime(t time.Time) *Db

func (*Db) Attribute

func (db *Db) Attribute(id int) *Attribute

func (*Db) Avet

func (db *Db) Avet() AvetIndex

func (*Db) BasisT

func (db *Db) BasisT() int

func (*Db) Eavt

func (db *Db) Eavt() EavtIndex

func (*Db) Entid

func (db *Db) Entid(lookup HasLookup) int

func (*Db) EntidAt

func (db *Db) EntidAt(part HasLookup, t int) int

func (*Db) EntidAtTime

func (db *Db) EntidAtTime(part HasLookup, t time.Time) int

func (*Db) Entity

func (db *Db) Entity(id int) Entity

Entity constructs a lazy, cached "view" of all datoms with a given entity id.

func (*Db) Filter

func (db *Db) Filter(filter Filter) *Db

func (*Db) History

func (db *Db) History() *Db

func (*Db) Ident

func (db *Db) Ident(entity int) *Keyword

func (*Db) IsFiltered

func (db *Db) IsFiltered() bool

func (*Db) NextT

func (db *Db) NextT() int

func (*Db) Search

func (db *Db) Search(pattern Pattern) index.Iterator

func (*Db) Since

func (db *Db) Since(t int) *Db

func (*Db) SinceT

func (db *Db) SinceT() int

func (*Db) SinceTime

func (db *Db) SinceTime(t time.Time) *Db

func (*Db) Vaet

func (db *Db) Vaet() VaetIndex

func (*Db) WithDatoms

func (db *Db) WithDatoms(datoms []index.Datom) *Db

func (*Db) WithDatomsT

func (db *Db) WithDatomsT(basisT, nextT int, datoms []index.Datom) *Db

type EavtIndex

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

func (EavtIndex) Datoms

func (i EavtIndex) Datoms() index.Iterator

func (EavtIndex) Datoms2

func (i EavtIndex) Datoms2(entity HasLookup, attribute HasLookup, value interface{}) index.Iterator

func (EavtIndex) DatomsAt

func (i EavtIndex) DatomsAt(start, end index.Datom) index.Iterator

func (EavtIndex) SeekDatoms

func (i EavtIndex) SeekDatoms(start index.Datom) index.Iterator

type Entity

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

func (Entity) AsMap

func (e Entity) AsMap() map[Keyword]interface{}

AsMap returns a view of this entity as a map.

The returned map will only contain cached attributes. To get a map of all attributes call `.Touch` first.

func (Entity) Datoms

func (e Entity) Datoms() index.Iterator

Datoms returns an iterator over all datoms for this entity.

func (Entity) Get

func (e Entity) Get(key Keyword) interface{}

Get retrieves the value for the attribute.

The resulting value is cached. If no value is found, `nil` is returned.

func (Entity) Keys

func (e Entity) Keys() []Keyword

Keys returns a slice of all attributes of this entity.

func (Entity) Touch

func (e Entity) Touch()

Touch caches all attributes of this entity.

type Filter

type Filter func(db *Db, datom *index.Datom) bool

type HasLookup

type HasLookup interface {
	Lookup(db *Db) (int, error)
}

type Id

type Id int

func (Id) Lookup

func (dbId Id) Lookup(db *Db) (int, error)

type Keyword

type Keyword struct {
	fressian.Keyword
}

func (Keyword) Lookup

func (kw Keyword) Lookup(db *Db) (int, error)

type LookupRef

type LookupRef struct {
	Attribute Keyword
	Value     index.Value
}

func (LookupRef) Lookup

func (ref LookupRef) Lookup(db *Db) (int, error)

type Pattern

type Pattern struct {
	E     HasLookup
	A     HasLookup
	V     interface{}
	Tx    HasLookup
	Added *bool
}

type Unique

type Unique int
const (
	UniqueNil      Unique = 0
	UniqueValue    Unique = 37
	UniqueIdentity Unique = 38
)

func (Unique) IsValid

func (u Unique) IsValid() bool

func (Unique) String

func (u Unique) String() string

type VaetIndex

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

func (VaetIndex) Datoms

func (i VaetIndex) Datoms() index.Iterator

func (VaetIndex) Datoms2

func (i VaetIndex) Datoms2(value HasLookup, attribute HasLookup, entity HasLookup) index.Iterator

func (VaetIndex) DatomsAt

func (i VaetIndex) DatomsAt(start, end index.Datom) index.Iterator

func (VaetIndex) SeekDatoms

func (i VaetIndex) SeekDatoms(start index.Datom) index.Iterator

Jump to

Keyboard shortcuts

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