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

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