DataTree

@Type(id = "dataTree")
interface DataTree<out T : Any> : DataSet<T>

A tree-like DataSet grouped into the node. All data inside the node must inherit its type

Types

Companion
Link copied to clipboard
common
object Companion

Functions

flowData
Link copied to clipboard
common
open override fun flowData(): Flow<NamedData<T>>

Traverse this provider or its child. The order is not guaranteed.

getData
Link copied to clipboard
common
open suspend override fun getData(name: Name): Data<T>?

Get data with given name.

items
Link copied to clipboard
common
abstract suspend fun items(): Map<NameToken, DataTreeItem<T>>

Children items of this DataTree provided asynchronously

listTop
Link copied to clipboard
common
open suspend override fun listTop(prefix: Name): List<Name>

Get a snapshot of names of top level children of given node. Empty if node does not exist or is a leaf.

Properties

dataType
Link copied to clipboard
common
abstract val dataType: KType

The minimal common ancestor to all data in the node

Inheritors

ActiveDataTree
Link copied to clipboard

Extensions

branch
Link copied to clipboard
common
fun <T : Any> DataTree<T>.branch(branchName: Name): DataTree<T>

Get a branch of this DataTree with a given branchName. The difference from similar method for DataSet is that internal logic is more simple and the return value is a DataTree

getItem
Link copied to clipboard
common
suspend tailrec fun <T : Any> DataTree<T>.getItem(name: Name): DataTreeItem<T>?

Get a DataTreeItem with given name or null if the item does not exist

itemFlow
Link copied to clipboard
common
fun <T : Any> DataTree<T>.itemFlow(): Flow<Pair<Name, DataTreeItem<T>>>

Flow of all children including nodes