@@ -14,22 +14,22 @@ var tagCategories = []string{"json", "yaml"}
14
14
// WithTags allows you to specify custom tag categories to check for.
15
15
// It can be used to override the default "json" and "yaml" tags.
16
16
// The tags are checked in the order they are provided.
17
- func WithTags (tags ... string ) ToMapOptions {
17
+ func WithTags (tags ... string ) ToMapOption {
18
18
return func (h * handler ) {
19
19
h .tags = tags
20
20
}
21
21
}
22
22
23
23
// WithAllowNoTags allows you to specify whether to allow fields without tags.
24
24
// If used, fields without tags will be included in the output map.
25
- func WithAllowNoTags () ToMapOptions {
25
+ func WithAllowNoTags () ToMapOption {
26
26
return func (h * handler ) {
27
27
h .allowNoTags = true
28
28
}
29
29
}
30
30
31
- // ToMapOptions is a function that modifies the handler.
32
- type ToMapOptions func (* handler )
31
+ // ToMapOption is a function that modifies the handler.
32
+ type ToMapOption func (* handler )
33
33
34
34
// handler is a struct that contains the options for the ToMap function.
35
35
// It contains a list of tags to check for and a flag to allow fields
@@ -53,7 +53,7 @@ type tagWrapper struct {
53
53
// It also initializes the allowNoTags flag to false.
54
54
// It can be modified using the ToMapOptions functions.
55
55
// It returns a pointer to the handler.
56
- func newHandler (opts ... ToMapOptions ) * handler {
56
+ func newHandler (opts ... ToMapOption ) * handler {
57
57
h := & handler {
58
58
tags : tagCategories ,
59
59
allowNoTags : false ,
@@ -76,7 +76,7 @@ func newHandler(opts ...ToMapOptions) *handler {
76
76
//
77
77
// If the input is nil, it returns nil.
78
78
// If the input is not a struct or map, it returns an error.
79
- func ToMap (obj any , opts ... ToMapOptions ) (map [string ]any , error ) {
79
+ func ToMap (obj any , opts ... ToMapOption ) (map [string ]any , error ) {
80
80
handler := newHandler (opts ... )
81
81
82
82
if obj == nil {
0 commit comments