Skip to content

Commit

Permalink
Expose slices of options for easier wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
greencoda committed Apr 24, 2024
1 parent 3cac413 commit d52b86f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package confiq

// ConfigSetOptions is exposed so that functions which wrap the New function can make adding the WithTag option easier.
type ConfigSetOptions []loadOption

type configSetOption func(*ConfigSet)

// WithTag sets the struct tag to be used by the decoder for reading configuration values of struct fields.
Expand All @@ -9,6 +12,9 @@ func WithTag(tag string) configSetOption {
}
}

// LoadOptions is exposed so that functions which wrap the Load function can make adding the WithPrefix option easier.
type LoadOptions []loadOption

type loadOption func(*loader)

// WithPrefix sets the prefix to be used when loading configuration values into the ConfigSet.
Expand All @@ -18,6 +24,9 @@ func WithPrefix(prefix string) loadOption {
}
}

// DecodeOptions is exposed so that functions which wrap the Decode function can make adding the AsStrict and FromPrefix options easier.
type DecodeOptions []decodeOption

type decodeOption func(*decodeSettings)

// AsStrict sets the decoder to decode the configuration values as if all fields are set to strict.
Expand Down

0 comments on commit d52b86f

Please sign in to comment.