Documentation
¶
Overview ¶
Package dl for Default Loader
Package dl for Default Loader ¶
Package dl for Default Loader
Index ¶
- Variables
- func CanUpdate(v interface{}) bool
- func InvalidTypeError(typeString string) error
- func Load[T any](ptr *T) error
- func LoadInterface[P any](ptr any, arg P) (bool, error)
- func LoadStruct(ptr any) error
- func LoadWithOption[T any, P any](ptr *T, arg P) error
- func MustLoad[T any](ptr *T)
- func Object[T any](v *T) T
- func Pointer[T any](v T) *T
- type DefaultLoader
- type DefaultLoaderFunc
- type DefaultOptionLoader
- type DefaultOptionLoaderFunc
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidType = errors.New("empty")
Functions ¶
func CanUpdate ¶ added in v0.0.7
func CanUpdate(v interface{}) bool
CanUpdate returns true when the given value is an initial value of its type
func InvalidTypeError ¶
func Load ¶
Load initializes members in a struct referenced by a pointer. Maps and slices are initialized by `make` and other primitive types are set with default values. `ptr` should be a struct pointer
func LoadInterface ¶
LoadInterface initializes members in a struct referenced by a pointer. Maps and slices are initialized by `make` and other primitive types are set with default values. `ptr` should be a struct pointer
func LoadStruct ¶
LoadStruct initializes members in a struct referenced by a pointer. Maps and slices are initialized by `make` and other primitive types are set with default values. `ptr` should be a struct pointer
func LoadWithOption ¶ added in v0.0.7
LoadWithOption initializes members in a struct referenced by a pointer. Maps and slices are initialized by `make` and other primitive types are set with default values. `ptr` should be a struct pointer
Types ¶
type DefaultLoader ¶
type DefaultLoader interface {
Default() error
}
DefaultLoader is an interface that can be implemented by structs to customize the default
type DefaultLoaderFunc ¶ added in v0.0.7
DefaultLoaderFunc is a function type that defines a function to load default values into a struct referenced by a pointer.
type DefaultOptionLoader ¶ added in v0.0.7
DefaultOptionLoader is an interface that specifies a method to load default values into a struct with a parameter.
type DefaultOptionLoaderFunc ¶ added in v0.0.7
DefaultOptionLoaderFunc is a function type that defines a function to load default values into a struct with a parameter.