BitemporalPostgres.jl
BitemporalPostgres.InfinityKey
— ConstantInfinityKey in order to ease integration with javascript we use javascript's MAXSAFEINTEGER 2^53 - 1
BitemporalPostgres.Component
— TypeComponent
an abstract component of a bitemporal entity i.e. a contract, a reference to a partner a component's history of states is represented by its revisions
BitemporalPostgres.ComponentRevision
— TypeComponentRevision
a component of a bitemporal entity i.e. a contract, a reference to a partner a component's history of states is represented by its revisions
BitemporalPostgres.History
— TypeHistory
The root of an aggregate entity, which groups versions and entities
BitemporalPostgres.NoVersionFound
— TypeNoVersionFound showing component type, id and version id
BitemporalPostgres.Node
— TypeNode
node of tree of mutations
BitemporalPostgres.Role
— TypeRole
role of a relationship
BitemporalPostgres.SubComponent
— TypeSubComponent
an abstract subcomponent of a bitemporal entity i.e. product item of a contract
BitemporalPostgres.TestDummyComponent
— TypeTestDummyComponent <: Component
a component of a bitemporal entity
BitemporalPostgres.TestDummyComponentRevision
— TypeTestDummyComponentRevision <: ComponentRevision
a revision of a contract component of a bitemporal entity
BitemporalPostgres.TestDummySubComponent
— TypeTestDummySubComponent <: Component a component of a bitemporal entity
BitemporalPostgres.TestDummySubComponentRevision
— TypeTestDummySubComponentRevision <: ComponentRevision
a revision of a contract component of a bitemporal entity
BitemporalPostgres.TooManyVersionsFound
— TypeTooManyVersionsFound showing component type, id and version id indicates an error in committing of versions
BitemporalPostgres.ValidityInterval
— TypeValidityInterval
a 2-dimensional interval of validity of a version with respect to the state
- of the data base storage and
- of the world
See the theory page for background
BitemporalPostgres.Version
— TypeVersion
version number of the state of aggregate entity
BitemporalPostgres.VersionException
— TypeVersionException
thrown on versioning errors
BitemporalPostgres.Workflow
— TypeWorkflow Holds application based transaction data.
- current version
- world validFrom date
- db validfrom date
- is_committed means: bitemporal transaction is
- pending: 0
- committed: 1
- rolled back: 2
BitemporalPostgres.commit_workflow!
— Methodcommitworkflow!(w::Workflow) commits the bitemporal transaction identified by refversion begun with the creation of w
- sets w's version's validityInterval to is_committed
- ends all overlapping intervals to tsdbinvalidfrom w.tsdbvalidfrom
- creates a new interval for the non_overlapping part of a partially interval if any
BitemporalPostgres.create_component!
— Methodcreate_component!(c::Component, cr :: ComponentRevision, w:: Workflow)
creates a component and a componentRevision
BitemporalPostgres.create_entity!
— Methodcreate_entity!(w::Workflow)
- opens a bitemporal transaction identified by ref_version
- persists a history, version, validityInterval and a Workflow
- requires: w.tsw_validfrom is a valid date
BitemporalPostgres.create_subcomponent!
— Methodcreate_subcomponent!(c::Component, sc::SubComponent, cr :: ComponentRevision, w:: Workflow) creates a subcomponent and a componentRevision
BitemporalPostgres.delete_component!
— Methoddelete_component!(c::T, w::Workflow) where {T<:Component}
- deletes a component if it was created for the current version or
- mark its latest component revision as invalid
BitemporalPostgres.delete_component!
— Methoddelete_component!(r::T, w::Workflow) where {T<:ComponentRevision}
- deletes a component if it was created for the current version or
- mark its latest component revision as invalid
BitemporalPostgres.findcomponentrevision
— Methodfindcomponentrevision(t::Type{T},refcomponent::DbId,refversion::DbId,)::Vector{T} where {T<:ComponentRevision} retrieves the version_id of a bitemporal history asof tsdb as per tsw
BitemporalPostgres.findversion
— Functionfindversion(refhistory::DbId, tsdb::ZonedDateTime, tsw::ZonedDateTime, committed::Integer=1)::DbId retrieves the versionid of a bitemporal history asof tsdb as per tsw
BitemporalPostgres.get_revision
— Methodget_revision(ctype::Type{CT}, rtype::Type{RT}, hid::DbId, vid::DbId) where {CT<:Component,RT<:ComponentRevision}
retrieves the revision of the unique component of type CT in history hid as of version vid
the revision must exist
BitemporalPostgres.get_revision
— Methodget_revision(rtype::Type{RT}, cid::DbId, vid::DbId) where {RT<:ComponentRevision}
retrieves the revision of component cid as of version vid
the revision must exist
BitemporalPostgres.get_revisionIfAny
— Methodfunction get_revisionIfAny( ctype::Type{CT}, rtype::Type{RT}, hid::DbId, vid::DbId, )::Vector{RT} where {CT<:Component,RT<:ComponentRevision} retrieves the revision of the unique component of type CT in history hid if one exists as of version vid
An optional (unique) component may have a revision for a version later as vid. In such cases a component w/o valid revision is itself valid, just to be ignored for the current version.
BitemporalPostgres.get_revisionIfAny
— Methodfunction get_revisionIfAny(rtype::Type{RT}, hid::DbId, vid::DbId, )::Vector{RT} where {RT<:ComponentRevision} retrieves the revision of component cid if one exists as of version vid
An optional component may have a revision for a version later as vid. In such cases a component w/o valid revision is itself valid, just to be ignored for the current version.
BitemporalPostgres.get_typeof_component
— Methodgettypeofcomponent(revision::TestDummyComponentRevision) :: Type{TestDummyComponent}
BitemporalPostgres.get_typeof_component
— Methodgettypeofcomponent(component::T)::Type{R} where {T<:ComponentRevision,R<:Component} returns the actual subtype of Component that fits the actual type of ComponentRevision
BitemporalPostgres.get_typeof_revision
— Methodgettypeofrevision(component::TestDummyComponent) :: Type{TestDummyComponentRevision}
BitemporalPostgres.get_typeof_revision
— Methodgettypeofrevision(component::T)::Type{R} where {T<:Component,R<:ComponentRevision} returns the actual subtype of ComponentRevision that fits the actual type of Component
BitemporalPostgres.mkforest
— Methodmkforest(hid::DbId)::Vector{Node}
builds a forest of version nodes where
* eventual child node vectors denote mutations which have been retrospectively corrected by their predecessor
see: Theory: Textual representation of mutation histories
BitemporalPostgres.mktree
— Methodfunction mktree(version::Integer, vidsDict::Dict{Integer,Integer}, treeDict::Dict{Integer,Vector{Integer}})::BitemporalPostgres.Node
builds a tree of versipon nodes with child node vectors denoting
mutations which have been retrospectively corrected by their parent = predecessor
see: Theory: Textual representation of mutation histories
BitemporalPostgres.revisionTypes
— MethodrevisionTypes(entity::Val{:TestDummyComponent}) defining the ComponentRevision types occurring in TestDummyComponents
BitemporalPostgres.revisionTypes
— MethodrevisionTypes(entity::Val{T})::Vector{T} where {T<:Symbol} list of subtypes of ComponentRevision that are subcomponents of
BitemporalPostgres.rollback_workflow!
— Methodrollbackworkflow!(w::Workflow) rolls back the bitemporal transaction identified by refversion begun with the creation of w
BitemporalPostgres.update_component!
— Methodupdate_component!(cr :: ComponentRevision, crNew :: ComponentRevision, w:: Workflow)
terminates a componentRevision and persists its successor
BitemporalPostgres.update_entity!
— Methodupdate_entity!(w::Workflow)
- opens a bitemporal transaction identified by ref_version
- persists a version, a validityInterval and a Workflow
- For retrospective transactions
- preliminarily invalidates all insertions and mutations from shadowed versions
- preliminarily revives all revisions invalidated by shadowed versions
- requires:
- w.tsw_validfrom is a valid date
- w.ref_history is a valid history id
- w.refversion is a valid version of w.refhistory