Documentation ¶
Overview ¶
Package mdg is the Model Driven Generator Toolbox for [qb]MDD.
Index ¶
- Constants
- Variables
- func HasDerivedDiamond(c *mdd.Class) bool
- func HasEntityBase(c *mdd.Class) bool
- func LessByName[T interface{ ... }](s, t T) bool
- func NameCmp(l, r mdd.Name) int
- func PtrID(p any) string
- func TemplateFuncs() map[string]any
- type AfterClass
- type AfterModel
- type AfterPackage
- type AssocEndVisitor
- type AssociationVisitor
- type AttributeVisitor
- type BeforeClass
- type BeforeModel
- type BeforePackage
- type ClassVisitor
- type DepthFirst
- type DocTag
- type GenDir
- type MergeConfig
- type MergeInput
- type MergedFile
- type ModelVisitor
- type NumIDTag
- func (t *NumIDTag) BeginPackage(p *mdd.Package) error
- func (*NumIDTag) EndPackage(*mdd.Package) error
- func (t *NumIDTag) OnAssociation(a *mdd.Association) error
- func (t *NumIDTag) OnAttribute(a *mdd.Attribute) error
- func (t *NumIDTag) OnType(u mdd.Type) error
- func (t NumIDTag) Tag(m *mdd.Model) error
- type OnAssocEnd
- type OnAssociation
- type OnAttribute
- type OnType
- type PackageVisitor
- type PkgsByDeps
- type TourGuide
- type TypeVisitor
Constants ¶
const ( Snake = "_" Kebab = "-" )
For use with mdd.Name.Join
Variables ¶
var GenIDTag genIDTag
GenIDTag is MMD's standard tag for attaching a unique ID to any mdd/mmb.Taggable model element.
Functions ¶
func HasDerivedDiamond ¶ added in v0.9.1
func HasEntityBase ¶ added in v0.9.1
func LessByName ¶ added in v0.11.2
func TemplateFuncs ¶
Types ¶
type AfterClass ¶ added in v0.5.0
func (AfterClass) BeginClass ¶ added in v0.5.0
func (v AfterClass) BeginClass(m *mdd.Class) error
type AfterModel ¶ added in v0.5.0
func (AfterModel) BeginModel ¶ added in v0.5.0
func (v AfterModel) BeginModel(m *mdd.Model) error
type AfterPackage ¶ added in v0.5.0
func (AfterPackage) BeginPackage ¶ added in v0.5.0
func (v AfterPackage) BeginPackage(m *mdd.Package) error
func (AfterPackage) EndPackage ¶ added in v0.5.0
func (v AfterPackage) EndPackage(*mdd.Package) error
type AssocEndVisitor ¶ added in v0.9.1
type AssociationVisitor ¶ added in v0.5.0
type AssociationVisitor interface {
OnAssociation(*mdd.Association) error
}
type AttributeVisitor ¶ added in v0.5.0
type BeforeClass ¶ added in v0.5.0
func (BeforeClass) BeginClass ¶ added in v0.5.0
func (v BeforeClass) BeginClass(m *mdd.Class) error
type BeforeModel ¶ added in v0.5.0
func (BeforeModel) BeginModel ¶ added in v0.5.0
func (v BeforeModel) BeginModel(m *mdd.Model) error
type BeforePackage ¶ added in v0.5.0
func (BeforePackage) BeginPackage ¶ added in v0.5.0
func (v BeforePackage) BeginPackage(m *mdd.Package) error
func (BeforePackage) EndPackage ¶ added in v0.5.0
func (v BeforePackage) EndPackage(*mdd.Package) error
type ClassVisitor ¶ added in v0.5.0
type DepthFirst ¶ added in v0.5.0
type DepthFirst TourGuide
type MergeConfig ¶
type MergeConfig struct { // TempFile returns a temporary file name for a given file. If nil, a '~' // will be appended to create temporary file names. TempFile func(string) string // GenFile returns the name for the last generated version of a file. If // nil, "-gen" will be appended to the filename. GenFile func(string) string // If not nill PostProc will be called on the generated output right after // that file has bee closed. E.g. use this to call gofmt on generated // output. PostProc func(file string) error // If MkDirs is 0 MergeFile will not create any directories. Otherwise it // will use MkDirs as the file mode to create the directories. MkDirs fs.FileMode // Set the external 3-way-merge tool to do the actual merge. Default is // diff3. MergeTool string // Specify how the arguments are passed to MergeTool. Strings are passed // directly to MergeTool. MergeInput elemets map to the respective input // file name. Default is [-m, NewGenFile, OldGenFile, EditedFile]. MergeArgs []any }
type MergeInput ¶ added in v0.9.1
type MergeInput int
MergeInput is to be used in MergeConfig.MergeArgs.
const ( OldGenFile MergeInput = iota NewGenFile EditedFile )
func (MergeInput) Select ¶ added in v0.9.1
func (i MergeInput) Select(oldGen, newGen, edited string) string
type MergedFile ¶
type MergedFile struct {
// contains filtered or unexported fields
}
MergedFile implements a writer that used the diff3 tool to merge generated output with a manually modified version. To make this work, MergedFile also has to keep the last generated version of a file around. Alternatively you could use a separate "generator branch" in your VCS.
func NewMergedFile ¶
func NewMergedFile(name string, cfg *MergeConfig) (*MergedFile, error)
func (*MergedFile) Close ¶
func (f *MergedFile) Close() error
func (*MergedFile) MustClose ¶ added in v0.9.1
func (f *MergedFile) MustClose()
type ModelVisitor ¶ added in v0.5.0
type NumIDTag ¶ added in v0.5.0
type NumIDTag int
NumIDTag generates unique IDs by incrementally counting tags. It implements the respective visitor interfaces so that you can attach IDs to any model with the TourGuide of your choice.
func (*NumIDTag) BeginPackage ¶ added in v0.5.0
func (*NumIDTag) OnAssociation ¶ added in v0.5.0
func (t *NumIDTag) OnAssociation(a *mdd.Association) error
func (*NumIDTag) OnAttribute ¶ added in v0.5.0
type OnAssocEnd ¶ added in v0.9.1
type OnAssociation ¶ added in v0.5.0
type OnAssociation func(*mdd.Association) error
func (OnAssociation) OnAssociation ¶ added in v0.5.0
func (v OnAssociation) OnAssociation(a *mdd.Association) error
type OnAttribute ¶ added in v0.5.0
func (OnAttribute) OnAttribute ¶ added in v0.5.0
func (v OnAttribute) OnAttribute(m *mdd.Attribute) error
type PackageVisitor ¶ added in v0.5.0
type PkgsByDeps ¶ added in v0.5.0
func NewPkgsByDeps ¶ added in v0.5.0
func NewPkgsByDeps(m *mdd.Model) PkgsByDeps