Documentation
¶
Overview ¶
Package mu provides the user-facing api for the mu database.
Index ¶
- Constants
- func A(attribute database.Keyword) pattern.Pattern
- func Ae(attribute database.Keyword, entity database.HasLookup) pattern.Pattern
- func Aev(attribute database.Keyword, entity database.HasLookup, value interface{}) pattern.Pattern
- func Attribute(namespace, name string) database.Keyword
- func Connect(rawUrl string) (connection.Connection, error)
- func CreateDatabase(rawUrl string) (bool, error)
- func Datoms(db *database.Db, p pattern.Pattern) (index.Iterator, error)
- func DatomsString(db *database.Db, patternEDN string) (index.Iterator, error)
- func Datums(datoms ...transactor.TxDatum) []transactor.TxDatum
- func E(entity database.HasLookup) pattern.Pattern
- func Ea(entity database.HasLookup, attribute database.Keyword) pattern.Pattern
- func Eav(entity database.HasLookup, attribute database.Keyword, value interface{}) pattern.Pattern
- func Id(id int) database.Id
- func Keyword(namespace, name string) database.Keyword
- func LookupRef(attribute database.Keyword, value interface{}) database.LookupRef
- func NewDatom(entity int, attribute int, value interface{}) index.Datom
- func NewDatum(entity database.HasLookup, attribute database.HasLookup, value interface{}) transactor.Datum
- func NewDatumRaw(entity int, attribute int, value interface{}) transactor.Datum
- func Part(id int) int
- func PartEnd(part int) int
- func PartStart(part int) int
- func Q(q interface{}, inputs ...interface{}) (map[query.Indexed]bool, error)
- func QString(queryEDN string, inputs ...interface{}) (map[query.Indexed]bool, error)
- func Retraction(datom index.Datom) transactor.Datum
- func Tempid(part, id int) int
- func Transact(conn connection.Connection, txData []transactor.TxDatum) (*transactor.TxResult, error)
- func TransactString(conn connection.Connection, txDataEDN string) (*transactor.TxResult, error)
- func With(db *database.Db, txData []transactor.TxDatum) (*database.Db, error)
Constants ¶
const ( DbIdent = 10 // :db/ident DbCardinality = 41 // :db/cardinality DbCardinalityOne = 35 // :db.cardinality/one DbType = 40 // :db/valueType DbTypeString = 23 // :db.type/string DbPartDb = 0 // :db.part/db DbPartTx = 3 // :db.part/tx DbPartUser = 4 // :db.part/user )
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
func Connect(rawUrl string) (connection.Connection, error)
Connect connects to the database specified at the location given by the url.
The following formats are supported:
- memory://<path>?name=<name> Connects to an in-memory database with the given name.
- files://<path-to-dir>?name=<name> Connects to an on-disk database in the directory with the given name. A single directory may contain multiple databases with different names.
- file://<path-to-file> Connects to a single-file database. This database will not support the future history api, only the log.
- backup://<path-to-backup>[?root=<t>] Connects to a datomic backup, with an optional root if the directory contains multiple backups.
func CreateDatabase ¶
CreateDatabase creates a new database at the location given by the url.
It returns true if a new database was created and false if it already existed.
func DatomsString ¶
DatomsString parses a pattern from the string and returns an iterator.
The pattern must be a string in EDN format of the form [e a v], where e, a and v may be variables or values.
See Datoms for details.
func Datums ¶
func Datums(datoms ...transactor.TxDatum) []transactor.TxDatum
func NewDatumRaw ¶
func NewDatumRaw(entity int, attribute int, value interface{}) transactor.Datum
func Retraction ¶
func Retraction(datom index.Datom) transactor.Datum
func Transact ¶
func Transact(conn connection.Connection, txData []transactor.TxDatum) (*transactor.TxResult, error)
Transact adds the datoms given by the txData to the connection.
The result contains a reference to the database before and after the transaction, the datoms that were transacted and a map from tempids to the assigned ids.
func TransactString ¶
func TransactString(conn connection.Connection, txDataEDN string) (*transactor.TxResult, error)
TransactString adds the datoms given by the txData to the connection.
The txData is given as EDN data, which is parsed and converted to the format accepted by Transact.
Apart from the different input, the behavior is the same as that of Transact.
Types ¶
This section is empty.