pkg

package
v0.0.0-...-1658596 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompositionUml

func CompositionUml(source string, rel Rel) string

func CompositionsUml

func CompositionsUml(source string, compositions []Rel) (result []string)

func EnumUml

func EnumUml(enum Enum) string

func EnumsUml

func EnumsUml(enums []Enum) (result []string)

func FieldUml

func FieldUml(field Field) string

func FieldsUml

func FieldsUml(fields []Field) (result []string)

func Gen

func Gen(source string) string

func Generate

func Generate(structs []Struct, enums []Enum) (result string)

func GetEnumValues

func GetEnumValues(f map[string]*ast.Package, enumName string) (result []string)

func GetTypeName

func GetTypeName(t ast.Expr) string

func InferredRelationUml

func InferredRelationUml(source string, rel Rel) string

func InferredRelationsUml

func InferredRelationsUml(source string, relations []Rel) (result []string)

func ListEnum

func ListEnum(f map[string]*ast.Package) (result []*ast.TypeSpec)

func ListStructTypeSpecs

func ListStructTypeSpecs(f map[string]*ast.Package) (result []*ast.TypeSpec)

func StructUml

func StructUml(s Struct) string

func StructsUml

func StructsUml(structs []Struct) (result []string)

Types

type Cardinality

type Cardinality = string
const AtLeastOne Cardinality = "1..*"
const ExactOne Cardinality = "1"
const Many Cardinality = "0..*"
const MaxOne Cardinality = "0..1"

func GetTypeInfo

func GetTypeInfo(t ast.Expr) (fullName string, elementName string, many Cardinality)

type Enum

type Enum struct {
	Name   string
	Values []string
}

func GetEnums

func GetEnums(f map[string]*ast.Package) []Enum

type Field

type Field struct {
	Name        string
	Type        string
	ElementType string //if type is an array or map
	Card        Cardinality
}

func GetStructFields

func GetStructFields(spec *ast.TypeSpec) (result []Field)

type Rel

type Rel struct {
	StructName        string
	SourceCardinality Cardinality
	TargetCardinality Cardinality
}

type Struct

type Struct struct {
	Name   string
	Fields []Field

	//relations
	Compositions      []Rel
	InferredRelations []Rel
}

func GetStructs

func GetStructs(f map[string]*ast.Package) []Struct

func SetCompositions

func SetCompositions(structs []Struct, enums []Enum) (result []Struct)

func SetInferredRelations

func SetInferredRelations(structs []Struct) (result []Struct)

func SetRelations

func SetRelations(structs []Struct, enums []Enum) (result []Struct)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL