json

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package json provides typed-handler wrappers that automatically encode and decode message payloads using encoding/json.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(body any) ([]byte, error)

Encode marshals body to JSON and returns the bytes ready for tickr.Message.Payload. Convenience wrapper around encoding/json.Marshal.

func Wrap

func Wrap[T any](h Handler[T]) tickr.Handler

Wrap converts a typed Handler[T] into a tickr.Handler that decodes msg.Payload via encoding/json before invoking h.

Types

type Handler

type Handler[T any] func(ctx context.Context, msg *tickr.InboundMessage, body T) error

Handler is the typed handler signature.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL