/** * QueryBuilder - Fluent interface for constructing Spinta DSQL query strings * * @example * ```typescript * const query = new QueryBuilder() * .select('name', 'population') * .filter(f => f.field('country').eq('lt')) * .sort('name') * .limit(10); * * // Generates: ?select(name,population)&country="lt"&sort(name)&limit(10) * const url = `/datasets/gov/example/City${query.toQueryString()}`; * ``` */ import type { FilterCallback } from './types.js'; export declare class QueryBuilder> { private selectFields; private sortSpecs; private limitValue; private countMode; private filterExpression; /** * Select specific fields to return * * @example * .select('id', 'name') → ?select(id,name) * .select('country.name') → ?select(country.name) // Supports dot notation for joins */ select(...fields: (keyof T | string)[]): this; /** * Sort by field in ascending order * * @example * .sort('name') → ?sort(name) */ sort(field: keyof T | string): this; /** * Sort by field in descending order * * @example * .sortDesc('date') → ?sort(-date) */ sortDesc(field: keyof T | string): this; /** * Limit the number of results returned * * @example * .limit(10) → ?limit(10) */ limit(n: number): this; /** * Request count of objects instead of the objects themselves * * @example * .count() → ?count() */ count(): this; /** * Add filter conditions * * @example * // Simple equality * .filter(f => f.field('code').eq('lt')) * * // String operations * .filter(f => f.field('name').contains('Vilnius')) * * // AND combination * .filter(f => f.field('a').eq(1).and(f.field('b').eq(2))) * * // OR combination * .filter(f => f.field('a').eq(1).or(f.field('b').eq(2))) * * // Complex: OR inside AND (auto-wrapped in parens) * .filter(f => * f.field('a').eq(1).and( * f.field('b').eq(2).or(f.field('c').eq(3)) * ) * ) * // Generates: a=1&(b=2|c=3) */ filter(callback: FilterCallback): this; /** * Generate the URL query string * * @returns Query string starting with '?' if there are any parameters, empty string otherwise * * @example * new QueryBuilder().select('name').sort('name').toQueryString() * // Returns: '?select(name)&sort(name)' */ toQueryString(): string; /** * Clone this query builder (useful for creating variants) */ clone(): QueryBuilder; } //# sourceMappingURL=QueryBuilder.d.ts.map