Remote / foldkit-remote-drizzle

bind

function · packages/remote-drizzle/src/bind.ts:240

function bind<const Es extends Domain.Entities, const S extends Storage<Es>>(
  entities: Es,
  storage: S & Storage<Es>,
): {
  readonly [K in keyof Es]: EntityBinding<
    Es[K]['name'],
    S[K]['table'],
    FieldsFrom<Es[K]>,
    Record<keyof Es[K]['relations'] & string, RelationBinding>
  >
}

Binds every Entity of an Entity.relate result to its table in one step, so a relation's target binding can be one that is declared after its owner.