Remote / foldkit-remote-drizzle

ComputedConfig

interface · packages/remote-drizzle/src/binding.ts:112

interface ComputedConfig<Relation extends string = string> {
  readonly relation: Relation
  readonly over?: ManyRelation<AnyEntityBinding> | undefined
  readonly viewer?:
    | {
        readonly column: AnyColumn
        readonly entity: string
      }
    | undefined
  readonly where?: SQL | undefined
}

An aggregate over a collection relation, attached to each owning row.

Members

ComputedConfig.relation

property · packages/remote-drizzle/src/binding.ts:114

readonly relation: Relation

The collection relation whose target rows are counted.

ComputedConfig.over

property · packages/remote-drizzle/src/binding.ts:120

readonly over?: ManyRelation<AnyEntityBinding> | undefined

The rows counted, in place of a relation of the owner: what bind reads a Derived.count as, the pointing table by its foreign key. relation then only names it.

ComputedConfig.viewer

property · packages/remote-drizzle/src/binding.ts:126

readonly viewer?:
  | {
      readonly column: AnyColumn
      readonly entity: string
    }
  | undefined

What makes it a Derived.exists: the column of the counted rows that points at the reader, and the Entity it points at. The member is then the id of a counted row whose column holds the source's viewer, or null.

ComputedConfig.where

property · packages/remote-drizzle/src/binding.ts:128

readonly where?: SQL | undefined

An optional filter on the counted rows.