Couchbase .NET SDK __CB_SDK_VERSION__

Show / Hide Table of Contents

Struct QueryInterpolatedStringHandler

Provides a handler used by the language compiler to process interpolated strings into N1QL queries with positional parameters.

Inherited Members
ValueType.Equals(object)
ValueType.GetHashCode()
object.GetType()
object.Equals(object, object)
object.ReferenceEquals(object, object)
Namespace: Couchbase.Query
Assembly: Couchbase.NetClient.dll
Syntax
public ref struct QueryInterpolatedStringHandler

Constructors

View Source

QueryInterpolatedStringHandler(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.

View Source

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 Source

QueryOptions

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 Source

AppendFormatted(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.

View Source

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.

View Source

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.

View Source

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.

View Source

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.

View Source

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.

View Source

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.

View Source

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.

View Source

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.

View Source

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.

View Source

ToString()

Gets the built N1QL query.

Declaration
public override readonly string ToString()
Returns
Type Description
string

The built N1QL query.

Overrides
ValueType.ToString()
View Source

ToStringAndClear()

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.

  • View Source
In this article
Back to top Copyright © 2020 Couchbase, Inc. All rights reserved.