fix manager generic constraints
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Manager is the top-level configuration schema and viper instance.
|
// Manager is the top-level configuration schema and viper instance.
|
||||||
type Manager[T struct{}] struct {
|
type Manager[T any] struct {
|
||||||
// PreLoad is an optional function that is called before loading the
|
// PreLoad is an optional function that is called before loading the
|
||||||
// configuration file.
|
// configuration file.
|
||||||
PreLoad func(*Manager[T]) error
|
PreLoad func(*Manager[T]) error
|
||||||
@@ -37,7 +37,7 @@ type Manager[T struct{}] struct {
|
|||||||
// NewManager creates a new configuration manager for schema T. Fields in T are
|
// NewManager creates a new configuration manager for schema T. Fields in T are
|
||||||
// responsible for including any necessary `mapstructure` and `validate` tags
|
// responsible for including any necessary `mapstructure` and `validate` tags
|
||||||
// to ensure proper unmarshalling and validation of the configuration schema.
|
// to ensure proper unmarshalling and validation of the configuration schema.
|
||||||
func NewManager[T struct{}](configName, configType, configPath string) *Manager[T] {
|
func NewManager[T any](configName, configType, configPath string) *Manager[T] {
|
||||||
m := &Manager[T]{
|
m := &Manager[T]{
|
||||||
viper: viper.New(),
|
viper: viper.New(),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user