@earth-app/collegedb
    Preparing search index...

    Function planQuery

    • Reads the routing key or keys out of a statement and its bindings.

      Parameters

      • sql: string

        Statement text using ? placeholders

      • bindings: any[] = []

        Positional bindings for the statement

      • options: PlanQueryOptions = {}

        Key-column configuration

      Returns QueryPlan | null

      The plan, or null when the routing key cannot be proven

      1.4.0

      planQuery('SELECT * FROM users WHERE id = ?', ['user-1']);
      // => { kind: 'select', table: 'users', keyColumn: 'id', keys: ['user-1'], readOnly: true }

      planQuery('SELECT * FROM users WHERE email = ?', ['a@b.c']);
      // => null, because email is not the key column