Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/creasty/defaults
/ types & classes
Types & classes
149 in github.com/creasty/defaults
⨍
Functions
250
◇
Types & classes
149
↓ 2 callers
TypeAlias
myDuration
set_duration_test.go:15
↓ 2 callers
TypeAlias
umJSONEnum
umJSONEnum implements json.Unmarshaler only, so it exercises the JSON branch of the unmarshal-by-interface path. All types in this file are package-le
set_unmarshaler_test.go:21
↓ 2 callers
TypeAlias
umLevelTextAndSetter
umLevelTextAndSetter is a non-struct type with a text form and a setter. Behind a pointer its setter is called from the pointer branch of setField, wh
set_unmarshaler_test.go:68
↓ 1 callers
TypeAlias
SetterLevel
SetterLevel is a non-struct type with a setter. The struct recursion never reaches it, so behind a pointer its only call is the one the pointer branch
setter_test.go:74
↓ 1 callers
TypeAlias
benchJSON
benchJSON takes every tag and stores its length.
benchmark_test.go:664
↓ 1 callers
TypeAlias
benchText
benchText takes every tag and stores its length.
benchmark_test.go:656
↓ 1 callers
TypeAlias
myString
set_pointer_test.go:13
↓ 1 callers
TypeAlias
nodePtr
set_cycle_test.go:71
↓ 1 callers
TypeAlias
umFailingJSON
umFailingJSON always fails, so Set has to fall back to parsing by kind.
set_unmarshaler_test.go:121
↓ 1 callers
TypeAlias
umFailingText
umFailingText always fails, so Set has to fall back to parsing by kind.
set_unmarshaler_test.go:114
Struct
Client
example_test.go:102
Struct
Config
Config implements defaults.Setter for ExampleSetter below.
example_test.go:13
Struct
Embedded
set_nesting_test.go:17
Struct
Endpoint
Endpoint implements defaults.Setter for Example below.
example_test.go:27
Struct
Gateway
example_test.go:43
Struct
Inner
set_struct_test.go:95
Struct
Middle
setter_test.go:369
Struct
OptOutSetter
OptOutSetter records whether its setter ran, so a test can tell whether `default:"-"` suppresses the setter along with the tags. It is package-level o
set_optout_test.go:15
Struct
Retry
example_test.go:99
Struct
Server
example_test.go:76
Interface
Setter
Setter is an interface for setting default values. Set calls SetDefaults on a struct once it has filled the struct's fields, and again for every othe
setter.go:13
Struct
SetterCounter
SetterCounter counts its own invocations. Its name is exported because it is embedded below, for the same reason as SetterInner's.
setter_test.go:37
Struct
SetterInner
SetterInner is embedded by pointer below, which is why its name is exported: an embedded field takes the name of its type, and an unexported one would
setter_test.go:47
Struct
Tagged
set_struct_test.go:76
Struct
UmTextAndSetter
UmTextAndSetter implements encoding.TextUnmarshaler and defaults.Setter, and appends to Via as each one runs, so a test can tell "only text ran" from
set_unmarshaler_test.go:53
Struct
Untagged
set_struct_test.go:79
Struct
array
set_unmarshaler_test.go:447
Struct
bad
set_error_test.go:181
Struct
bad
set_pointer_test.go:225
Struct
badSlice
set_error_test.go:72
TypeAlias
benchRejecting
benchRejecting rejects every tag from both unmarshalers, so parsing by kind takes it. The rejection is an error that already exists, so it allocates n
benchmark_test.go:673
Struct
benchRejectingStruct
benchRejectingStruct rejects every tag, and is a struct, so encoding/json is tried next.
benchmark_test.go:680
Struct
benchSetterItem
benchSetterItem has a SetDefaults that does nothing, so Set leaves a filled one as it is.
benchmark_test.go:687
Struct
both
set_unmarshaler_test.go:412
Struct
child
set_pointer_test.go:126
Struct
complexNumber
set_unmarshaler_test.go:456
Struct
cycleCounter
cycleCounter counts its setter's calls, so a test can tell how many times the walk reached it. It is package-level only because it needs a method.
set_cycle_test.go:14
Struct
emptyTagNode
An empty tag still allocates a pointer, so it recurses like any other.
set_recursion_test.go:30
Struct
fieldTag
fieldTag is the `default` tag as it applies to one field: the field's name, for error messages, the tag's value, and whether the tag was present at al
set.go:25
Struct
flagged
benchmark_test.go:451
Struct
indexEntry
indexEntry is an entry the path's index holds: its key, and the next entry in its bucket.
path.go:147
Struct
inner
set_unexported_test.go:40
Struct
inner
set_scalar_test.go:467
Struct
inner
set_preserve_test.go:61
Struct
inner
set_pointer_test.go:42
Struct
inner
set_slice_test.go:79
Struct
inner
set_struct_test.go:13
Struct
inner
set_optout_test.go:62
Struct
inner
set_map_test.go:65
Struct
inner
benchmark_test.go:50
Struct
int64Kind
set_unmarshaler_test.go:415
Struct
item
benchmark_test.go:261
Struct
jsonOnly
set_unmarshaler_test.go:409
Struct
leaf
set_recursion_test.go:140
Struct
leaf
benchmark_test.go:222
Struct
leaf
set_nesting_test.go:20
Struct
link
benchmark_test.go:307
TypeAlias
loop
set_cycle_test.go:83
Struct
mapKeyHook
mapKeyHook runs hook when Set calls its setter, so a test can change the map holding it while Set walks that map. It is package-level only because it
set_map_test.go:217
Struct
mapNode
set_recursion_test.go:26
Struct
methodEmbedsInterface
method_test.go:50
Struct
methodEmbedsPointerField
methodEmbedsPointerField embeds a pointer, and takes the method through it.
method_test.go:36
Struct
methodEmbedsPointerReceiver
methodEmbedsPointerReceiver embeds a value whose method has a pointer receiver, so the method is in the embedding pointer's set alone.
method_test.go:33
Struct
methodEmbedsTwice
methodEmbedsTwice takes it from a field that took it from a field.
method_test.go:39
Struct
methodEmbedsValue
methodEmbedsValue takes it from a field, promoted.
method_test.go:29
Interface
methodPinger
methodPinger is embedded as an interface, so the method is promoted from a field that holds it.
method_test.go:48
Struct
methodPointer
methodPointer declares it on a pointer receiver, so only a pointer to it has the method.
method_test.go:24
Struct
methodShadows
methodShadows declares its own over the one it would take from its field, and calls through to it, as a type that means to add to an embedded method d
method_test.go:43
Struct
methodValue
This test is in package defaults rather than defaults_test: isPromotedMethod is unexported, and Set reaches it only with a struct, a setter and a walk
method_test.go:19
Struct
mid
benchmark_test.go:225
TypeAlias
myBool
set_scalar_test.go:297
TypeAlias
myFloat32
set_scalar_test.go:295
TypeAlias
myFloat64
set_scalar_test.go:296
TypeAlias
myInt
set_scalar_test.go:284
TypeAlias
myInt16
set_scalar_test.go:286
TypeAlias
myInt32
set_scalar_test.go:287
TypeAlias
myInt64
set_scalar_test.go:288
TypeAlias
myInt8
set_scalar_test.go:285
TypeAlias
myMap
set_map_test.go:37
TypeAlias
mySlice
set_slice_test.go:53
TypeAlias
myString
set_scalar_test.go:298
TypeAlias
myUint
set_scalar_test.go:289
TypeAlias
myUint16
set_scalar_test.go:291
TypeAlias
myUint32
set_scalar_test.go:292
TypeAlias
myUint64
set_scalar_test.go:293
TypeAlias
myUint8
set_scalar_test.go:290
TypeAlias
myUintptr
set_scalar_test.go:294
Struct
node
set_cycle_test.go:31
Struct
node
set_shared_test.go:89
Struct
node
set_recursion_test.go:76
Struct
node
benchmark_test.go:362
Struct
optOutRoot
optOutRoot is the documented way to give an opted-out field a dynamic default: the tag says "hands off", and the struct's own setter fills it in.
set_optout_test.go:26
Struct
pair
set_recursion_test.go:143
Struct
parent
set_pointer_test.go:130
Struct
partly
set_error_test.go:184
Struct
pathIndex
pathIndex is the index of a path too deep to scan: the entries at the top of the path, down to some depth, and a hash table of their keys. Entries joi
path.go:140
Struct
pathKey
pathKey names an entry in the path's index by its address, its type and its length. They are held as uintptrs, not pointers: a pointer read off an ent
path.go:117
Struct
pendingDefault
pendingDefault is a tag being applied to a zero value further up the current path, linked to the one being applied above it.
set.go:33
Struct
point
set_error_test.go:177
Struct
pointer
set_unmarshaler_test.go:450
next →
1–100 of 149, ranked by callers