Documentation ¶
Overview ¶
Package templates export a TemplateContext structure which is the object that every template receives as context when executed.
This file also gathers all context API related to this object.
Index ¶
- func Load(options *Options) (*template.Templates, error)
- type Import
- type Options
- type TemplateContext
- func (t *TemplateContext) AllMessages() []*parser.Message
- func (t *TemplateContext) Extension() string
- func (t *TemplateContext) GetTemplateImports(tplName string) []Import
- func (t *TemplateContext) HasBodyToDecode() bool
- func (t *TemplateContext) HasEnumField() bool
- func (t *TemplateContext) HasEnumPathField() bool
- func (t *TemplateContext) HasImportFor(tplName string) bool
- func (t *TemplateContext) HasMultipartFormDataMethod() bool
- func (t *TemplateContext) HasParametersToDecode() bool
- func (t *TemplateContext) HasRequiredBody() bool
- func (t *TemplateContext) IsHTTPService() bool
- func (t *TemplateContext) MessagesToValidate() []*parser.Message
- func (t *TemplateContext) ModelEntities() []*parser.Message
- func (t *TemplateContext) ResponseMessages() []*parser.Message
- func (t *TemplateContext) Validate() error
- func (t *TemplateContext) ValidateForExecute() map[string]template.TemplateValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Import ¶
type Import struct { InternalName string Name string // Templates holds the names of all template files that must import this // package. Templates []string }
func (Import) IsRequiredFor ¶
IsRequiredFor checks if the object is required for a specific template.
type TemplateContext ¶
type TemplateContext struct { PackageName string ServiceName string Imports map[string][]Import Entities []*parser.Message Messages []*parser.Message Enums []parser.Enum Methods []*parser.Method Settings []*parser.Message }
func NewTemplateContext ¶
func NewTemplateContext(options *Options) (*TemplateContext, error)
func (*TemplateContext) AllMessages ¶
func (t *TemplateContext) AllMessages() []*parser.Message
func (*TemplateContext) Extension ¶
func (t *TemplateContext) Extension() string
func (*TemplateContext) GetTemplateImports ¶
func (t *TemplateContext) GetTemplateImports(tplName string) []Import
func (*TemplateContext) HasBodyToDecode ¶
func (t *TemplateContext) HasBodyToDecode() bool
func (*TemplateContext) HasEnumField ¶
func (t *TemplateContext) HasEnumField() bool
func (*TemplateContext) HasEnumPathField ¶
func (t *TemplateContext) HasEnumPathField() bool
func (*TemplateContext) HasImportFor ¶
func (t *TemplateContext) HasImportFor(tplName string) bool
func (*TemplateContext) HasMultipartFormDataMethod ¶
func (t *TemplateContext) HasMultipartFormDataMethod() bool
func (*TemplateContext) HasParametersToDecode ¶
func (t *TemplateContext) HasParametersToDecode() bool
func (*TemplateContext) HasRequiredBody ¶
func (t *TemplateContext) HasRequiredBody() bool
func (*TemplateContext) IsHTTPService ¶
func (t *TemplateContext) IsHTTPService() bool
IsHTTPService checks if the service is using HTTP endpoint in its methods.
func (*TemplateContext) MessagesToValidate ¶
func (t *TemplateContext) MessagesToValidate() []*parser.Message
MessagesToValidate gives back only the messages that should have the Validator interface implemented.
func (*TemplateContext) ModelEntities ¶
func (t *TemplateContext) ModelEntities() []*parser.Message
func (*TemplateContext) ResponseMessages ¶
func (t *TemplateContext) ResponseMessages() []*parser.Message
ResponseMessages returns all messages that are response types without repeating.
func (*TemplateContext) Validate ¶
func (t *TemplateContext) Validate() error
func (*TemplateContext) ValidateForExecute ¶
func (t *TemplateContext) ValidateForExecute() map[string]template.TemplateValidator
Click to show internal directories.
Click to hide internal directories.