Scala library providing convenient and fast access to reference data
Changes should not be done to this repository direcly.
This library wraps the source data provided by the Flow Reference Project. Therefore, if new reference data needs to be added, it should be added to json-reference first. After changes are merged in the json-reference, the code generate has to be invoked here.
Find more details about how references are organized and managed here.
"io.flow" %% "lib-reference-scala" % "0.1.43"
Find a country by 2 or 3 character iso code, or exact name
Countries.find("CH")
Same as above, but throws an error if not found
Countries.mustFind("CHN")
Iterate through all countries:
data.Countries.all.foreach { c =>
println(c.name)
}
Validate input, returning a friendly error message:
Countries.validate(Seq("Fra", "Mars"))
We recommend viewing the project tests to see detailed usage examples for all of the types of reference data:
go run script/generate.go
sbt compile