Skip to content

basalt / prisma/src / RlsSearchFunctionSqlOptions

Interface: RlsSearchFunctionSqlOptions ​

Defined in: prisma/src/rls-search.ts:90

Properties ​

columns? ​

> optional columns?: (string | RlsSearchColumn)[]

Defined in: prisma/src/rls-search.ts:110

Payload columns to return besides tenant_id/id/score/total — the document, a title, a snippet. Unlike a cross-tenant scan this function is tenant-scoped, so tenant data is exactly what it is for.


filterColumn? ​

> optional filterColumn?: string

Defined in: prisma/src/rls-search.ts:125

A jsonb column the p_filters parameter filters on, with @basaltkit/search semantics: {"folder":"inbox"} means col->>'folder' = 'inbox', and an array means = ANY(...).

Omitted, the function refuses a non-NULL p_filters by returning no rows — filters are never silently dropped.


idColumn? ​

> optional idColumn?: string

Defined in: prisma/src/rls-search.ts:98

Primary-key column, returned as id and used to break rank ties. Default: 'id'.


idType? ​

> optional idType?: string

Defined in: prisma/src/rls-search.ts:100

SQL type of the id column. Default: 'text'.


language? ​

> optional language?: string

Defined in: prisma/src/rls-search.ts:133

Text-search configuration used to parse the query. Default: 'english'.


maxRows? ​

> optional maxRows?: number

Defined in: prisma/src/rls-search.ts:149

Hard cap on the rows one call may return. Default: 100.


name ​

> name: string

Defined in: prisma/src/rls-search.ts:92

Name of the generated function (unqualified).


owner? ​

> optional owner?: string

Defined in: prisma/src/rls-search.ts:147

Role the function is owned by, i.e. the role it RUNS as. It must not be subject to the table's RLS policies (a BYPASSRLS role, or a superuser): rlsPolicySql sets FORCE ROW LEVEL SECURITY, so even the table owner is filtered — and a filtered owner puts the policy back in front of @@, which is the whole problem. Omitted: owned by whoever runs the migration.


parser? ​

> optional parser?: RlsSearchQueryParser

Defined in: prisma/src/rls-search.ts:135

How p_query becomes a tsquery. Default: 'plainto' (what the search driver sends).


partitionColumn? ​

> optional partitionColumn?: string

Defined in: prisma/src/rls-search.ts:116

An optional extra equality filter, exposed as the p_partition parameter: the index name in a shared search table, a document type, a locale. NULL means "every partition".


role ​

> role: string | string[]

Defined in: prisma/src/rls-search.ts:139

Role(s) granted EXECUTE — the application role the app connects as.


schema? ​

> optional schema?: string

Defined in: prisma/src/rls-search.ts:137

Schema of the table and of the function. Default: 'public'.


setting? ​

> optional setting?: string

Defined in: prisma/src/rls-search.ts:131

Postgres setting (GUC) read for the active tenant. Must be the same one rlsPolicySql was given, or the function would scope to a different tenant than the policy. Default: 'app.tenant_id'.


table ​

> table: string

Defined in: prisma/src/rls-search.ts:94

Table to search (unqualified).


tenantColumn? ​

> optional tenantColumn?: string

Defined in: prisma/src/rls-search.ts:102

Column holding the tenant id. Returned as tenant_id. Default: 'tenant_id'.


tenantType? ​

> optional tenantType?: string

Defined in: prisma/src/rls-search.ts:104

SQL type of the tenant column. Default: 'text'.


vectorColumn ​

> vectorColumn: string

Defined in: prisma/src/rls-search.ts:96

The tsvector column carrying the indexed text. Must have a GIN index.

Released under the MIT License.