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 name | Description | Default value |
|---|---|---|
| delimiter | The delimiter between records | , |
| firstRecordAsHeader | Indicates if the first record should be read as a header | true |
| nullValue | Specify a custom string to be read as null | |
| containsTrailingDelimiters | Indicates if each row contains a delimiter which should be ignored | false |
| quoteChar | Specifies 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")}