© 2026 Hedgehog Software, LLC
export const PaginationParams = Schema.Struct({ limit: Schema.optional( Schema.NumberFromString.pipe( Schema.greaterThan(0), Schema.lessThanOrEqualTo(25), ), ).pipe(Schema.withDecodingDefault(() => 10)), offset: Schema.optional( Schema.NumberFromString.pipe(Schema.greaterThanOrEqualTo(0)), ).pipe(Schema.withDecodingDefault(() => 0)), });
@effect/sql
Request
execute
number
string | undefined
const getByOrganizationId = SqlSchema.findAll({ Request: Schema.Struct({ organizationId: OrganizationId, pagination: PaginationParams, }), Result: Case, execute: ({ organizationId, pagination: { limit, offset } }) => sql`SELECT * FROM cases WHERE organizationId = ${sql( organizationId, )} ORDER BY createdAt DESC LIMIT ${limit} OFFSET ${offset}`, });
(property) pagination: { readonly limit?: string | undefined; readonly offset?: string | undefined; }
typeof PaginationParams.Type
type PaginationParams = { readonly limit: number; readonly offset: number; }