schematic

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

README

go-schema-decoder

Golang JSON payload decoder with exact schema validation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SchemaDecoder

type SchemaDecoder[T any] struct {
	Schema map[string]any
}

Decoder struct which holds schema for the expected payload. SchemaDecoder compares paylod before decoding with the schema.

func NewSchemaDecoder

func NewSchemaDecoder[T any](v T) *SchemaDecoder[T]

Creates new schema decoder.

func (*SchemaDecoder[T]) Decode

func (self *SchemaDecoder[T]) Decode(raw []byte) *T

Decodes payload with schema comparasing

Jump to

Keyboard shortcuts

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