Class is analogous to database table. Classes are defined under individual data sources.
A new class requires following specifications.
Property | Type | Description |
---|---|---|
name | string | Name of the Class |
displayName | string | User friendly name |
primaryKeyGenerator | string | Serial Id (default) | UUID |
tableCreateable | boolean | Flag indicating whether table is created on the DB server (default:true) |
The optional parameters are listed below.
Property | Type | Description |
---|---|---|
nameInDS | string | Name of the table inside the DB server |
attributes | list | An attribute if persistent by default correspond to a database column. |
associations | list | Association creates parent-child relationship among multiple classes (tables) |
dsSqlTemplates | list | This is list of sql templates. Each template specifies SQL statement that will be executed on the server side when the API is called with the template name as parameter. The template is parameterized using Mustache notation. It is described in detail in another section. |
When a new class is created, its JSON representation will be similar to the following.
By default, every new class has couple of known attributes (columns) namely id, name, createdAt, updatedAt, deleted, deletedAt.
{
"name" : "class1",
"attributes" : [
{
"name" : "id",
"type" : "biginteger",
"persistent" : true,
"primaryKey" : true,
"systemAttr" : true
},
{
"name" : "name",
"type" : "string",
"persistent" : true
},
{
"name" : "createdAt",
"type" : "biginteger",
"persistent" : true,
"systemAttr" : true
},
{
"name" : "updatedAt",
"type" : "biginteger",
"persistent" : true,
"systemAttr" : true
},
{
"name" : "deleted",
"type" : "boolean",
"persistent" : true,
"systemAttr" : true
},
{
"name" : "deletedAt",
"type" : "biginteger",
"persistent" : true,
"systemAttr" : true
}
],
"displayName" : "Class for My Objects",
"nameInDS" : "class1_tbl",
"primaryKeyGenerator" : "serial",
"tableCreateable" : true
}