paramutil

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2025 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddrIfPresent

func AddrIfPresent[T comparable](v param.Opt[T]) *T

func IsNullPtr

func IsNullPtr[T any](ptr *T) bool

IsNullPtr returns true if the pointer was created by NullPtr.

func IsNullSlice

func IsNullSlice[T any](slice []T) bool

IsNullSlice returns true if the slice was created by NullSlice.

func NullPtr

func NullPtr[T any]() *T

NullPtr returns a pointer to the zero value of the type T. When used with [MarshalObject] or [MarshalUnion], it will be marshaled as null.

It is unspecified behavior to mutate the value pointed to by the returned pointer.

func NullSlice

func NullSlice[T any]() []T

NullSlice returns a non-nil slice with a length of 0. When used with [MarshalObject] or [MarshalUnion], it will be marshaled as null.

It is undefined behavior to mutate the slice returned by NullSlice.

func ToOpt

func ToOpt[T comparable](v T, meta respjson.Field) param.Opt[T]

func Valid

func Valid(v param.ParamStruct) bool

Checks if the value is not omitted and not null

func VariantFromUnion

func VariantFromUnion(u reflect.Value) (any, error)

VariantFromUnion can be used to extract the present variant from a param union type. A param union type is a struct with an embedded field of [APIUnion].

Types

This section is empty.

Jump to

Keyboard shortcuts

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