defaults

package
v0.0.0-...-947b840 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assign

func Assign[T any](ptr T) T

Assign assigns default values for the structure on a given pointer and returns back the pointer to allow method chaining.

It panics if an error happens.

func CanUpdate

func CanUpdate(v interface{}) bool

CanUpdate returns true when the given value is an initial value of its type.

func Default

func Default[T any](v T, def T) T

Default returns default value if the given value can be updated (is an initial value of its type). Otherwise the value itself is returned.

func Set

func Set(ptr interface{}) error

Set sets default values for the structure on a given pointer and returns a potential error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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