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:
Gerasimos (Makis) Maropoulos 2019-06-03 12:06:18 +03:00
parent 162c1b9cfe
commit e19a519c6e
3 changed files with 21 additions and 8 deletions

2
go.mod
View File

@ -15,7 +15,7 @@ require (
github.com/iris-contrib/go.uuid v2.0.0+incompatible
github.com/json-iterator/go v1.1.6
github.com/kataras/golog v0.0.0-20180321173939-03be10146386
github.com/kataras/neffos v0.0.0-20190602135205-38e9cc9b65c6
github.com/kataras/neffos v0.0.0-20190603085547-9fba63259400
github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d // indirect
github.com/microcosm-cc/bluemonday v1.0.2
github.com/ryanuber/columnize v2.1.0+incompatible

10
go.sum
View File

@ -13,13 +13,9 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/flosch/pongo2 v0.0.0-20190505152737-8914e1cf9164 h1:/HMcOGZC5Bi8JPgfbwz13ELWn/91+vY59HXS3z0qY5w=
github.com/flosch/pongo2 v0.0.0-20190505152737-8914e1cf9164/go.mod h1:tbAXHifHQWNSpWbiJHpJTZH5fi3XHhDMdP//vuz9WS4=
github.com/go-check/check v1.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=
github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8=
github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
github.com/gobwas/ws v1.0.0 h1:1WdyfgUcImUfVBvYbsW2krIsnko+1QU2t45soaF8v1M=
github.com/gobwas/ws v1.0.0/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
github.com/gobwas/ws v1.0.1/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/iris-contrib/blackfriday v2.0.0+incompatible h1:o5sHQHHm0ToHUlAJSTjW9UWicjJSDDauOOQ2AHuIVp4=
@ -32,8 +28,8 @@ github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwK
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/kataras/golog v0.0.0-20180321173939-03be10146386 h1:VT6AeCHO/mc+VedKBMhoqb5eAK8B1i9F6nZl7EGlHvA=
github.com/kataras/golog v0.0.0-20180321173939-03be10146386/go.mod h1:PcaEvfvhGsqwXZ6S3CgCbmjcp+4UDUh2MIfF2ZEul8M=
github.com/kataras/neffos v0.0.0-20190602135205-38e9cc9b65c6 h1:Kt26efzwR6OeuQ9IO8ufl6MjoJRvl0P6/fSnzHrW638=
github.com/kataras/neffos v0.0.0-20190602135205-38e9cc9b65c6/go.mod h1:q/Hkityxm91OTjAXtQDTgaNhIrAe7JcDVDkvqSP+YGE=
github.com/kataras/neffos v0.0.0-20190603085547-9fba63259400 h1:4Vmw9gER3G+QRYFP9Kt8KK01kwVfAE+EoXgiuCzn4oI=
github.com/kataras/neffos v0.0.0-20190603085547-9fba63259400/go.mod h1:XfxmcgJUtbPmzK9wPLE7ybFHXoCqZKGptaW1frrxFhw=
github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d h1:V5Rs9ztEWdp58oayPq/ulmlqJJZeJP6pP79uP3qjcao=
github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d/go.mod h1:NV88laa9UiiDuX9AhMbDPkGYSPugBOV6yTZB1l2K9Z0=
github.com/microcosm-cc/bluemonday v1.0.2 h1:5lPfLTTAvAbtS0VqT+94yOtFnGfUWYyx0+iToC3Os3s=

View File

@ -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) {