RLS DSL - v0.1.0
    Preparing search index...

    Class SubqueryBuilder

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Specify the columns to select

      Parameters

      • columns: string | string[]

        Column name(s) to select

      Returns this

      // Select single column
      from('project_members').select('project_id')

      // Select multiple columns
      from('users').select(['id', 'email', 'name'])
    • Add a JOIN clause to the subquery

      Parameters

      • table: string

        The table to join

      • on: Condition | ConditionChain

        The join condition

      • Optionaltype: "inner" | "left" | "right" | "full"

        The join type (default: 'inner')

      • Optionalalias: string

        Optional alias for the joined table

      Returns this

      // Simple join
      from('projects', 'p')
      .select('p.id')
      .join(
      'project_members',
      column('p.id').eq('pm.project_id'),
      'inner',
      'pm'
      )
      .where(column('pm.user_id').eq(auth.uid()))

      // LEFT JOIN
      from('organizations', 'org')
      .select('org.id')
      .join(
      'organization_members',
      column('org.id').eq('om.organization_id'),
      'left',
      'om'
      )