Class QueryExtensionsKt
-
- All Implemented Interfaces:
public final class QueryExtensionsKt
-
-
Method Summary
Modifier and Type Method Description final static <T extends Any> Tdata(Result $self, String key)Uses Kotlin Serialization to create an object of type T from a query result. final static <T extends DocumentModel> Tdata(Result $self, String key, String metaKey)Uses Kotlin Serialization to create a DocumentModel instance of type T from the query result. final static <T extends Any> Tdata(Result $self, DeserializationStrategy<T> deserializer, String key, String metaKey)final static <T extends Any> Sequence<T>data(ResultSet $self, String key)Returns the query rows transformed by Kotlin Serialization into instances of T. final static <T extends DocumentModel> Sequence<T>data(ResultSet $self, String key, String metaKey)final static <T extends Any> Sequence<T>data(ResultSet $self, DeserializationStrategy<T> deserializer, String key, String metaKey)Returns the query rows transformed by Kotlin Serialization into instances of T. -
-
Method Detail
-
data
@ExperimentalSerializationApi() final static <T extends Any> T data(Result $self, String key)
Uses Kotlin Serialization to create an object of type T from a query result. If the key parameter is non-null, it uses the result's value for that key as the source, instead of the entire result.
For example, if your query is
SELECT name, age, shoeSize FROM peopleand you have a serializablePersonclass with propertiesname,ageandshoeSize, you can call:val person = result.data<Person>()Or you could use the query
SELECT * as person FROM peopleand create thePersonwithval person = result.data<Person>("person").
-
data
@ExperimentalSerializationApi() final static <T extends DocumentModel> T data(Result $self, String key, String metaKey)
Uses Kotlin Serialization to create a DocumentModel instance of type T from the query result. This is a specialization of the one-parameter data method that adds a metaKey parameter.
The metaKey parameter is the name of the result property whose value comes from the N1QL
meta()function; this is used to set the DocumentModel.documentMeta property of the result.For example, if your query is
SELECT * as person, meta() as meta FROM people, you would callresult.data<Person>("person", "meta").
-
data
@ExperimentalSerializationApi() final static <T extends Any> T data(Result $self, DeserializationStrategy<T> deserializer, String key, String metaKey)
-
data
@ExperimentalSerializationApi() final static <T extends Any> Sequence<T> data(ResultSet $self, String key)
Returns the query rows transformed by Kotlin Serialization into instances of T.
-
data
@ExperimentalSerializationApi() final static <T extends DocumentModel> Sequence<T> data(ResultSet $self, String key, String metaKey)
-
-
-
-