Metakit / @doeixd/metakit/relation

Relation

interface · packages/metakit/src/relation.ts:76

interface Relation<Row> extends Pipeable.Pipeable {
  readonly _tag: 'Relation'
  readonly name: string
  readonly row: Schema.Codec<Row>
  readonly cardinality?: Cardinality
  readonly foreignKey?: string | ReadonlyArray<string>
  readonly parentKey?: string | ReadonlyArray<string>
  readonly onDelete?: OnDelete
}

The rows of one kind pointing at a row of another through one of their fields.

Members

Relation._tag

property · packages/metakit/src/relation.ts:77

readonly _tag: 'Relation'

Relation.name

property · packages/metakit/src/relation.ts:79

readonly name: string

The kind and the field it points by, as Follow.followee.

Relation.row

property · packages/metakit/src/relation.ts:81

readonly row: Schema.Codec<Row>

The Schema of a pointing row.

Relation.cardinality

property · packages/metakit/src/relation.ts:83

readonly cardinality?: Cardinality

Cardinality from parent row to pointing rows ('one', 'optional', or 'many').

Relation.foreignKey

property · packages/metakit/src/relation.ts:85

readonly foreignKey?: string | ReadonlyArray<string>

Foreign-key field(s) on the child row pointing to the parent.

Relation.parentKey

property · packages/metakit/src/relation.ts:87

readonly parentKey?: string | ReadonlyArray<string>

Primary/key field(s) on the parent row (default 'id').

Relation.onDelete

property · packages/metakit/src/relation.ts:89

readonly onDelete?: OnDelete

Referential action when the parent row is deleted.