-
Notifications
You must be signed in to change notification settings - Fork 41
Data Types
FIT Base Types and regular types are mapped to Go types as follows:
| FIT Base Type | Go type |
|---|---|
| enum | byte |
| sint8 | int8 |
| uint8 | uint8 |
| sint16 | int16 |
| uint16 | uint16 |
| sint32 | int32 |
| uint32 | uint32 |
| string | string |
| float32 | float32 |
| float64 | float64 |
| uint8z | uint8 |
| uint16z | uint16 |
| uint32z | uint32 |
| byte | byte |
The Go type is set to the same invalid value as specified in SDK if invalid
(i.e. 0xFF for byte etc).
Each FIT Type is declared as Go type with the appropriate base type as the
underlying type (see the table above). Each type implements the Stringer
interface.
-
Go type
time.Timeis used for FIT typesdate_timeandlocal_date_time -
A FIT coordinate field (ending in
_lator_longand of typesint32) is stored as typefit.Latitiudeorfit.Longitude. -
An FIT array field is stored as a slice of the appropriate Go type described above.
-
Scaled fields can be accessed using getter methods. They are named
GetFoofield()and return the field as afloat64with any scale and offset applied.NaNis returned if the underlying field has an invalid value (i.e. is not set). -
A Dynamic Field can have a different type depending on the reference fields. Type resolution is done using generated Get-methods for each dynamic field.