Interface IQueryText
Renders a template down to the SQL a single run sends, dropping the parts whose values are absent and filling in the handler spots.
public interface IQueryText
- Extension Methods
Properties
HandlerValuesLength
How many slots Parse(Span<bool>, ReadOnlySpan<object?>) reads values from.
int HandlerValuesLength { get; }
Property Value
Methods
IsInCondition(int)
Whether a key controls any optional part of the template.
bool IsInCondition(int varIndex)
Parameters
varIndexint
Returns
Parse(object?[])
The SQL for one run, taking the values from an array. A part stays when its key has a value and drops when it does not. When nothing is optional the original template is returned untouched.
string Parse(object?[] variables)
Parameters
variablesobject[]The values for this run, one slot per key.
Returns
- string
The rendered SQL, or the original template when no part was dropped.
Exceptions
- RequiredHandlerValueException
A required handler spot had no value.
Parse(Span<bool>, ReadOnlySpan<object?>)
The SQL for one run, taking which keys are present from usageMap and the values the
handler spots render from handlerValues.
string Parse(Span<bool> usageMap, ReadOnlySpan<object?> handlerValues)
Parameters
usageMapSpan<bool>Which keys are present this run.
handlerValuesReadOnlySpan<object>One slot per handled key, in key order from the first handled one, holding the value the binding pass left. Empty for a template with no handler, which needs no values at all.
Returns
- string
The rendered SQL, or the original template when no part was dropped.
Exceptions
- RequiredHandlerValueException
A required handler spot had no value.