Documentation ¶
Index ¶
- Variables
- type Argument
- type ArgumentType
- type Config
- type Error
- type ErrorBuilder
- type ExportGo
- type GoExporter
- type Importer
- type Localization
- func (l *Localization) AddArgumentTranslation(name, description, lang string) error
- func (l *Localization) AddDescriptionTranslation(lang string, val string) error
- func (l *Localization) AddMessageTranslation(lang string, val string) error
- func (l Localization) AllLanguages() []language.Tag
- func (l Localization) Arguments() map[string]map[language.Tag]string
- func (l Localization) Description() map[language.Tag]string
- func (l Localization) Message() map[language.Tag]string
- type Manager
- type Spec
- type TemplateValidator
- type TemplateValidatorConfig
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidArgumentType = errors.New("not a valid ArgumentType")
Functions ¶
This section is empty.
Types ¶
type Argument ¶
type Argument struct {
// contains filtered or unexported fields
}
Argument represents an argument used in the error messages.
func NewArgument ¶
func (Argument) Description ¶
func (Argument) Typ ¶
func (a Argument) Typ() ArgumentType
type ArgumentType ¶
type ArgumentType int8
ArgumentType represents the type of the argument.
ENUM( unknown string int float bool timestamp )
const ( // ArgumentTypeUnknown is a ArgumentType of type Unknown. ArgumentTypeUnknown ArgumentType = iota // ArgumentTypeString is a ArgumentType of type String. ArgumentTypeString // ArgumentTypeInt is a ArgumentType of type Int. ArgumentTypeInt // ArgumentTypeFloat is a ArgumentType of type Float. ArgumentTypeFloat // ArgumentTypeBool is a ArgumentType of type Bool. ArgumentTypeBool // ArgumentTypeTimestamp is a ArgumentType of type Timestamp. ArgumentTypeTimestamp )
func ParseArgumentType ¶
func ParseArgumentType(name string) (ArgumentType, error)
ParseArgumentType attempts to convert a string to a ArgumentType.
func (ArgumentType) MarshalText ¶
func (x ArgumentType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (*ArgumentType) Scan ¶
func (x *ArgumentType) Scan(value interface{}) (err error)
Scan implements the Scanner interface.
func (ArgumentType) String ¶
func (x ArgumentType) String() string
String implements the Stringer interface.
func (*ArgumentType) UnmarshalText ¶
func (x *ArgumentType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func (Error) Description ¶
func (Error) IsDeprecated ¶
func (Error) Localization ¶
func (e Error) Localization() Localization
type ErrorBuilder ¶
type ErrorBuilder struct {
// contains filtered or unexported fields
}
ErrorBuilder is responsible for creating Error instances.
func NewErrorBuilder ¶
func NewErrorBuilder(specVersion, defaultLocale string) (*ErrorBuilder, error)
NewErrorBuilder creates a new instance of ErrorBuilder.
type GoExporter ¶
GoExporter is responsible for exporting the parsed errors to Go code.
type Localization ¶
type Localization struct {
// contains filtered or unexported fields
}
func NewLocalization ¶
func NewLocalization() Localization
func (*Localization) AddArgumentTranslation ¶
func (l *Localization) AddArgumentTranslation(name, description, lang string) error
func (*Localization) AddDescriptionTranslation ¶
func (l *Localization) AddDescriptionTranslation(lang string, val string) error
func (*Localization) AddMessageTranslation ¶
func (l *Localization) AddMessageTranslation(lang string, val string) error
func (Localization) AllLanguages ¶
func (l Localization) AllLanguages() []language.Tag
func (Localization) Arguments ¶
func (l Localization) Arguments() map[string]map[language.Tag]string
func (Localization) Description ¶
func (l Localization) Description() map[language.Tag]string
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(importer Importer, goExporter GoExporter) *Manager
type Spec ¶
func (Spec) HasTimestampArguments ¶
type TemplateValidator ¶
type TemplateValidator struct {
// contains filtered or unexported fields
}
TemplateValidator is an implementation of core.TemplateValidator interface.
func NewTemplateValidator ¶
func NewTemplateValidator(cfg *TemplateValidatorConfig) *TemplateValidator
NewTemplateValidator returns a new instance of TemplateValidator.
func (*TemplateValidator) Validate ¶
func (p *TemplateValidator) Validate(txt string) (err error)
Validate implements core.TemplateValidator interface.
type TemplateValidatorConfig ¶
TemplateValidatorConfig is a configuration for TemplateValidator.