validate

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package validate provides input validation utilities.

Index

Constants

View Source
const MaxHostnameLength = 253

MaxHostnameLength is the maximum allowed hostname length per RFC 1035.

View Source
const MaxParamNameLength = 128

MaxParamNameLength is the maximum allowed parameter name length.

View Source
const MaxQueryLength = 1 << 20

MaxQueryLength is the maximum allowed query length (1MB).

Variables

This section is empty.

Functions

func Hostname

func Hostname(host string) error

Hostname validates a hostname or IP address.

func ParamName

func ParamName(name string) error

ParamName validates a query parameter name. Parameter names must start with a letter or underscore and contain only letters, digits, and underscores.

func Query

func Query(query string) error

Query validates and sanitizes a GQL query string. It returns an error if the query contains invalid characters or exceeds size limits.

Types

type ValidationError

type ValidationError struct {
	Field   string
	Value   string
	Message string
}

ValidationError represents a validation failure.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

Jump to

Keyboard shortcuts

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