Struct QueryInterpolatedStringHandler
Provides a handler used by the language compiler to process interpolated strings into N1QL queries with positional parameters.
Inherited Members
Namespace: Couchbase.Query
Assembly: Couchbase.NetClient.dll
Syntax
public ref struct QueryInterpolatedStringHandler
Constructors
View SourceQueryInterpolatedStringHandler(int, int)
Creates a handler used by the language compiler to process interpolated strings into N1QL queries with positional parameters.
Declaration
public QueryInterpolatedStringHandler(int literalLength, int formattedCount)
Parameters
| Type | Name | Description |
|---|---|---|
| int | literalLength | The number of constant characters outside of interpolation expressions in the interpolated string. |
| int | formattedCount | The number of interpolation expressions in the interpolated string. |
Remarks
This is intended to be called only by compiler-generated code. Arguments are not validated as they'd
otherwise be for members intended to be used directly.
QueryOptions will be defaulted to AdHoc of false.
QueryInterpolatedStringHandler(int, int, QueryOptions)
Creates a handler used by the language compiler to process interpolated strings into N1QL queries with positional parameters.
Declaration
public QueryInterpolatedStringHandler(int literalLength, int formattedCount, QueryOptions queryOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| int | literalLength | The number of constant characters outside of interpolation expressions in the interpolated string. |
| int | formattedCount | The number of interpolation expressions in the interpolated string. |
| QueryOptions | queryOptions | Options to enrich with parameters as the interpolated string is processed. |
Remarks
This is intended to be called only by compiler-generated code. Arguments are not validated as they'd otherwise be for members intended to be used directly.
Properties
View SourceQueryOptions
The QueryOptions to be used when executing the query.
Declaration
public readonly QueryOptions QueryOptions { get; }
Property Value
| Type | Description |
|---|---|
| QueryOptions |
Remarks
Positional parameters will be added to these options as AppendFormatted(string?) or its overloads are called.
Methods
View SourceAppendFormatted(object?, int, string?)
Writes the specified value to the handler as a positional parameter.
Declaration
public void AppendFormatted(object? value, int alignment = 0, string? format = null)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value | The value to write. |
| int | alignment | Ignored. |
| string | format | Ignored. |
Remarks
Provided for API compatibility, alignment and format are ignored.
AppendFormatted(ReadOnlySpan<char>)
Writes the specified value to the handler as a positional parameter.
Declaration
public void AppendFormatted(ReadOnlySpan<char> value)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<char> | value | The value to write. |
AppendFormatted(ReadOnlySpan<char>, int, string?)
Writes the specified value to the handler as a positional parameter.
Declaration
public void AppendFormatted(ReadOnlySpan<char> value, int alignment = 0, string? format = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<char> | value | The value to write. |
| int | alignment | Ignored. |
| string | format | Ignored. |
Remarks
Provided for API compatibility, alignment and format are ignored.
AppendFormatted(string?)
Writes the specified value to the handler as a positional parameter.
Declaration
public void AppendFormatted(string? value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The value to write. |
AppendFormatted(string?, int, string?)
Writes the specified value to the handler as a positional parameter.
Declaration
public void AppendFormatted(string? value, int alignment = 0, string? format = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The value to write. |
| int | alignment | Ignored. |
| string | format | Ignored. |
Remarks
Provided for API compatibility, alignment and format are ignored.
AppendFormatted<T>(T)
Writes the specified value to the handler as a positional parameter.
Declaration
public void AppendFormatted<T>(T value)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value to write. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the value to write. |
AppendFormatted<T>(T, int)
Writes the specified value to the handler as a positional parameter.
Declaration
public void AppendFormatted<T>(T value, int alignment)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value to write. |
| int | alignment | Ignored. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the value to write. |
Remarks
Provided for API compatibility, alignment is ignored.
AppendFormatted<T>(T, int, string?)
Writes the specified value to the handler as a positional parameter.
Declaration
public void AppendFormatted<T>(T value, int alignment, string? format)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value to write. |
| int | alignment | Ignored. |
| string | format | Ignored. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the value to write. |
Remarks
Provided for API compatibility, alignment and format are ignored.
AppendFormatted<T>(T, string?)
Writes the specified value to the handler as a positional parameter.
Declaration
public void AppendFormatted<T>(T value, string? format)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value to write. |
| string | format | Ignored. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the value to write. |
Remarks
Provided for API compatibility, format is ignored.
AppendLiteral(string)
Writes the specified string to the handler.
Declaration
public void AppendLiteral(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The string to write. |
ToString()
Gets the built N1QL query.
Declaration
public override readonly string ToString()
Returns
| Type | Description |
|---|---|
| string | The built N1QL query. |
Overrides
View SourceToStringAndClear()
Gets the built N1QL query and clears the handler.
Declaration
public string ToStringAndClear()
Returns
| Type | Description |
|---|---|
| string | The built N1QL query. |
Remarks
This releases any resources used by the handler. The method should be invoked only once and as the last thing performed on the handler. Subsequent use is erroneous, ill-defined, and may destabilize the process, as may using any other copies of the handler after ToStringAndClear is called on any one of them.