parser

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxJSONBodySize int64 = 1 << 20

DefaultMaxJSONBodySize is the default maximum JSON body size (1 MB)

Variables

This section is empty.

Functions

func ParseJSONBody

func ParseJSONBody(body io.Reader, v any, maxSize ...int64) error

ParseJSONBody parses JSON from a reader with a size limit. Pass 0 to use the default limit (1 MB). The caller owns closing the reader.

func ParseString

func ParseString[T ParseType](valueStr string, target *T) error

ParseString parses a string into a target type

func SanitizeString

func SanitizeString(s string) string

SanitizeString removes potentially dangerous characters

Types

type ParseType

type ParseType interface {
	int | int32 | int64 | float32 | float64 | bool | string | time.Duration
}

ParseType defines the types that can be parsed from string values

Jump to

Keyboard shortcuts

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