Open Zelenyy opened 4 years ago
val Rows.names : List<String> get() = header.map{it.name}
val Rows.types<KClass<out T>> : List<KClass<out T>> get() = header.map{it.type}
We can't completely avoid strings since they are primary identifiers for columns. It is possible to make a generic ID-s but it would significantly complicate API without a lot of added value. Currently it is not necessary to use string each time. Once column header is created, it could be used to access column like
val header = ...
val value = table[8 , header]
I will add some kind of method to access columns the same way. Like table[header]
or `table.columns[header]
.
I do not want to allow headless columns at all since I have no understanding how to tread them.
We can use Row
schema to wrap actual rows in a way similar to what we do in plotly.kt. I will create a separate issue for that.
Maybe some extensions for number columns.
Primary numeric index is necessary in tables (not necessary in Rows
). But old table version had optional additional indexes for fast queries. I think we will do it later.
OK, you can do it yourself. The only question is whether we want to guarantee order of columns or not. Currently it is not guaranteed on API level. To fix it we need to raplace Collection
with List
in API.
It is checked in a builder. It should be impossible to construct a table with different column size.
More better have independent column id