encdecutil

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeJSONRaw

func DecodeJSONRaw[T any](raw json.RawMessage) (T, error)

DecodeJSONRaw decodes a json.RawMessage into a typed value T, disallowing unknown fields and rejecting trailing data. If raw is empty, or only whitespace, it returns the zero value of T.

func EncodeToJSONRaw

func EncodeToJSONRaw(value any) (json.RawMessage, error)

EncodeToJSONRaw encodes any value to json.RawMessage. No typed method here as value being of a type doesnt really affect its functionality.

func MapToStructWithJSONTags

func MapToStructWithJSONTags(data map[string]any, out any) error

func RequireNonNilPointer

func RequireNonNilPointer(p any, name string) (reflect.Value, error)

func RequirePointerToStruct

func RequirePointerToStruct(p any, name string) (reflect.Value, error)

func StructWithJSONTagsToMap

func StructWithJSONTagsToMap(data any) (map[string]any, error)

Types

type Base64StringEncoderDecoder

type Base64StringEncoderDecoder struct{}

Base64StringEncoderDecoder is a simple KeyEncoderDecoder that uses base64.

func (Base64StringEncoderDecoder) Decode

func (b Base64StringEncoderDecoder) Decode(encoded string) (string, error)

func (Base64StringEncoderDecoder) Encode

func (b Base64StringEncoderDecoder) Encode(plain string) string

Jump to

Keyboard shortcuts

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