valueAs

inline fun <T> valueAs(name: String = "$", serializer: JsonSerializer? = null): T

Returns a field value from a result with exactly one row. Useful for getting the result of an aggregating function.

Samples

com.couchbase.client.kotlin.samples.singleValueAnalyticsAnonymouscom.couchbase.client.kotlin.samples.singleValueAnalyticsNamed

Parameters

name

the name of the field to extract.

serializer

for converting the field value to the requested type. Defaults to the AnalyticsRow's serializer.

T

the serializer reads the field value as this type.

Throws

if there is more than one result row

if there is no field with the given name