Skip to content

Commit e76bdbc

Browse files
feat(ConfigType): simplifies dependant use by implementing base functionality.
1 parent 98b86f3 commit e76bdbc

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

config_type.go

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
package configurator
22

3+
var _ ConfigImplementer = (*ConfigType)(nil)
4+
5+
// ConfigType provides an abstract struct (née abstract base class) to compose
6+
// into concrete config parser implementations.
37
type ConfigType struct {
4-
Data ConfigImplementer
8+
// Config provides
9+
Config ConfigImplementer
510
}
611

12+
// Validate expects the implementor to return any errors found in the parsed
13+
// configuration. If any errors are found it aims to provide clear user
14+
// instruction as to where errors were encountered and how one would go about
15+
// fixing it.
716
func (c *ConfigType) Validate() error {
8-
// base case no validation required
9-
return nil
17+
return c.Config.Validate()
1018
}
1119

12-
func (c *ConfigType) Merge(config any) any {
13-
panic("implement me")
20+
// Merge expects the implementor to merge the parsed configuration from the
21+
// concrete implementation and bind it back into the provided domain config.
22+
func (c *ConfigType) Merge(domainConfig any) any {
23+
return c.Config.Merge(domainConfig)
1424
}

0 commit comments

Comments
 (0)