Data formats

CSV Format

Working with CSV data in Orbital

To declare that a type should be read/written as Csv, add the com.orbitalhq.formats.Csv annotation to a model:

import com.orbitalhq.formats.Csv
@Csvmodel Person {  firstName : FirstName inherits String}

Csv options

The following options are available:

Parameter nameDescriptionDefault value
delimiterThe delimiter between records,
firstRecordAsHeaderIndicates if the first record should be read as a headertrue
nullValueSpecify a custom string to be read as null
containsTrailingDelimitersIndicates if each row contains a delimiter which should be ignoredfalse
quoteCharSpecifies which character should be read as a quoting character"

For example:

import com.orbitalhq.formats.Csv
@Csv(  delimiter = "|",  nullValue = "NULL")model Person {  firstName : String  lastName : String  age : Int}

Using column() references

It’s possible (but discouraged) to use by column("") references to declare a column:

model Person {  firstName : FirstName by column("fName")}