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

    Variable authConst

    auth: { uid(): ContextValue } = ...

    Auth context helper for accessing authentication information

    Type Declaration

    • uid: function
      • Returns current authenticated user ID

        Maps to auth.uid() in PostgreSQL (commonly used with Supabase). This returns the user ID from the JWT token.

        Returns ContextValue

        A ContextValue representing the current user's ID

        // Basic user ownership
        column('user_id').eq(auth.uid())

        // In a policy
        policy('user_documents')
        .on('documents')
        .read()
        .when(column('user_id').eq(auth.uid()));

        // With complex conditions
        policy('project_access')
        .on('projects')
        .read()
        .when(
        column('created_by').eq(auth.uid())
        .or(column('is_public').eq(true))
        );
    // Users can only see their own documents
    policy('user_docs')
    .on('documents')
    .read()
    .when(column('user_id').eq(auth.uid()));

    // Or use the helper method
    policy('user_docs')
    .on('documents')
    .read()
    .when(column('user_id').isOwner());