InProgressBuilder
open class InProgressBuilder : OptionalRustObject
This class wraps a raw pointer that points to a Rust InProgressBuilder
object.
InProgressBuilder
provides a programmatic interface to performing assertions for entities.
It provides functions for adding and retracting values for attributes for an entity within
an in progress transaction.
The transact
function will transact the assertions that have been added to the InProgressBuilder
and pass back the TxReport
that was generated by this transact and the InProgress
that was
used to perform the transact. This enables you to perform further transacts on the same InProgress
before committing.
let aEntid = txReport.entid(forTempId: "a")
let bEntid = txReport.entid(forTempId: "b")
do {
let builder = try mentat.entityBuilder()
try builder.add(entid: bEntid, keyword: ":foo/boolean", boolean: true)
try builder.add(entid: aEntid, keyword: ":foo/instant", date: newDate)
let (inProgress, report) = try builder.transact()
try inProgress.transact(transaction: "[[:db/add \(aEntid) :foo/long 22]]")
try inProgress.commit()
...
} catch {
...
}
The commit
function will transact and commit the assertions that have been added to the EntityBuilder
.
It will consume the InProgress
used to perform the transact. It returns the TxReport
generated by
the transact. After calling commit
, a new transaction must be started by calling Mentat.beginTransaction()
in order to perform further actions.
let aEntid = txReport.entid(forTempId: "a")
let bEntid = txReport.entid(forTempId: "b")
do {
let builder = try mentat.entityBuilder(forEntid: aEntid)
try builder.add(entid: bEntid, keyword: ":foo/boolean", boolean: true)
try builder.add(entid: aEntid, keyword: ":foo/instant", date: newDate)
let report = try builder.commit()
...
} catch {
...
}
-
Asserts the value of attribute
keyword
to be the providedvalue
for entityentid
.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if the attribute is not present in the schema or the attribute value type is not:db.type/long
.Declaration
Swift
open func add(entid: Entid, keyword: String, long value: Int64) throws
Parameters
entid
The
Entid
of the entity to be touched.keyword
The name of the attribute in the format
:namespace/name
.value
The value to be asserted
-
Asserts the value of attribute
keyword
to be the providedvalue
for entityentid
.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if the attribute is not present in the schema or the attribute value type is not:db.type/ref
.Parameters
entid
The
Entid
of the entity to be touched.keyword
The name of the attribute in the format
:namespace/name
.value
The value to be asserted
-
Asserts the value of attribute
keyword
to be the providedvalue
for entityentid
.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if the attribute is not present in the schema or the attribute value type is not:db.type/keyword
.Declaration
Swift
open func add(entid: Entid, keyword: String, keyword value: String) throws
Parameters
entid
The
Entid
of the entity to be touched.keyword
The name of the attribute in the format
:namespace/name
.value
The value to be asserted
-
Asserts the value of attribute
keyword
to be the providedvalue
for entityentid
.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if the attribute is not present in the schema or the attribute value type is not:db.type/boolean
.Declaration
Swift
open func add(entid: Entid, keyword: String, boolean value: Bool) throws
Parameters
entid
The
Entid
of the entity to be touched.keyword
The name of the attribute in the format
:namespace/name
.value
The value to be asserted
-
Asserts the value of attribute
keyword
to be the providedvalue
for entityentid
.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if the attribute is not present in the schema or the attribute value type is not:db.type/double
.Declaration
Swift
open func add(entid: Entid, keyword: String, double value: Double) throws
Parameters
entid
The
Entid
of the entity to be touched.keyword
The name of the attribute in the format
:namespace/name
.value
The value to be asserted
-
Asserts the value of attribute
keyword
to be the providedvalue
for entityentid
.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if the attribute is not present in the schema or the attribute value type is not:db.type/instant
.Declaration
Swift
open func add(entid: Entid, keyword: String, date value: Date) throws
Parameters
entid
The
Entid
of the entity to be touched.keyword
The name of the attribute in the format
:namespace/name
.value
The value to be asserted
-
Asserts the value of attribute
keyword
to be the providedvalue
for entityentid
.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if the attribute is not present in the schema or the attribute value type is not:db.type/string
.Declaration
Swift
open func add(entid: Entid, keyword: String, string value: String) throws
Parameters
entid
The
Entid
of the entity to be touched.keyword
The name of the attribute in the format
:namespace/name
.value
The value to be asserted
-
Asserts the value of attribute
keyword
to be the providedvalue
for entityentid
.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if the attribute is not present in the schema or the attribute value type is not:db.type/uuid
.Declaration
Swift
open func add(entid: Entid, keyword: String, uuid value: UUID) throws
Parameters
entid
The
Entid
of the entity to be touched.keyword
The name of the attribute in the format
:namespace/name
.value
The value to be asserted
-
Retracts the value of attribute
keyword
from the providedvalue
for entityentid
.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if the attribute is not present in the schema or the attribute value type is not:db.type/long
.Declaration
Swift
open func retract(entid: Entid, keyword: String, long value: Int64) throws
Parameters
entid
The
Entid
of the entity to be touched.keyword
The name of the attribute in the format
:namespace/name
.value
The value to be retracted
-
Retracts the value of attribute
keyword
from the providedvalue
for entityentid
.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if the attribute is not present in the schema or the attribute value type is not:db.type/ref
.Parameters
entid
The
Entid
of the entity to be touched.keyword
The name of the attribute in the format
:namespace/name
.value
The value to be retracted
-
Retracts the value of attribute
keyword
from the providedvalue
for entityentid
.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if the attribute is not present in the schema or the attribute value type is not:db.type/keyword
.Declaration
Swift
open func retract(entid: Entid, keyword: String, keyword value: String) throws
Parameters
entid
The
Entid
of the entity to be touched.keyword
The name of the attribute in the format
:namespace/name
.value
The value to be retracted
-
Retracts the value of attribute
keyword
from the providedvalue
for entityentid
.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if the attribute is not present in the schema or the attribute value type is not:db.type/boolean
.Declaration
Swift
open func retract(entid: Entid, keyword: String, boolean value: Bool) throws
Parameters
entid
The
Entid
of the entity to be touched.keyword
The name of the attribute in the format
:namespace/name
.value
The value to be retracted
-
Retracts the value of attribute
keyword
from the providedvalue
for entityentid
.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if the attribute is not present in the schema or the attribute value type is not:db.type/double
.Declaration
Swift
open func retract(entid: Entid, keyword: String, double value: Double) throws
Parameters
entid
The
Entid
of the entity to be touched.keyword
The name of the attribute in the format
:namespace/name
.value
The value to be retracted
-
Retracts the value of attribute
keyword
from the providedvalue
for entityentid
.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if the attribute is not present in the schema or the attribute value type is not:db.type/instant
.Declaration
Swift
open func retract(entid: Entid, keyword: String, date value: Date) throws
Parameters
entid
The
Entid
of the entity to be touched.keyword
The name of the attribute in the format
:namespace/name
.value
The value to be retracted
-
Retracts the value of attribute
keyword
from the providedvalue
for entityentid
.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if the attribute is not present in the schema or the attribute value type is not:db.type/string
.Declaration
Swift
open func retract(entid: Entid, keyword: String, string value: String) throws
Parameters
entid
The
Entid
of the entity to be touched.keyword
The name of the attribute in the format
:namespace/name
.value
The value to be retracted
-
Retracts the value of attribute
keyword
from the providedvalue
for entityentid
.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if the attribute is not present in the schema or the attribute value type is not:db.type/uuid
.Declaration
Swift
open func retract(entid: Entid, keyword: String, uuid value: UUID) throws
Parameters
entid
The
Entid
of the entity to be touched.keyword
The name of the attribute in the format
:namespace/name
.value
The value to be retracted
-
Transacts the added assertions. This consumes the pointer associated with this
InProgressBuilder
such that no further assertions can be added after thetransact
has completed. To perform further assertions, use theInProgress
returned from this function.This does not commit the transaction. In order to do so,
commit
can be called on theInProgress
returned from this function.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if an error occured during the execution of the transact.Declaration
Swift
open func transact() throws -> (InProgress, TxReport?)
Return Value
The current
InProgress
and theTxReport
generated by the transact. -
Transacts the added assertions and commits. This consumes the pointer associated with this
InProgressBuilder
and the associatedInProgress
such that no further assertions can be added after thecommit
has completed. To perform further assertions, a newInProgress
orInProgressBuilder
should be created.Throws
PointerError.pointerConsumed
if the underlying raw pointer has already consumed, which will occur if the builder has already been transacted or committed.Throws
ResultError.error
if an error occured during the execution of the transact.Declaration
Swift
open func commit() throws -> TxReport
Return Value
The
TxReport
generated by the transact. -
Undocumented
Declaration
Swift
override open func cleanup(pointer: OpaquePointer)