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 provided value for entity entid.

    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 provided value for entity entid.

    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.

    Declaration

    Swift

    open func add(entid: Entid, keyword: String, reference value: Entid) 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 provided value for entity entid.

    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 provided value for entity entid.

    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 provided value for entity entid.

    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 provided value for entity entid.

    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 provided value for entity entid.

    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 provided value for entity entid.

    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 provided value for entity entid.

    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 provided value for entity entid.

    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.

    Declaration

    Swift

    open func retract(entid: Entid, keyword: String, reference value: Entid) 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 provided value for entity entid.

    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 provided value for entity entid.

    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 provided value for entity entid.

    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 provided value for entity entid.

    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 provided value for entity entid.

    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 provided value for entity entid.

    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 the transact has completed. To perform further assertions, use the InProgress returned from this function.

    This does not commit the transaction. In order to do so, commit can be called on the InProgress 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 the TxReport generated by the transact.

  • Transacts the added assertions and commits. This consumes the pointer associated with this InProgressBuilder and the associated InProgress such that no further assertions can be added after the commit has completed. To perform further assertions, a new InProgress or InProgressBuilder 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)