Documentation ¶
Index ¶
Constants ¶
const AnnotationHeaderParam = "ee.http.HeaderParam"
AnnotationHeaderParam only applies to method parameters and uses the names from the http request. 'value' denotes the method variable name and 'alias' an optional name (e.g. accept-language)
const AnnotationMethod = "ee.http.Method"
AnnotationMethod only applies to methods and describes which http verb is applied for routing.
const AnnotationQueryParam = "ee.http.QueryParam"
AnnotationQueryParam only applies to method parameters and uses the names as the url query parameter. value' denotes the method variable name and 'alias' an optional name (e.g. accept-language)
const AnnotationRoute = "ee.http.Route"
AnnotationRoute can be used for a struct and/or struct methods. The value is the route with path variables preceded by a : like the following example:
/api/v1/sms/:id /resource/:kind1/:kind2
const AnnotationStereotypeController = "ee.stereotype.Controller"
AnnotationStereotypeController is a non http annotation used to group OpenAPI endpoints together, using the given name.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Controller ¶
type Controller struct { }
func MustNewController ¶
func MustNewController(srv *Server, ctr interface{}) *Controller
MustNewController asserts that ctr is useful controller and otherwise bails out.
func NewController ¶
func NewController(srv *Server, ctr interface{}) (*Controller, error)
NewController tries to create a http/rest presentation service/controller/layer from the given instance.
type Error ¶
type Error struct { Id string `json:"id"` // Id is unique for a specific error, e.g. mydomain.not.assigned Message string `json:"message"` // Message is a string for the developer LocalizedMessage string `json:"localizedMessage,omitempty"` // LocalizedMessage is something to display the user CausedBy *Error `json:"causedBy,omitempty"` // CausedBy returns an optional root error Type string `json:"type,omitempty"` // Type is a developer notice for the internal inspection Details interface{} `json:"details,omitempty"` // Details contains arbitrary payload }
Error describes a (nested) server error
func AsError ¶
AsError either casts the given error (if possible) or creates a new Error from the given error. Returns only nil if err is nil.
func ParseError ¶
ParseError tries to parse the response as json. In any case it returns an error.
func (*Error) LocalizedError ¶
LocalizedError is like Error but translated or empty
type Scanner ¶
type Scanner interface {
Scan(src interface{}) error
}
A Scanner is SQL scanner compatible, but only needs tp scan from a string