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
  • Driver.entity
  • Car.entity
  1. Models and entities

Examples

PreviousTagsNextModel creation

Last updated 5 months ago

Sample models are available here:

Below some entities examples:

Driver.entity

// Entity Driver
// Defines a person who is able to drive a car
Driver {
   id : long { @Id } ;
   firstName : string { @MaxLen(20) @NotEmpty } ;
   lastName  : string { @MaxLen(20) @NotEmpty } ;
   birthDate : date { @Past };
   certified : boolean ;
}

Car.entity

// Entity Car
// with autoincremented id
Car {
  // basic attributes
  id    : int { @Id @AutoIncremented } ; 
  name  : string { @SizeMax(40) } ;
  year  : short  { @Min(1900) @Max(2020) } ;
  price : float  { @Min(500)  @Max(99999) };
  
  // links (references to other entities)
  brand  : Brand ; // 1 Brand (ManyToOne)
  driver : Driver[] ; // N Driver (OneToMany)
}

https://github.com/telosys-models