api

package
v0.0.0-...-3e64681 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: BSD-2-Clause Imports: 6 Imported by: 0

README

This is the README of package 'api'.

Documentation

Index

Examples

Constants

View Source
const (
	StereotypeConstructor     = "constructor" // the constructor of a struct
	StereotypeMethod          = "method"
	StereotypeSingleton       = "singleton"
	StereotypeEnum            = "enum"
	StereotypeEnumElement     = "enumElement"
	StereotypeDestructor      = "destructor" // the destructor of a struct
	StereotypeExecutable      = "executable"
	StereotypeStruct          = "struct"
	StereotypeClass           = "class"
	StereotypeProperty        = "property"
	StereotypeParameter       = "parameter"
	StereotypeParameterIn     = "in"
	StereotypeParameterOut    = "out"
	StereotypeParameterResult = "result"
	StereotypeGeneric         = "generic"
)

Doc for a const block

Variables

This section is empty.

Functions

func TestFunc

func TestFunc(s string) string

Types

type AddressBookPerson

type AddressBookPerson Person

type AddressBookPerson2

type AddressBookPerson2 struct {
	Firstname, Last string
}

type BetterPerson

type BetterPerson = Person

type Constant

type Constant struct {
	RefId   RefId
	Value   any
	Comment string
}

func NewConstant

func NewConstant(refId RefId, comment string, value any) Constant

type ConstantBlock

type ConstantBlock struct {
	Doc     string
	Content []Constant
}

func NewConstantBlock

func NewConstantBlock(consts []Constant, doc string) ConstantBlock

type Field

type Field struct {
	TypeDesc *TypeDesc
	Name     string
	Comment  string
	Doc      string
	// ParentStruct test
	ParentStruct *Struct // the struct, this field is a property of
	Stereotypes  []Stereotype
}

func NewField

func NewField(name, comment string, doc string, t *TypeDesc, parent *Struct) *Field

type Function

type Function struct {
	TypeDefinition RefId
	Name           string
	Comment        string
	Signature      string
	Parameters     map[string]*Field
	Results        map[string]*Field
}

type Generics

type Generics []*Field

type Import

type Import string

type ImportPath

type ImportPath = string

type Imports

type Imports []Import

func (Imports) Len

func (p Imports) Len() int

func (Imports) Less

func (p Imports) Less(i, j int) bool

func (Imports) Sort

func (p Imports) Sort()

func (Imports) Swap

func (p Imports) Swap(i, j int)

type List

type List[T, X any, V Constant] struct {
}
Example
myList := List[string, string, Constant]{}
myList.Add("hello world")
Output:

func (*List[T, X, V]) Add

func (l *List[T, X, V]) Add(t T)
Example
myList := List[string, int, Constant]{}
myList.Add("add example")
fmt.Print("Hello")
Output:

"Hello"

type MapType

type MapType struct {
	KeyType, ValueType *TypeDesc
}

type Method

type Method struct {
	*Function
	Recv *Recv
}

type Module

type Module struct {
	Readme   string
	Name     string
	Packages map[ImportPath]*Package
}

A Module contains various Package Pointers. There is also

  • a readme and
  • a name

A caption

Is defined as in markdown. And we have also indented stuff like so:

   Module.Packages can be accessed directly.
	        and is formatted like pre.

type Package

type Package struct {
	PackageDefinition RefId
	Readme            string
	Doc               string
	Name              string
	Imports           Imports
	Stereotypes       []Stereotype
	Types             map[string]RefId
	Consts            []ConstantBlock
	Vars              map[string]*Variable
	Functions         map[string]*Function
	Structs           map[string]*Struct
}

type Person

type Person struct {
	Firstname, Last string
}

type Recv

type Recv struct {
	*Field
	Name       string
	TypeString string
}

func NewRecv

func NewRecv(f *Field, name, ts string) *Recv

type RefId

type RefId struct {
	ImportPath ImportPath
	Identifier string
}

func NewRefID

func NewRefID(importPath, identifier string) RefId

func (RefId) ID

func (id RefId) ID() string

func (RefId) Named

func (id RefId) Named() bool

func (RefId) PackageName

func (id RefId) PackageName() string

type Stereotype

type Stereotype string

Stereotype as usually interpreted in found context but not expressed in language explicitly.

type Struct

type Struct struct {
	TypeDefinition     RefId
	Comment            string
	Name               string
	Fields             []*Field
	Methods            []*Method
	Generics           Generics
	Constructors       []*Function
	WhiteSpaceInFields int
}

type Test2

type Test2 func() string

type TypeDesc

type TypeDesc struct {
	TypeDefinition    RefId
	SrcTypeDefinition string
	Pointer           bool
	Linebreak         bool
	MapType           *MapType
	TypeOrigin        TypeOrigin
}

func NewTypeDesc

func NewTypeDesc(ref RefId, srcTypeDef string, pointer bool, mapType *MapType) *TypeDesc

func (TypeDesc) Array

func (td TypeDesc) Array() bool

func (TypeDesc) Identifier

func (td TypeDesc) Identifier() string

func (TypeDesc) IncludesPkg

func (td TypeDesc) IncludesPkg() (bool, string)

func (TypeDesc) Map

func (td TypeDesc) Map() bool

func (TypeDesc) MapSrcDefs

func (td TypeDesc) MapSrcDefs() (string, string)

func (TypeDesc) PkgName

func (td TypeDesc) PkgName() string

type TypeOrigin

type TypeOrigin int
const (
	BuiltIn TypeOrigin = iota
	LocalCustom
	ExternalCustom
	ExternalNonCustom
)

type Variable

type Variable Field

func NewVariable

func NewVariable(name, comment, doc string, t *TypeDesc) *Variable

type Vector

type Vector = List[any, any, Constant]

Jump to

Keyboard shortcuts

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