Go


Interfaces

  1. Create an interface element.

Golang Example Code

// ˅

package main


// ˄


type Foo interface {

// ˅

// ˄

}


// ˅


// ˄



Enumerations

  1. Click a class element.

  2. Select the Stereotype tab.

  3. Enter "enum" in the Name.

Golang Example Code

// ˅

package main


// ˄


type Foo int


const (

Red Foo = iota + 1


Green


Blue


// ˅

// ˄

)


// ˅


// ˄



Constructors

  1. Create a operation element having "New" at the beginning of the operation name.

NOTE: If the operation name starts with "New", no receiver is inserted in the argument of the operation.

Golang Example Code

// ˅

package main


// ˄


type Foo struct {

// ˅

// ˄


// ˅

// ˄

}


func NewFoo() Foo {

// ˅

// ˄

}


// ˅


// ˄



Type Embedding

  1. Create compositions with an <<embed>> stereotype.

Golang Example Code

// ˅

package main


// ˄


type Foo struct {

// ˅

// ˄


Bar


// ˅

// ˄

}


// ˅


// ˄