Skip to content

Commit

Permalink
Update content
Browse files Browse the repository at this point in the history
  • Loading branch information
kkyr committed Dec 12, 2023
1 parent ad2f398 commit ea9f4c8
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions fig.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ const (
DefaultTimeLayout = time.RFC3339
)

// StringUnmarshaler is an interface for custom unmarshaling of strings
// StringUnmarshaler is an interface designed for custom string unmarshaling.
//
// If a field with a local type asignment satisfies this interface, it allows the user
// to implement their own custom type unmarshaling method.
// This interface is used when a field of a custom type needs to define its own
// method for unmarshaling from a string. This is particularly useful for handling
// different string representations that need to be converted into a specific type.
//
// Example:
// Example usage:
//
// type ListenerType uint
//
Expand All @@ -43,10 +44,6 @@ const (
// ListenerTLS
// )
//
// type Config struct {
// Listener ListenerType `fig:"listener_type" default:"unix"`
// }
//
// func (l *ListenerType) UnmarshalType(v string) error {
// switch strings.ToLower(v) {
// case "unix":
Expand All @@ -60,6 +57,10 @@ const (
// }
// return nil
// }
//
// type Config struct {
// Listener ListenerType `fig:"listener_type" default:"tcp"`
// }
type StringUnmarshaler interface {
UnmarshalString(s string) error
}
Expand Down

0 comments on commit ea9f4c8

Please sign in to comment.