Documentation ¶
Index ¶
- func Register(descriptions ...ServiceDesc) ronykit.Option
- type Contract
- func (c *Contract) AddError(err ronykit.ErrorMessage) *Contract
- func (c *Contract) AddHandler(h ...ronykit.HandlerFunc) *Contract
- func (c *Contract) AddModifier(m ronykit.Modifier) *Contract
- func (c *Contract) AddNamedSelector(name string, s ronykit.RouteSelector) *Contract
- func (c *Contract) AddSelector(s ronykit.RouteSelector) *Contract
- func (c *Contract) AddWrapper(wrappers ...ronykit.ContractWrapper) *Contract
- func (c *Contract) In(m ronykit.Message) *Contract
- func (c *Contract) NamedSelector(name string, s ronykit.RouteSelector) *Contract
- func (c *Contract) Out(m ronykit.Message) *Contract
- func (c *Contract) Selector(s ronykit.RouteSelector) *Contract
- func (c *Contract) SelectorWithName(name string, s ronykit.RouteSelector) *Contract
- func (c *Contract) SetCoordinator(f ronykit.EdgeSelectorFunc) *Contract
- func (c *Contract) SetEncoding(enc ronykit.Encoding) *Contract
- func (c *Contract) SetHandler(h ...ronykit.HandlerFunc) *Contract
- func (c *Contract) SetInput(m ronykit.Message) *Contract
- func (c *Contract) SetName(name string) *Contract
- func (c *Contract) SetOutput(m ronykit.Message) *Contract
- type DTO
- type DTOField
- type DTOFieldTag
- type Error
- type ErrorDTO
- type RESTMethod
- type RPCMethod
- type RouteSelector
- type Service
- func (s *Service) AddContract(contracts ...*Contract) *Service
- func (s *Service) AddError(err ronykit.ErrorMessage) *Service
- func (s *Service) AddHandler(h ...ronykit.HandlerFunc) *Service
- func (s *Service) AddPreHandler(h ...ronykit.HandlerFunc) *Service
- func (s *Service) AddWrapper(wrappers ...ronykit.ServiceWrapper) *Service
- func (s Service) Generate() ronykit.Service
- func (s *Service) SetDescription(d string) *Service
- func (s *Service) SetEncoding(enc ronykit.Encoding) *Service
- func (s *Service) SetVersion(v string) *Service
- func (s Service) Stub(pkgName string, tags ...string) (*Stub, error)
- type ServiceDesc
- type ServiceDescFunc
- type Stub
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶ added in v0.5.4
func Register(descriptions ...ServiceDesc) ronykit.Option
Types ¶
type Contract ¶
type Contract struct { Name string Encoding ronykit.Encoding Handlers []ronykit.HandlerFunc Wrappers []ronykit.ContractWrapper RouteSelectors []RouteSelector EdgeSelector ronykit.EdgeSelectorFunc Modifiers []ronykit.Modifier Input ronykit.Message Output ronykit.Message PossibleErrors []Error }
Contract is the description of the ronykit.Contract you are going to create.
func NewContract ¶
func NewContract() *Contract
func (*Contract) AddError ¶ added in v0.6.1
func (c *Contract) AddError(err ronykit.ErrorMessage) *Contract
AddError sets the possible errors for this Contract. Using this method is OPTIONAL, which mostly could be used by external tools such as Swagger or any other doc generator tools.
func (*Contract) AddHandler ¶
func (c *Contract) AddHandler(h ...ronykit.HandlerFunc) *Contract
AddHandler add handler for this contract.
func (*Contract) AddModifier ¶
AddModifier adds a ronykit.Modifier for this contract. Modifiers are used to modify the outgoing ronykit.Envelope just before sending to the client.
func (*Contract) AddNamedSelector ¶ added in v0.6.0
func (c *Contract) AddNamedSelector(name string, s ronykit.RouteSelector) *Contract
AddNamedSelector adds a ronykit.RouteSelector for this contract, and assign it a unique name. In case of you need to use auto-generated stub.Stub for your service/contract this name will be used in the generated code.
func (*Contract) AddSelector ¶
func (c *Contract) AddSelector(s ronykit.RouteSelector) *Contract
AddSelector adds a ronykit.RouteSelector for this contract. Selectors are bundle specific.
func (*Contract) AddWrapper ¶ added in v0.3.1
func (c *Contract) AddWrapper(wrappers ...ronykit.ContractWrapper) *Contract
AddWrapper adds a ronykit.ContractWrapper for this contract.
func (*Contract) NamedSelector ¶ added in v0.6.4
func (c *Contract) NamedSelector(name string, s ronykit.RouteSelector) *Contract
NamedSelector is an alias for AddNamedSelector
func (*Contract) Selector ¶ added in v0.6.4
func (c *Contract) Selector(s ronykit.RouteSelector) *Contract
Selector is an alias for AddSelector
func (*Contract) SelectorWithName ¶ added in v0.6.18
func (c *Contract) SelectorWithName(name string, s ronykit.RouteSelector) *Contract
SelectorWithName is an alias for AddNamedSelector
func (*Contract) SetCoordinator ¶ added in v0.4.7
func (c *Contract) SetCoordinator(f ronykit.EdgeSelectorFunc) *Contract
SetCoordinator sets a ronykit.EdgeSelectorFunc for this contract, to coordinate requests to right ronykit.EdgeServer instance.
func (*Contract) SetEncoding ¶ added in v0.3.5
SetEncoding sets the supported encoding for this contract.
func (*Contract) SetHandler ¶
func (c *Contract) SetHandler(h ...ronykit.HandlerFunc) *Contract
SetHandler set the handler by replacing the already existing ones.
func (*Contract) SetInput ¶
SetInput sets the accepting message for this Contract. Contracts are bound to one input message. In some odd cases if you need to handle multiple input messages, then you SHOULD create multiple contracts but with same handlers and/or selectors.
type DTOField ¶ added in v0.6.0
type DTOField struct { Name string Type string Embedded bool IsDTO bool Tags []DTOFieldTag }
DTOField represents description of a field of the DTO
type DTOFieldTag ¶ added in v0.6.0
DTOFieldTag represents description of a tag of the DTOField
type ErrorDTO ¶ added in v0.6.2
ErrorDTO represents description of a Data Object Transfer which is used to show an error case.
type RESTMethod ¶ added in v0.6.0
type RESTMethod struct { Name string Method string Path string Encoding string Request DTO Response DTO PossibleErrors []ErrorDTO }
RESTMethod represents description of a Contract with ronykit.RESTRouteSelector.
type RPCMethod ¶ added in v0.6.0
type RPCMethod struct { Name string Predicate string Request DTO Response DTO PossibleErrors []ErrorDTO Encoding string ronykit.IncomingRPCContainer ronykit.OutgoingRPCContainer }
RPCMethod represents description of a Contract with ronykit.RPCRouteSelector
type RouteSelector ¶ added in v0.6.4
type RouteSelector struct { Name string Selector ronykit.RouteSelector }
type Service ¶
type Service struct { Name string Version string Description string Encoding ronykit.Encoding PossibleErrors []Error Wrappers []ronykit.ServiceWrapper Contracts []Contract Handlers []ronykit.HandlerFunc // contains filtered or unexported fields }
Service is the description of the ronykit.Service you are going to create. It then generates a ronykit.Service by calling Generate method.
func NewService ¶
func (*Service) AddContract ¶
AddContract adds a contract to the service.
func (*Service) AddError ¶ added in v0.6.1
func (s *Service) AddError(err ronykit.ErrorMessage) *Service
AddError sets the possible errors for all the Contracts of this Service. Using this method is OPTIONAL, which mostly could be used by external tools such as Swagger or any other doc generator tools.
func (*Service) AddHandler ¶ added in v0.6.23
func (s *Service) AddHandler(h ...ronykit.HandlerFunc) *Service
AddHandler adds handlers to run before and/or after the contract's handlers
func (*Service) AddPreHandler ¶ added in v0.3.4
func (s *Service) AddPreHandler(h ...ronykit.HandlerFunc) *Service
AddPreHandler Deprecated use AddHandler instead.
func (*Service) AddWrapper ¶
func (s *Service) AddWrapper(wrappers ...ronykit.ServiceWrapper) *Service
AddWrapper adds service wrappers to the Service description.
func (*Service) SetDescription ¶ added in v0.3.4
func (*Service) SetEncoding ¶ added in v0.3.5
func (*Service) SetVersion ¶ added in v0.3.4
type ServiceDesc ¶ added in v0.6.0
type ServiceDesc interface {
Desc() *Service
}
type ServiceDescFunc ¶ added in v0.6.4
type ServiceDescFunc func() *Service
func (ServiceDescFunc) Desc ¶ added in v0.6.4
func (f ServiceDescFunc) Desc() *Service