Documentation ¶
Overview ¶
Package marketing provides an example service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct { // Client is the wrapped RPC client. *rpc.Client // Configuration is the configuration. Configuration Configuration // Context is the call context. Context Context // Name is the receiver name. Name string }
Client is the RPC client.
func MustNewClient ¶
func MustNewClient(c Configuration, address string) Client
MustNewClient calls NewClient and panics if there is an error.
type Configuration ¶
type Configuration struct { // Name is the Offers name. Name string // OfferRepository is a model repository. OfferRepository offer.Repository }
Configuration is the Offers configuration.
func (Configuration) OnCall ¶
func (conf Configuration) OnCall(method string, cont Context, argument interface{})
OnCall is called before calling a service method. OnCall is a special method.
func (Configuration) OnPanic ¶
func (conf Configuration) OnPanic(method string, cont Context, value interface{})
OnPanic is called when recovering from a panic in a service method. OnPanic is a special method.
type Context ¶
type Context struct { // ID identifies the call. ID string }
Context is the Offers context.
type Interface ¶
type Interface interface { // Delete deletes m. Delete(m offer.Offer) (offer.Offer, error) // ForContext uses c. ForContext(c Context) Interface // Get gets the Offer for id. Get(id string) (offer.Offer, error) // New creates m. New(m offer.Offer) (offer.Offer, error) // Set updates m. Set(m offer.Offer) (offer.Offer, error) }
Interface is the service interface.
type Offers ¶
type Offers struct { // Configuration is the configuration. Configuration Configuration // Context is the call context. Context Context }
Offers is an example service.
type Receiver ¶
type Receiver struct { // Configuration is the configuration. Configuration Configuration // Interface is the service. Interface Interface }
Receiver is an RPC receiver.
func (Receiver) Delete ¶
func (r Receiver) Delete(argument struct { Arguments struct { M offer.Offer // m } Context Context // Call context }, result *struct { Offer offer.Offer // Only one non-error result }) error
Delete deletes M.
func (Receiver) Get ¶
func (r Receiver) Get(argument struct { Context Context Arguments struct { Id string } }, result *struct { Offer offer.Offer }) error
Get gets the Offer for id.
type Server ¶
type Server struct { // Server is the wrapped RPC server. *rpc.Server // Listener is the listener. Listener net.Listener }
Server is the RPC server.
func MustNewServer ¶
func MustNewServer(c Configuration, i Interface, address string) Server
MustNewServer calls NewServer and panics if there is an error.
Click to show internal directories.
Click to hide internal directories.