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
  • Types conversion
  • Annotations effects
  • Specific types
  • See also
  • Literal values
  • TRUE, FALSE, NULL
  • Generated literal values
  1. Target languages

Golang

PreviousC#NextJava

Last updated 1 year ago

To define Golang as the target language in a template file :

#set( $env.language = 'Go' )

The information below shows the behavior of the generator when Golang is the current target language. For a detailed description of type conversion, see the generated documentation :

Types conversion

The table below describes how model neutral types are automatically converted to Golang types with potential impact due to attribute annotations.

Model type
Go type
with annotation

string

string

byte

byte uint8

@UnsignedType

short

int16 uint16

@UnsignedType

int

int32 uint32

@UnsignedType

long

int64 uint64

@UnsignedType

decimal

float64

float

float32

double

float64

boolean

bool

date

time.Time

time

time.Time

timestamp

time.Time

binary

[ ] byte

Annotations effects

  • @UnsignedType has effect only for byte, short, int, long

  • @ObjectType no effect

  • @NotNull no effect

  • @PrimitiveType no effect

Specific types

  • $attribute.fullType no effect (always returns the standard Go type)

  • $attribute.simpleType

    no effect (always returns the standard Go type)

  • $attribute.wrapperType no effect (always returns the standard Go type)

So, for Golang you can always use the basic "$attribute.type"

See also

For more information about Golang types see :

Literal values

TRUE, FALSE, NULL

Golang literal

TRUE

true

FALSE

false

NULL

nil

Generated literal values

Below some examples of literal values generated for each type :

Model type
Golang type
Golang literal value

string

string

"AAA"

byte

byte

uint8

1

short

int16 uint16

1

int

int32 uint32

100

long

int64 uint64

1000

decimal

float64

10000.77

float

float32

1000.5

double

float64

1000.66

boolean

bool

true or false

date

time.Time

nil

time

time.Time

nil

timestamp

time.Time

nil

binary

[ ] byte

nil

https://www.telosys.org/doc/latest/languages/language-go.html
https://golang.org/ref/spec#Types