Documentation ¶
Index ¶
Constants ¶
View Source
const (
// MimePB is Mime type protobuf
MimePB = "application/x-protobuf"
)
Variables ¶
This section is empty.
Functions ¶
func NewEntityAccessorPB ¶
func NewEntityAccessorPB(contentType string) restful.EntityReaderWriter
NewEntityAccessorPB returns a new EntityReaderWriter for accessing PB content.
func PatchContainer ¶
func PatchContainer(container *restful.Container, opts *PatchContainerOptions)
PatchContainer patch the container
Types ¶
type EntityHandler ¶
type EntityHandler func(request *restful.Request, response *restful.Response) Entity
EntityHandler entity handler to process requests.
type EntityRoute ¶
type EntityRoute struct { // Record the entity encoding time EncodeTimeFunc RecordTimeFunc // Usually to report panic metric RecoverRecorder func(reason interface{}, request *restful.Request) // logging LoggingFunc RecordTimeFunc // Record io write time WriteTimeFunc RecordTimeFunc // Called if got error entity ErrorFunc func(request *restful.Request, response *restful.Response, e Entity) }
EntityRoute generates handler to restful service.
func (*EntityRoute) To ¶
func (r *EntityRoute) To(h EntityHandler) restful.RouteFunction
To returns handler
type PatchContainerOptions ¶
type PatchContainerOptions struct { // Global logging LoggingFunc RecordTimeFunc }
PatchContainerOptions options to patch container
type RecordTimeFunc ¶
type RecordTimeFunc func(request *restful.Request, response *restful.Response, latency time.Duration)
RecordTimeFunc function to record latency time
Click to show internal directories.
Click to hide internal directories.