type

Diff

const class Diff : Obj

Diff encapsulates a set of changes to apply to a record.

constructors

make

Construct a modfication for an existing record.

makeAdd

Make a Diff to add a new record into the database.

fields

add

Flag bitmask for isAdd

changes

Changes applied to oldRec with resulting newRec

flags

Bitmask meta-data for diff

force

Flag bitmask for isForce

forceTransient

Flag bitmask for force and transient

id

Target record id

newMod

Timestamp version of newRec or null

newRec

Updated record which is null until after commit

oldMod

Timestamp version of oldRec or null if adding new record

oldRec

Original record or null if adding new record

remove

Flag bitmask for isRemove

transient

Flag bitmask for isTransient

methods

getNew

Get tag value from new record or null.

getOld

Get tag value from old record or null.

isAdd

Flag indicating if adding a new record to the project

isForce

Flag indicating that changes should be applied regardless of other concurrent changes which may be been applied after the oldRec version was read.

isRemove

Flag indicating if remove an existing record from the project

isTransient

Flag indicating that this diff should not be flushed to persistent storage (it may or may not be persisted).

isUpdate

Update diff - not an add nor a remove

toStr

String representation

Slot Details

add

const static Int add := 1

Flag bitmask for isAdd

changes

const Dict changes

Changes applied to oldRec with resulting newRec

flags

const Int flags

Bitmask meta-data for diff

force

const static Int force := 8

Flag bitmask for isForce

forceTransient

const static Int forceTransient := @force.or(@transient)

Flag bitmask for force and transient

getNew

Obj? getNew(Str tag, Obj? def := null)

Get tag value from new record or null.

getOld

Obj? getOld(Str tag, Obj? def := null)

Get tag value from old record or null.

id

const Ref id

Target record id

isAdd

Bool isAdd()

Flag indicating if adding a new record to the project

isForce

Bool isForce()

Flag indicating that changes should be applied regardless of other concurrent changes which may be been applied after the oldRec version was read.

isRemove

Bool isRemove()

Flag indicating if remove an existing record from the project

isTransient

Bool isTransient()

Flag indicating that this diff should not be flushed to persistent storage (it may or may not be persisted).

isUpdate

Bool isUpdate()

Update diff - not an add nor a remove

make

new make(Dict? oldRec, Obj? changes, Int flags := 0)

Construct a modfication for an existing record. The oldRec should be the instance which was read from the project. Any tags to add/set/remove should be included in the changes dict. Use Remove.val to indicate a tag should be removed. See makeAdd to create a Diff for adding a new record to a project.

makeAdd

new makeAdd(Obj? changes, Ref id := Ref.gen())

Make a Diff to add a new record into the database.

newMod

const DateTime? newMod

Timestamp version of newRec or null

newRec

const Dict? newRec

Updated record which is null until after commit

oldMod

const DateTime? oldMod

Timestamp version of oldRec or null if adding new record

oldRec

const Dict? oldRec

Original record or null if adding new record

remove

const static Int remove := 2

Flag bitmask for isRemove

toStr

virtual override Str toStr()

String representation

transient

const static Int transient := 4

Flag bitmask for isTransient