Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct {
// Response is set to true if the procedure is treated as a response.
Response bool
}
Base can be embedded in a struct to turn it into a procedure.
func (*Base) GetAccessor ¶
GetAccessor implements the Key interface.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a reusable client for accessing procedure endpoints.
type Context ¶
type Context struct {
context.Context
// The received procedure.
Procedure Procedure
// The current handler.
Handler *Handler
// The underlying request.
Request *http.Request
// The underlying writer.
Writer http.ResponseWriter
}
Context allows handlers to interact with the request.
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint manages the calling of procedures.
func NewEndpoint ¶
NewEndpoint creates and returns a new server.
type Error ¶
type Error struct {
// A unique identifier for this particular occurrence of the problem.
ID string `json:"id,omitempty" bson:"id,omitempty"`
// A URL that leads to further details about this problem.
Link string `json:"link,omitempty" bson:"link,omitempty"`
// The HTTP status code applicable to this problem.
Status int `json:"status,string,omitempty" bson:"status,string,omitempty"`
// An application-specific error code.
Code string `json:"code,omitempty" bson:"code,omitempty"`
// A short, human-readable summary of the problem.
Title string `json:"title,omitempty" bson:"title,omitempty"`
// A human-readable explanation specific to this occurrence of the problem.
Detail string `json:"detail,omitempty" bson:"detail,omitempty"`
// A JSON pointer specifying the source of the error.
//
// See https://tools.ietf.org/html/rfc6901.
Source string `json:"source,omitempty" bson:"source,omitempty"`
// Non-standard meta-information about the error.
Meta map[string]interface{} `json:"meta,omitempty" bson:"meta,omitempty"`
}
Error objects provide additional information about problems encountered while performing an operation.
func BadRequest ¶
BadRequest returns a new bad request error with a source.
func ErrorFromStatus ¶
ErrorFromStatus will return an error that has been derived from the passed status code.
Note: If the passed status code is not a valid HTTP status code, an Internal Server Error status code will be used instead.
type Handler ¶
type Handler struct {
// The handled procedure.
Procedure Procedure
// The request body limit.
//
// Default: 4K.
Limit int64
// The processing callback.
Callback func(ctx *Context) error
}
Handler defines a procedure handler.
type Meta ¶
type Meta struct {
// The values type.
Type reflect.Type
// The name.
Name string
// The used transfer coding.
Coding stick.Coding
// The accessor.
Accessor *stick.Accessor
}
Meta contains meta information about a procedure.