Package-level declarations

Utilities for referencing variables and classes.

User::_id                          // _id
User::profile / Profile::name // profile.name
User::friends[1] / Friend::name // friends.$1.name

This package contains a low-level type-unsafe implementation of arbitrary document paths, and a high-level type-safe wrapper that provides the above utility functions.

Note that some functions are only provided when the FieldDsl is into scope (which should be done automatically by most operators). This means that you should rarely need to import anything for these functions to be available.

Operators

Types

Link copied to clipboard
interface Field<in Root, out Type>

High-level, typesafe pointer to a specific field in a document.

Link copied to clipboard
interface FieldDsl

DSL to refer to fields, usually automatically added into scope by operators.

Link copied to clipboard
data class Path(val segment: PathSegment, val parent: Path?)

Low-level, type-unsafe pointer to a specific field in a document.

Link copied to clipboard
sealed class PathSegment

Single segment in a Path.

Functions

Link copied to clipboard
operator fun Path.div(path: Path): Path

Returns a new Path instance that is the concatenation of the current path and a child path.

operator fun Path.div(segment: PathSegment): Path

Returns a new Path instance that is the concatenation of the current path and a segment.

Link copied to clipboard
operator fun <Root, Type> Field<Root, Collection<Type>>.get(index: Int): Field<Root, Type>

Refers to a specific item in an array, by its index.

operator fun <Root, Type> Field<Root, Map<String, Type>>.get(key: String): Field<Root, Type>

Refers to a specific item in a map, by its name.

Link copied to clipboard
fun Path(root: String): Path

Creates a root path from the provided root field name.