Documentation ¶
Index ¶
- Constants
- type BoundedContext
- type CRUD
- type Ctx
- type Error
- type Executable
- type Field
- type Generator
- type Glossary
- type GoDist
- type Golang
- type Injection
- type Interface
- type Method
- type Module
- type Package
- type Param
- type PersistenceType
- type Preamble
- type Project
- type Service
- type Struct
- type Term
- type TypeDecl
Constants ¶
const ( PMemory PersistenceType = "in-memory" PFile = "file" PMySQL = "mysql" )
const ( // DTO is a data transfer stereotype. DTO = "dto" // Cfg is a configuration stereotype. Cfg = "cfg" // ServiceComponent is a service stereotype. ServiceComponent = "service" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoundedContext ¶
type BoundedContext struct { Name token.String Path token.String Core []*Package // multiple core packages are allowed, to allow arbitrary large and complex nested (sub or supporting) domains. Usecase []*Package // same for the use cases }
A BoundedContext is a cross-cutting thing, which is referenced from various places and contains its own ubiquitous language (== glossary).
func NewBoundedContext ¶
func NewBoundedContext(name, path string) *BoundedContext
func (*BoundedContext) AddCore ¶
func (d *BoundedContext) AddCore(l ...*Package) *BoundedContext
func (*BoundedContext) AddUsecase ¶
func (d *BoundedContext) AddUsecase(l *Package) *BoundedContext
func (*BoundedContext) Normalize ¶
func (d *BoundedContext) Normalize(ctx Ctx)
Normalize rewrites all path like things.
type CRUD ¶
type CRUD struct { EntityType *TypeDecl // the actual data type or io.ReadWriter for a generic stream api IDType *TypeDecl // optional custom id type (empty if ID field in EntityType must be used) Persistence PersistenceType InsertOne, FindOne, UpdateOne, DeleteOne bool CountAll, FindAll, IterateAll bool }
CRUD represents an autogenerated piece of code to manage entities.
type Executable ¶
type Executable struct { Comment token.String Name token.String BoundedContextPaths []token.String }
An Executable defines an entry point into the application. At least Java and Go support an arbitrary set of main entry points.
func NewExecutable ¶
func NewExecutable(name, comment string) *Executable
func (*Executable) Application ¶
func (e *Executable) Application(paths ...string) *Executable
func (*Executable) Normalize ¶
func (e *Executable) Normalize(ctx Ctx)
type Field ¶
type Field struct { Comment token.String Name token.String Type *TypeDecl Private bool CfgCmdLineFlag bool }
func NewPrivateField ¶
func (*Field) SetCfgCmdLineFlag ¶
SetCfgCmdLineFlag is only valid within a struct configuration stereotype.
type Generator ¶
type Generator struct { Go *Golang OutDir token.String // the target directory to (re) write the module }
A Generator describes how this project should be generated.
func NewGenerator ¶
func NewGenerator() *Generator
type Glossary ¶
func NewGlossary ¶
func NewGlossary() *Glossary
type Golang ¶
type Golang struct { Module token.String // the name of the go module, e.g. github.com/worldiety/supportiety GoDist []*GoDist Requires []token.String // require directives }
Golang describes how a Go project (or module) must be created or updated.
func (*Golang) SetModName ¶
type Injection ¶
type Injection struct { Comment token.String // why is this needed? Name token.String // usually the field name, but also as a reference/documentation name Stereotype token.String // optional stereotype to indicate the type. Type *TypeDecl }
func NewInjection ¶
type Method ¶
type Method struct { Comment token.String Name token.String In []*Param Out []*Param Errors []*TypeDecl // sum type of error types. Non-qualified names are always resolved to package local declarations or fail. StubDefault bool // StubDefault instructs the generator to emit an abstract or default implementation }
type Module ¶
type Module struct { Preamble Preamble Name token.String // the name of the project Comment token.String Generator *Generator BoundedContexts []*BoundedContext Executables []*Executable }
A Module is e.g. a server application, a frontend or a shared library.
func (*Module) AddBoundedContexts ¶
func (p *Module) AddBoundedContexts(d ...*BoundedContext) *Module
func (*Module) AddExecutables ¶
func (p *Module) AddExecutables(e ...*Executable) *Module
func (*Module) SetGenerator ¶
func (*Module) SetLicense ¶
type Package ¶
type Package struct { Comment token.String Name token.String Repositories []*Interface Services []*Service DTOs []*Struct Errors []*Error }
func NewPackage ¶
func (*Package) AddRepositories ¶
func (*Package) AddServices ¶
func (*Package) AddStructs ¶
type PersistenceType ¶
type PersistenceType string
type Project ¶
A Project has multiple modules, like libraries, servers or clients, frontends or backends.
func NewProject ¶
func (*Project) AddModules ¶
func (*Project) PutGlossary ¶
type Service ¶
type Service struct {
Component *Struct
}
func NewService ¶
func (*Service) AddInjections ¶
func (*Service) AddMethods ¶
type Struct ¶
type TypeDecl ¶
A TypeDecl is the generified declaration of named types, consisting of full qualified name, a pointer flag and optionally nested other type parameters.
func NewTypeDecl ¶
func (*TypeDecl) IsArray ¶
IsArray checks for [] and expects exactly 2 TypeParams (first is len, second the actual type).