@dypai-ai/client-sdk - v1.12.0
    Preparing search index...

    Fluent query builder for direct database access. Supports chainable filters, column selection, pagination, and all CRUD operations.

    const { data } = await client.db.direct
    .from('products')
    .select('id, name, price')
    .eq('category', 'electronics')
    .gt('price', 50)
    .orderBy('price', 'DESC')
    .limit(20)
    .select();
    Index

    Constructors

    Methods

    • Insert one row or many rows. Arrays over 1000 rows are auto-chunked.

      Parameters

      • data: Record<string, any> | Record<string, any>[]

        A single row object or an array of row objects.

      Returns Promise<DypaiResponse<any>>

    • Fetch a single row or null. Like .single() but returns null instead of error when no match.

      Returns Promise<DypaiResponse<any>>

      const { data: user } = await client.db.direct.from('users').eq('email', email).maybeSingle();
      // data is null if not found (no error)
    • Negate a filter: NOT (column op value).

      Parameters

      • column: string
      • operator: string
      • Optionalvalue: any

      Returns DirectQueryBuilder

      .not('status', 'eq', 'deleted')      // status != 'deleted'
      .not('name', 'like', 'test') // name NOT ILIKE '%test%'
      .not('category', 'in', ['a', 'b']) // category NOT IN ('a', 'b')
      .not('deleted_at', 'is_null', null) // deleted_at IS NOT NULL
    • OR filter group: at least one condition must match.

      Parameters

      Returns DirectQueryBuilder

      // WHERE (status = 'active' OR status = 'pending')
      .or([
      { column: 'status', operator: 'eq', value: 'active' },
      { column: 'status', operator: 'eq', value: 'pending' },
      ])

      // WHERE (price > 100 OR category = 'premium')
      .or([
      { column: 'price', operator: 'gt', value: 100 },
      { column: 'category', operator: 'eq', value: 'premium' },
      ])
    • Fetch rows matching the current filters.

      Parameters

      • OptionalcolumnsOrFilters: string | Record<string, any>

        Either a column selection string ('id, name, price') or a shorthand filter object ({ active: true }).

      Returns Promise<DypaiResponse<any>>

      // All columns
      .select()

      // Specific columns
      .select('id, name, price')

      // Shorthand filters (legacy)
      .select({ active: true })
    • Insert or update a row based on a conflict column.

      Parameters

      • data: Record<string, any>

        Row data (must include the conflict column).

      • conflictColumn: string = 'id'

        Column to detect conflicts on (default: id).

      Returns Promise<DypaiResponse<any>>