data Group
Group produced by group by … into g in query expressions (§5.9).
Example:
data Sale { shop: str; amount: i64 }
fn main() io {
let sales = [Sale{ shop: "a", amount: 5 }, Sale{ shop: "b", amount: 7 }, Sale{ shop: "a", amount: 1 }]
for line in from s in sales group by s.shop into g select "{g.key}={g.items.len()}" {
print(line)
}
}Output
a=2 b=1
pub(api) data Group<K, T>Since. 1.0.0-beta
Fields
pub(api) key: K | The key of the group. |
pub(api) items: List<T> | The elements with this key, in order. |
Methods
count | () -> usizeNumber of elements of the group (g.count() in group by … |
Defined in: std/core/types.oxl:778