Telosys doc
WebsiteTwitterLinkedInNews
  • Telosys documentation
  • Telosys CLI
    • Installation on Linux
    • Installation on Windows
    • CLI configuration
    • CLI commands
    • Getting started
  • Telosys with VSCode
    • Extension installation
    • VSCode settings
    • Telosys terminal in VSCode
    • Telosys editor configuration
  • Telosys with JetBrains IDE
  • Project configuration
  • Project variables
  • Project databases
  • Models and entities
    • Model structure
    • Entity
    • Attribute / Link
    • Annotations
    • Tags
    • Examples
    • Model creation
    • Model installation
    • Models management
  • Bundles of templates
    • Bundle structure
    • Bundle creation
    • Bundles installation
    • Bundles management
    • Velocity language
    • Velocity directives
    • Velocity object types
    • Telosys directives
    • Telosys variables
    • Telosys objects
    • Code snippets
  • Code generation
    • "gen" command
    • "genb" command
  • Target languages
    • C++
    • C#
    • Golang
    • Java
    • JavaScript
    • Kotlin
    • PHP
    • Python
    • Scala
    • TypeScript
  • Target databases (SQL)
    • Predefined rules
    • Specific rules
    • Type size and precision
  • Telosys with Git
    • GitHub usage
    • Install with Git
    • Publish with Git
  • Support the project
  • How to contribute
  • Sponsors
  • IDE and editors
  • Telosys 3 Eclipse plugin
    • Eclipse plugin installation
    • Eclipse customization
    • Telosys 3 database model
Powered by GitBook
On this page
  • Syntax
  • Name
  • Attribute type
  • Link type
  1. Models and entities

Attribute / Link

Syntax

An attribute or link definition is composed of the following elements :

  • name

  • ":" (separator)

  • type (basic attribute type or referenced entity for a link)

  • further information (optional) defined between "{" and "}"

    • annotations (optional)

    • tags (optional)

  • ";" (end of definition)

Syntax :

name : type { annotations and tags } ;

An attribute or link definition can span multiple lines. Example :

name : type { 
            annotations 
            tags } ;

Name

The name can be composed of : letters, numbers and "_" (underscore). Other characters are not allowed. By convention the name usually starts with a lower case character.

Each name must be unique in the entity.

Examples of valid attribute names :

  • age

  • firstName

  • first_name

  • flag12

Examples of invalid attribute names :

  • flag#12 ( "#" not allowed )

  • first-name ( "-" not allowed )

  • $code ( "$" not allowed )

Attribute type

An attribute is a simple and unitary piece of data such as a string, a number, etc. Its type is defined by a "neutral type" independent of any programming language. Each "neutral type" will be converted into the target language type during generation. Telosys offers automatic conversion for most used languages (Java, C#, etc).

Available neutral types :

  • binary

  • boolean

  • byte

  • date

  • decimal

  • double

  • float

  • int

  • long

  • short

  • string

  • time

  • timestamp

Link type

A link is a reference to another entity. It's a relationship with a cardinality (one to many, many to one, etc). So the type is the referenced entity name. Of course, the referenced entity must exist in the model (at least the entity file). To reference a collection of entities just add "[ ]" after the entity name.

Examples :

  • Driver (to reference a single Driver instance, "0..1" cardinality)

  • Driver[ ] (to reference a collection of Driver instances, "0..N" cardinality)

PreviousEntityNextAnnotations

Last updated 5 months ago