Documentation
¶
Index ¶
- Variables
- type CodeGenerationBase
- func (c *CodeGenerationBase) GetGlobalAndModelAttributes(targetLang globalValues.LanguageType, name string, ...) *cclValues.AttributesCollection
- func (c *CodeGenerationBase) GetGlobalAttribute(targetLang globalValues.LanguageType, name string) *cclValues.AttributeUsageInfo
- func (c *CodeGenerationBase) GetGlobalAttributes(targetLang globalValues.LanguageType, name string) []*cclValues.AttributeUsageInfo
- func (c *CodeGenerationBase) GetGlobalOrModelAttribute(targetLang globalValues.LanguageType, name string, ...) *cclValues.AttributeUsageInfo
- func (c *CodeGenerationBase) GetGlobalOrModelAttributes(targetLang globalValues.LanguageType, name string, ...) *cclValues.AttributesCollection
- func (c *CodeGenerationBase) GetModelAndGlobalAttributes(targetLang globalValues.LanguageType, name string, ...) *cclValues.AttributesCollection
- func (c *CodeGenerationBase) GetModelOrGlobalAttribute(targetLang globalValues.LanguageType, name string, ...) *cclValues.AttributeUsageInfo
- func (c *CodeGenerationBase) GetModelOrGlobalAttributes(targetLang globalValues.LanguageType, name string, ...) *cclValues.AttributesCollection
- func (c *CodeGenerationBase) NeedsBinarySerialization(targetLang globalValues.LanguageType, currentModel *cclValues.ModelDefinition) bool
- func (c *CodeGenerationBase) NeedsCloneMethods(targetLang globalValues.LanguageType, currentModel *cclValues.ModelDefinition) bool
- func (c *CodeGenerationBase) NeedsJsonSerialization(targetLang globalValues.LanguageType, currentModel *cclValues.ModelDefinition) bool
- func (c *CodeGenerationBase) NeedsSerializationType(targetLang globalValues.LanguageType, currentModel *cclValues.ModelDefinition, ...) bool
- type CodeGenerationOptions
- type CodeGenerationResult
- type GenerateCode
Constants ¶
This section is empty.
Variables ¶
var CodeGenerators = map[string]GenerateCode{}
var (
ErrLanguageNotSupported = errors.New("language not supported")
)
Functions ¶
This section is empty.
Types ¶
type CodeGenerationBase ¶
type CodeGenerationBase struct {
Options *CodeGenerationOptions
}
func (*CodeGenerationBase) GetGlobalAndModelAttributes ¶
func (c *CodeGenerationBase) GetGlobalAndModelAttributes( targetLang globalValues.LanguageType, name string, currentModel *cclValues.ModelDefinition, ) *cclValues.AttributesCollection
GetGlobalAndModelAttributes retrieves all attributes with the specified name from both global attributes and the current model.
func (*CodeGenerationBase) GetGlobalAttribute ¶
func (c *CodeGenerationBase) GetGlobalAttribute( targetLang globalValues.LanguageType, name string, ) *cclValues.AttributeUsageInfo
GetGlobalAttribute retrieves a global attribute with the specified name.
func (*CodeGenerationBase) GetGlobalAttributes ¶
func (c *CodeGenerationBase) GetGlobalAttributes( targetLang globalValues.LanguageType, name string, ) []*cclValues.AttributeUsageInfo
GetGlobalAttributes retrieves all global attributes with the specified name.
func (*CodeGenerationBase) GetGlobalOrModelAttribute ¶
func (c *CodeGenerationBase) GetGlobalOrModelAttribute( targetLang globalValues.LanguageType, name string, currentModel *cclValues.ModelDefinition, ) *cclValues.AttributeUsageInfo
GetGlobalOrModelAttribute retrieves an attribute with the specified name from global attributes or the current model.
func (*CodeGenerationBase) GetGlobalOrModelAttributes ¶
func (c *CodeGenerationBase) GetGlobalOrModelAttributes( targetLang globalValues.LanguageType, name string, currentModel *cclValues.ModelDefinition, ) *cclValues.AttributesCollection
GetGlobalOrModelAttributes retrieves all attributes with the specified name from global attributes or the current model.
func (*CodeGenerationBase) GetModelAndGlobalAttributes ¶
func (c *CodeGenerationBase) GetModelAndGlobalAttributes( targetLang globalValues.LanguageType, name string, currentModel *cclValues.ModelDefinition, ) *cclValues.AttributesCollection
GetModelAndGlobalAttributes retrieves all attributes with the specified name from both global attributes and the current model.
func (*CodeGenerationBase) GetModelOrGlobalAttribute ¶
func (c *CodeGenerationBase) GetModelOrGlobalAttribute( targetLang globalValues.LanguageType, name string, currentModel *cclValues.ModelDefinition, ) *cclValues.AttributeUsageInfo
GetModelOrGlobalAttribute retrieves an attribute with the specified name from the current model or global attributes.
func (*CodeGenerationBase) GetModelOrGlobalAttributes ¶
func (c *CodeGenerationBase) GetModelOrGlobalAttributes( targetLang globalValues.LanguageType, name string, currentModel *cclValues.ModelDefinition, ) *cclValues.AttributesCollection
GetModelOrGlobalAttributes retrieves all attributes with the specified name from the current model or global attributes.
func (*CodeGenerationBase) NeedsBinarySerialization ¶
func (c *CodeGenerationBase) NeedsBinarySerialization( targetLang globalValues.LanguageType, currentModel *cclValues.ModelDefinition, ) bool
NeedsBinarySerialization returns true if the current model or global attributes indicate that binary serialization is needed.
func (*CodeGenerationBase) NeedsCloneMethods ¶
func (c *CodeGenerationBase) NeedsCloneMethods( targetLang globalValues.LanguageType, currentModel *cclValues.ModelDefinition, ) bool
NeedsCloneMethods returns true if the current model or global attributes indicate that clone methods are needed.
func (*CodeGenerationBase) NeedsJsonSerialization ¶
func (c *CodeGenerationBase) NeedsJsonSerialization( targetLang globalValues.LanguageType, currentModel *cclValues.ModelDefinition, ) bool
NeedsJsonSerialization returns true if the current model or global attributes indicate that JSON serialization is needed.
func (*CodeGenerationBase) NeedsSerializationType ¶
func (c *CodeGenerationBase) NeedsSerializationType( targetLang globalValues.LanguageType, currentModel *cclValues.ModelDefinition, sType string, ) bool
NeedsSerializationType checks if the specified serialization type is needed based on global attributes and model-specific attributes.
type CodeGenerationOptions ¶
type CodeGenerationOptions struct {
CCLDefinition *cclValues.SourceCodeDefinition
OutputPath string
TargetLanguage string
PackageName string
}
type CodeGenerationResult ¶
type CodeGenerationResult struct {
OutputFiles []string
// SourceLanguage is the language from which the code was generated.
SourceLanguage gValues.NormalizedLangName
// TargetLanguage is the language to which the code was generated.
TargetLanguage gValues.NormalizedLangName
}
CodeGenerationResult holds the result of a code generation process.
func DoGenerateCode ¶
func DoGenerateCode(options *CodeGenerationOptions) (*CodeGenerationResult, error)
type GenerateCode ¶
type GenerateCode func(options *CodeGenerationOptions) (*CodeGenerationResult, error)