Function: changeSetElementIsLeafOf()

changeSetElementIsLeafOf(target): (eb) => ExpressionWrapper<LixDatabaseSchema, "change_set_element", SqlBool>

Filters the leaves of the given change set(s).

An element is considered a leaf if no other element in the combined ancestry of the target change sets redefines the same entity at a later point in the graph.

Parameters

target

A target change set object (or its id), or an array of such objects/ids.

Pick<{ id: LixGenerated<string>; metadata?: null | Record<string, any>; }, "id"> | Pick<{ id: LixGenerated<string>; metadata?: null | Record<string, any>; }, "id">[]

Returns

(eb): ExpressionWrapper<LixDatabaseSchema, "change_set_element", SqlBool>

Parameters

eb

ExpressionBuilder<LixDatabaseSchema, "change_set_element">

Returns

ExpressionWrapper<LixDatabaseSchema, "change_set_element", SqlBool>

Example

// Find leaves relative to a single change set (object)
db.selectFrom("change_set_element")
  .where(changeSetElementIsLeafOf(cs))
  .selectAll()

// Find leaves relative to a single change set (id)
db.selectFrom("change_set_element")
  .where(changeSetElementIsLeafOf(cs.id))
  .selectAll()

// Find leaves relative to multiple change sets
db.selectFrom("change_set_element")
  .where(changeSetElementIsLeafOf([cs_source, cs_target]))
  .selectAll()