example:
type person = { name : string
; age : int
}
db /person : intmap(person)
I know how to get a single person from the db, but how do I get them all? and print them in a html table?
Thx.
example:
type person = { name : string
; age : int
}
db /person : intmap(person)
I know how to get a single person from the db, but how do I get them all? and print them in a html table?
Thx.
I advise you to use Db.intmap_fold_range instead of InMap.fold. It will be faster than InMap.fold which need to build the all map in OPA before folding on it.
http://opalang.org/resources/doc/index.html#db.opa.html/!/value_stdlib.core.db.Db.intmap_fold_range
Here is an example for your type:
Following @shomodj comment on my answer, this is my complete code to print the persons list (inspired by Cédrics code)
Simply put:
This should do it :
... and then call render() in your server page ...