* Sets a LIMIT clause to restrict the number of results. * * @example * ```ts * qb.select('*').limit(10); // First 10 results * qb.select('*').limit(10, 20); // 10 results starting from offset 20 * ```
(limit?: number, offset = 0)
| 1988 | * ``` |
| 1989 | */ |
| 1990 | limit(limit?: number, offset = 0): SelectQueryBuilder<Entity, RootAlias, Hint, Context, RawAliases, Fields, CTEs> { |
| 1991 | this.ensureNotFinalized(); |
| 1992 | this.#state.limit = limit; |
| 1993 | |
| 1994 | if (offset) { |
| 1995 | this.offset(offset); |
| 1996 | } |
| 1997 | |
| 1998 | return this as SelectQueryBuilder<Entity, RootAlias, Hint, Context, RawAliases, Fields, CTEs>; |
| 1999 | } |
| 2000 | |
| 2001 | /** |
| 2002 | * Sets an OFFSET clause to skip a number of results. |
no test coverage detected