mirror of
https://github.com/kataras/iris.git
synced 2025-12-17 09:57:01 +00:00
add neffos.Object based on the latest neffos API and update the go.mod for neffos
Former-commit-id: 47836caf61d3c951f1599714a4310bbdef1c87b7
This commit is contained in:
@@ -79,8 +79,25 @@ var (
|
||||
// with the exact same incoming Message's Namespace (and Room if specified)
|
||||
// except its body which would be the given "body".
|
||||
Reply = neffos.Reply
|
||||
// Object marshals the "v" value and returns a Message's Body.
|
||||
// The "v" serialized value can be customized by implementing a `Marshal() ([]byte, error) ` method,
|
||||
// otherwise the default one will be used instead ( see `SetDefaultMarshaler` and `SetDefaultUnmarshaler`).
|
||||
// Errors are pushed to the result, use the object's Marshal method to catch those when necessary.
|
||||
Object = neffos.Object
|
||||
)
|
||||
|
||||
// SetDefaultMarshaler changes the default json marshaler.
|
||||
// See `Object` package-level function and `Message.Object` method for more.
|
||||
func SetDefaultMarshaler(fn func(v interface{}) ([]byte, error)) {
|
||||
neffos.DefaultMarshaler = fn
|
||||
}
|
||||
|
||||
// SetDefaultUnmarshaler changes the default json unmarshaler.
|
||||
// See `Object` package-level function and `Message.Object` method for more.
|
||||
func SetDefaultUnmarshaler(fn func(data []byte, v interface{}) error) {
|
||||
neffos.DefaultUnmarshaler = fn
|
||||
}
|
||||
|
||||
// Handler returns an Iris handler to be served in a route of an Iris application.
|
||||
func Handler(s *neffos.Server) context.Handler {
|
||||
return func(ctx context.Context) {
|
||||
|
||||
Reference in New Issue
Block a user