Discover Packages
github.com/opslevel/moredefaults
package
module
Version:
v0.0.0-...-17d1318
Opens a new window with list of versions in this module.
Published: May 29, 2024
License: MIT
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
README
README
¶
moredefaults
This is a simple fork of https://github.com/creasty/defaults that supports tags other than default
.
Usage:
moredefaults.Set(&obj) // uses the "default" tag
moredefaults.Set(&obj, "example") // uses the "example" tag
Expand ▾
Collapse ▴
Documentation
¶
func CanUpdate(v interface{}) bool
CanUpdate returns true when the given value is an initial value of its type
func MustSet(ptr interface{}, name ...string )
MustSet function is a wrapper of Set function
It will call Set and panic if err not equals nil.
Set 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
type Setter interface {
SetDefaults()
}
Setter is an interface for setting default values
Source Files
¶
Directories
¶
internal
Click to show internal directories.
Click to hide internal directories.