Documentation
¶
Index ¶
- type Argument
- type General
- type Handler
- func (h *Handler) In(spec string) string
- func (h *Handler) MethodWithBody() bool
- func (h *Handler) Name() string
- func (h *Handler) Out(spec string) string
- func (h *Handler) Port() (string, error)
- func (h *Handler) SourceSuffix() string
- func (h *Handler) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Service
- func (s *Service) AllHandlers() []*Handler
- func (s *Service) FullyQualifyTypes()
- func (s *Service) ModulePathSuffix() string
- func (s *Service) PackageDirSuffix() string
- func (s *Service) PackagePathSuffix() string
- func (s *Service) ShorthandTypes()
- func (s *Service) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Signature
- type Type
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type General ¶
type General struct {
Host string `yaml:"host"`
Description string `yaml:"description"`
IntegrationTests bool `yaml:"integrationTests"`
OpenAPI bool `yaml:"openApi"`
}
General are general properties of the microservice.
func (*General) UnmarshalYAML ¶
UnmarshalYAML parses and validates the YAML.
type Handler ¶
type Handler struct {
Type string `yaml:"-"`
Exists bool `yaml:"-"`
// Shared
Signature *Signature `yaml:"signature"`
Description string `yaml:"description"`
Method string `yaml:"method"`
Path string `yaml:"path"`
Queue string `yaml:"queue"`
OpenAPI bool `yaml:"openApi"`
Actor string `yaml:"actor"`
Callback bool `yaml:"callback"`
// Sink
Event string `yaml:"event"`
Source string `yaml:"source"`
ForHost string `yaml:"forHost"`
// Config
Default string `yaml:"default"`
Validation string `yaml:"validation"`
Secret bool `yaml:"secret"`
// Metrics
Kind string `json:"kind" yaml:"kind"`
Alias string `json:"alias" yaml:"alias"`
Buckets []float64 `json:"buckets" yaml:"buckets"`
// Ticker
Interval time.Duration `yaml:"interval"`
}
Handler is the spec of a callback handler. Web requests, lifecycle events, config changes, tickers, etc.
func (*Handler) In ¶
In returns the input argument list as a string. Spec options:
, name type , name name type, name, name name type
func (*Handler) MethodWithBody ¶
MethodWithBody indicates if the HTTP method of the endpoint allows sending a body. "GET", "DELETE", "TRACE", "OPTIONS", "HEAD" do not allow a body.
func (*Handler) Out ¶
Out returns the output argument list as a string. Spec options:
, name type , name name type, name, name name type
func (*Handler) SourceSuffix ¶
SourceSuffix returns the last piece of the event source package path, which is expected to point to a microservice.
func (*Handler) UnmarshalYAML ¶
UnmarshalYAML parses the handler.
type Service ¶
type Service struct {
ModulePath string `yaml:"-"`
PackagePath string `yaml:"-"`
PackageDir string `yaml:"-"`
General General `yaml:"general"`
Configs []*Handler `yaml:"configs"`
Metrics []*Handler `yaml:"metrics"`
Functions []*Handler `yaml:"functions"`
Events []*Handler `yaml:"events"`
Sinks []*Handler `yaml:"sinks"`
Webs []*Handler `yaml:"webs"`
Tickers []*Handler `yaml:"tickers"`
Types []*Type `yaml:"-"`
// contains filtered or unexported fields
}
Service is the spec of the microservice parsed from service.yaml.
func (*Service) AllHandlers ¶
AllHandlers returns an array holding all handlers of all types.
func (*Service) FullyQualifyTypes ¶
func (s *Service) FullyQualifyTypes()
FullyQualifyTypes prepends the API package name to complex types of function arguments.
func (*Service) ModulePathSuffix ¶ added in v1.13.1
ModulePathSuffix returns only the last portion of the full module path.
func (*Service) PackageDirSuffix ¶ added in v1.13.1
PackageDirSuffix returns only the last portion of the full package directory path.
func (*Service) PackagePathSuffix ¶ added in v1.13.1
PackagePathSuffix returns only the last portion of the full package path.
func (*Service) ShorthandTypes ¶
func (s *Service) ShorthandTypes()
ShorthandTypes removed the API package name from complex types of function arguments.
func (*Service) UnmarshalYAML ¶
UnmarshalYAML parses and validates the YAML.
type Signature ¶
type Signature struct {
OrigString string
Name string
InputArgs []*Argument
OutputArgs []*Argument
}
Signature is the spec of a function signature.
func (*Signature) InputArg ¶
InputArg returns the named input arg, or nil if none exist with this name.
func (*Signature) OutputArg ¶
OutputArg returns the named output arg, or nil if none exist with this name.
func (*Signature) TestingT ¶
TestingT returns "testingT" if "t" conflicts with an argument of the function. Otherwise, "t" is returned.
func (*Signature) UnmarshalYAML ¶
UnmarshalYAML parses the signature.
type Type ¶
Type is a complex type used in a function.
func (*Type) PackagePathSuffix ¶ added in v1.13.1
PackagePathSuffix returns only the last portion of the full package path.
type Version ¶
type Version struct {
PackagePath string
Version int `json:"ver"`
SHA256 string `json:"sha256"`
Timestamp string `json:"ts"`
}
Version keeps the versioning information of the code.
func (*Version) PackagePathSuffix ¶ added in v1.13.1
PackagePathSuffix returns only the last portion of the full package path.