Files
ingey/wit/dynamic_node.wit
vato007 70248de192
All checks were successful
test / test (push) Successful in 14m4s
Add most of the dynamic node host implementations
2025-01-23 07:48:59 +10:30

47 lines
1.3 KiB
Plaintext

package vato007:ingey;
interface types {
resource csv-row {
columns: func() -> list<string>;
values: func() -> list<string>;
entries: func() -> list<tuple<string, string>>;
value: func(name: string) -> option<string>;
}
resource csv-reader {
columns: func() -> list<string>;
next: func() -> result<csv-row, string>;
next-into-map: func() -> read-map;
has-next: func() -> bool;
// Get a row by values in one or more columns
query: func(values: list<tuple<string, string>>) -> csv-row;
read-into-string: func() -> string;
}
resource write-map {
keys: func() -> list<string>;
put: func(name: string, value: string);
}
resource csv-readers {
get-reader: func(name: string) -> option<csv-reader>;
}
resource csv-writer {
write-map: func(row: write-map);
write-row: func(row: list<tuple<string, string>>);
}
resource read-map {
get: func(key: string) -> option<string>;
}
}
// This will apply to csv files only for simplicity. A separate node should be created for arbitrary readers/writers
world dynamic {
use types.{csv-readers, read-map, csv-writer};
export evaluate: func(properties: read-map, readers: csv-readers, writer: csv-writer);
}