Appearance
QueryBuilder Class
Definition
Immutable, fluent query builder for schema-based (non-typed) queries.
- Namespace:
JASE.Database - Assembly:
JASE.Database.dll
Properties
| Name | Description |
|---|---|
KeysetRowsReversed | Gets whether rows from this query are in reverse display order after Before. |
Methods
| Name | Description |
|---|---|
QueryBuilder After(KeysetCursor cursor) | Applies a forward keyset seek past cursor (next page). |
QueryBuilder AndGroup(Action<GroupBuilder> group) | Adds a grouped AND predicate block constructed by GroupBuilder. |
QueryBuilder AndWhere(string column, PredicateOperator op, object value) | Adds an AND filter using a column-name comparison. |
QueryBuilder Before(KeysetCursor cursor) | Applies a reverse keyset seek before cursor (previous page / seek-last style). |
Task<long> Count(IDatabaseSession connection) | Executes a COUNT(*) for the current query. |
QueryBuilder Distinct() | Marks the query to return only distinct rows. |
QueryBuilder EnsureKeysetOrder() | Appends the primary key as a final ascending ORDER BY when missing, ensuring a total order for keyset paging. |
Task<Dictionary<string, object>> First(IDatabaseSession connection) | Returns the first matching row as a dictionary of column values. |
Task<DynamicRow> FirstRow(IDatabaseSession connection) | Returns the first matching row as a DynamicRow, or null if none match. |
QueryBuilder For(TableInfo table) | Creates a builder for the specified table metadata. |
KeysetCapability GetKeysetCapability() | Conservatively evaluates whether this query can use keyset paging. |
int GetLimit() | Gets the current LIMIT value, if any. |
Task<List<Dictionary<string, object>>> GetList(IDatabaseSession connection) | Executes the query and materializes all matching rows as dictionaries. |
int GetOffset() | Gets the current OFFSET value, if any. |
IReadOnlyList<OrderBy> GetOrderBy() | Gets a copy of the current ORDER BY list (display order, unless Before / SeekLast inverted it). |
Task<List<DynamicRow>> GetRows(IDatabaseSession connection) | Executes the query and materializes matching rows as DynamicRow instances. |
QueryBuilder InnerJoin(TableInfo target, string alias, string logicalName, string foreignKeyColumn, IEnumerable<string> columns = null, string rootAlias = null) | Adds an INNER JOIN from a foreign-key column on the root table to target. |
QueryBuilder Join(IJoin join, string rootAlias = null) | Adds a pre-built join definition. |
QueryBuilder Join(JoinType joinType, TableInfo target, string alias, string logicalName, string foreignKeyColumn, IEnumerable<string> columns = null, string rootAlias = null) | Adds a foreign-key join of the requested joinType. |
QueryBuilder LeftJoin(TableInfo target, string alias, string logicalName, string foreignKeyColumn, IEnumerable<string> columns = null, string rootAlias = null) | Adds a LEFT OUTER JOIN from a foreign-key column on the root table to target. |
QueryBuilder Limit(int? limit, int? offset = null) | Applies a LIMIT (and optional OFFSET) to the query. |
QueryBuilder OrderBy(string column) | Adds an ascending ORDER BY using the specified column. |
QueryBuilder OrderByDescending(string column) | Adds a descending ORDER BY using the specified column. |
QueryBuilder OrGroup(Action<GroupBuilder> group) | Adds a grouped OR predicate block constructed by GroupBuilder. |
QueryBuilder OrWhere(string column, PredicateOperator op, object value) | Adds an OR filter using a column-name comparison. |
QueryBuilder OrWhereIn(string column, IEnumerable<object> values) | Adds an OR IN filter for the specified column. |
QueryBuilder SeekLast() | Anchors the query at the last display page: invert ORDER BY (and NULL placement) with no seek predicate. |
QueryBuilder Select(IEnumerable<string> columns) | Restricts the query to the specified columns. |
QueryBuilder Select(string[] columns) | Restricts the query to the specified columns. |
QueryBuilder ThenBy(string column) | Adds an additional ascending ORDER BY on the specified column. |
QueryBuilder ThenByDescending(string column) | Adds an additional descending ORDER BY on the specified column. |
SelectStatement ToSql(IConnection connection) | Builds a SELECT statement using the connection's SQL generator. |
SelectStatement ToSql(ISqlGenerator generator) | Builds a SELECT statement using the provided SQL generator. |
QueryBuilder Where(IPredicateNode node) | Adds a pre-built predicate node with AND logic. |
QueryBuilder Where(string column, PredicateOperator op, object value) | Adds an AND filter using a validated column name. |
QueryBuilder WhereBetween(string column, object start, object end) | Adds an AND BETWEEN filter for the specified column. |
QueryBuilder WhereIn(string column, IEnumerable<object> values) | Adds an AND IN filter for the specified column. |
QueryBuilder WhereNotNull(string column) | Adds an AND filter requiring the specified column to be NOT NULL. |
QueryBuilder WhereNull(string column) | Adds an AND filter requiring the specified column to be NULL. |
Remarks
Works against a TableInfo and materializes results as Dictionary<string, object> rather than typed entities. All mutating operations are copy-on-write.