Data Types


Primitive Types

TypeDescription
intIntegers
stringStrings
decimalNumeric type e.g. 3.14 or 123
bigintlong integer
boolBoolean values e.g. true or false
dateDate
datetimeDate and time
uuidUUID type 4 (36 characters)
voidVoid type
blobBinary values e.g. photos
jsonNative type representing JSON objects. See here for more details.
jsonarrayNative type representing JSON arrays. See here for more details.

Variables of all primitive types are null after declaration, until assigned a value.




Custom Objects

The object keyword indicates the start of an object declaration. This must be followed by a unique object name and attribute block. Objects in the Helium DSL can be likened to structs in C.

Object Declaration Example
object Person 
{
	string fname;
	string sname;
	int age;
}

The persistent keyword indicates that an object will be saved to the database. It appears before the object definition.

Persistent Object Declaration Example
persistent object Person
{
    string fname;
    string sname;
    int age;
}

The _id attribute is also available from any persistent object. It is a uuid type.

 

You will typically use this object as follows:

// this creates a new instance of Person
Person person = Person:new();
 
// assign values to the fname and sname attributes
person.fname = "Anon";
person.sname = "Incognito";
 
// pass it to a function
sendWelcomeMessage(person);

Please note that a custom object instantiated and saved won't automatically update when another process changes its properties in the database, or when a relationship/link with another object is created but updated only on the other object and/or the database. In this case the aforementioned custom object needs to be refreshed/reinitialised to reflect the change.




Object Relationship Attributes

References (links) to other objects require one of the following attribute annotations:

  • @OneToOne
  • @ManyToOne
  • @ManyToMany
  • @OneToMany

For example, if one Person record can be linked to many other Person records via its children attribute, and many Persons can be linked to one House via the home attribute, the object is defined as:

object Person
{
    string name;
    @OneToMany
    Person children;
 
    @ManyToOne
    House home;
}




@NotTracked

By default, all changes to persistent objects will be logged in the change log. This is in turn used for syncing to the Journey mobile client. If there is not need for change tracking of a specific object, this logging can be turned of for the object in question by adding the @NotTracked object annotation:

@NotTracked
persistent object Person
{
    string name;
    int age;
}



Enumerated Types

Declare an enumeration with the enum keyword, followed by the enum's name (in all caps and underscores).

enum GENDER
{
    Male, Female
}




Additional Mentions and References