Query & Mutation Types
Type reference for where, select, orderBy, include, and mutation inputs.
FilterOperator
All available filter operators for a single field:
interface FilterOperator {
equals?: unknown; // field = value
not?: unknown; // field != value
in?: unknown[]; // field IN (...)
notIn?: unknown[]; // field NOT IN (...)
gt?: unknown; // field > value
gte?: unknown; // field >= value
lt?: unknown; // field < value
lte?: unknown; // field <= value
contains?: string; // field LIKE '%value%'
startsWith?: string; // field LIKE 'value%'
endsWith?: string; // field LIKE '%value'
isNull?: boolean; // field IS NULL / IS NOT NULL
}WhereInput
Where clauses accept field names mapped to values or FilterOperator objects:
type WhereInput = {
[field: string]: unknown | FilterOperator;
AND?: WhereInput[];
OR?: WhereInput[];
NOT?: WhereInput;
}Examples
// Shorthand equals
{ companyname: 'Acme' }
// Filter operator
{ companyname: { contains: 'Acme' } }
// Multiple conditions (implicit AND)
{ isinactive: false, email: { isNull: false } }
// Explicit AND
{ AND: [{ isinactive: false }, { email: { isNull: false } }] }
// OR
{ OR: [{ companyname: { startsWith: 'A' } }, { companyname: { startsWith: 'B' } }] }
// NOT
{ NOT: { isinactive: true } }SelectInput
Choose which fields to include in the result. id is always included automatically.
type SelectInput = Record<string, boolean>;
// Example
{ companyname: true, email: true, phone: true }
// → SELECT id, companyname, email, phoneOrderByInput
Sort results by field name, ascending or descending:
type OrderByInput = Record<string, 'asc' | 'desc'>;
// Example
{ companyname: 'asc' }
{ companyname: 'asc', id: 'desc' }IncludeInput
Load related records via LEFT JOIN. Keys are relation names from your schema:
type IncludeInput = Record<string, boolean | { select?: SelectInput }>;
// Include all fields from the related record
{ entity: true }
// Include specific fields only
{ entity: { select: { companyname: true, email: true } } }Only many-to-one relations are supported. See Relations & Include for details.
FindManyArgs
interface FindManyArgs {
where?: WhereInput;
select?: SelectInput;
include?: IncludeInput;
orderBy?: OrderByInput;
take?: number; // Limit (default: 1000)
skip?: number; // Offset (default: 0)
}FindFirstArgs
interface FindFirstArgs {
where?: WhereInput;
select?: SelectInput;
include?: IncludeInput;
orderBy?: OrderByInput;
skip?: number;
}CountArgs
interface CountArgs {
where?: WhereInput;
}CreateArgs
interface CreateArgs {
data: Record<string, unknown>;
}UpdateArgs
interface UpdateArgs {
where: { id: { equals: string | number } };
data: Record<string, unknown>;
}DeleteArgs
interface DeleteArgs {
where: { id: { equals: string | number } };
}