apiutils

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Of

func Of[E any](e E) *E

of returns a pointer to the provided literal/const input

func SafeString added in v0.3.1

func SafeString(s *string) string

SafeString returns a string representation of a string pointer. Useful for logging or printing values that may be nil. For Zero values, you can refer to ZeroIfNil instead. Returns "<nil>" if the input is nil

func StrPtr

func StrPtr(notEmpty string) *string

func ValidateIDAsInt32 added in v0.3.0

func ValidateIDAsInt32(id string, entityName string) (int32, error)

ValidateIDAsInt32 validates and converts a string ID to int32 Returns an error with api.ErrBadRequest if the ID is invalid

func ValidateIDAsInt32Ptr added in v0.3.0

func ValidateIDAsInt32Ptr(id *string, entityName string) (*int32, error)

ValidateIDAsInt32Ptr validates and converts a string pointer ID to int32 pointer Returns nil if the input is nil, otherwise validates and converts

func ValidateIDAsInt64 added in v0.3.0

func ValidateIDAsInt64(id string, entityName string) (int64, error)

ValidateIDAsInt64 validates and converts a string ID to int64 Returns an error with api.ErrBadRequest if the ID is invalid

func ValidateIDAsInt64Ptr added in v0.3.0

func ValidateIDAsInt64Ptr(id *string, entityName string) (*int64, error)

ValidateIDAsInt64Ptr validates and converts a string pointer ID to int64 pointer Returns nil if the input is nil, otherwise validates and converts

func ZeroIfNil

func ZeroIfNil[T any](input *T) T

ZeroIfNil return the zeroed value if input is a nil pointer

Types

This section is empty.

Jump to

Keyboard shortcuts

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