encoding

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bytes added in v0.21.0

type Bytes string

Identity encoding for bytes

func ForBytes added in v0.21.0

func ForBytes(cat string) Bytes

Create bytes identity codec

func (Bytes) Category added in v0.21.0

func (c Bytes) Category() string

func (Bytes) Decode added in v0.21.0

func (Bytes) Decode(x []byte) ([]byte, error)

func (Bytes) Encode added in v0.21.0

func (Bytes) Encode(x []byte) ([]byte, error)

type BytesJB64 added in v0.21.0

type BytesJB64 string

Base64 encoding for bytes, sent as JSON

func ForBytesJB64 added in v0.21.0

func ForBytesJB64(cat string) BytesJB64

Creates bytes codec for Base64 encapsulated into Json "packat"

func (BytesJB64) Category added in v0.21.0

func (c BytesJB64) Category() string

func (BytesJB64) Decode added in v0.21.0

func (BytesJB64) Decode(x []byte) ([]byte, error)

func (BytesJB64) Encode added in v0.21.0

func (BytesJB64) Encode(x []byte) ([]byte, error)

type Event added in v0.21.0

type Event[M, T any] struct {
	// contains filtered or unexported fields
}

JSON encoding for events

func ForEvent added in v0.21.0

func ForEvent[M, T any](source string, category ...string) Event[M, T]

Creates JSON codec for events

func (Event[M, T]) Category added in v0.21.0

func (c Event[M, T]) Category() string

func (Event[M, T]) Decode added in v0.21.0

func (c Event[M, T]) Decode(b []byte) (swarm.Event[M, T], error)

func (Event[M, T]) Encode added in v0.21.0

func (c Event[M, T]) Encode(obj swarm.Event[M, T]) ([]byte, error)

type Typed added in v0.21.0

type Typed[T any] string

JSON encoding for typed objects

func ForTyped added in v0.21.0

func ForTyped[T any](category ...string) Typed[T]

Create JSON codec for typed objects

func (Typed[T]) Category added in v0.21.0

func (c Typed[T]) Category() string

func (Typed[T]) Decode added in v0.21.0

func (Typed[T]) Decode(b []byte) (x T, err error)

func (Typed[T]) Encode added in v0.21.0

func (Typed[T]) Encode(x T) ([]byte, error)

Jump to

Keyboard shortcuts

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