@@ -8,30 +8,33 @@ import (
88 "github.com/dnitsch/configmanager/pkg/generator"
99)
1010
11- type ConfigManager interface {
11+ type ConfigManageriface interface {
1212 Retrieve (tokens []string , config generator.GenVarsConfig ) (generator.ParsedMap , error )
13+ RetrieveWithInputReplaced (input string , config generator.GenVarsConfig ) (string , error )
1314 Insert ()
1415}
1516
17+ type ConfigManager struct {}
18+
1619// Retrieve gets a rawMap from a set implementation
1720// will be empty if no matches found
18- func Retrieve (tokens []string , config generator.GenVarsConfig ) (generator.ParsedMap , error ) {
21+ func ( c * ConfigManager ) Retrieve (tokens []string , config generator.GenVarsConfig ) (generator.ParsedMap , error ) {
1922 gv := generator .NewGenerator ()
2023 gv .WithConfig (& config )
2124 return gv .Generate (tokens )
2225}
2326
2427// RetrieveWithInputReplaced parses given input against all possible token strings
2528// using regex to grab a list of found tokens in the given string
26- func RetrieveWithInputReplaced (input string , config generator.GenVarsConfig ) (string , error ) {
29+ func ( c * ConfigManager ) RetrieveWithInputReplaced (input string , config generator.GenVarsConfig ) (string , error ) {
2730 tokens := []string {}
2831 for k := range generator .VarPrefix {
2932 matches := regexp .MustCompile (`(?s)` + regexp .QuoteMeta (k )+ `.([^\"]+)` ).FindAllString (input , - 1 )
3033 tokens = append (tokens , matches ... )
3134 }
3235
3336 cnf := generator.GenVarsConfig {}
34- m , err := Retrieve (tokens , cnf )
37+ m , err := c . Retrieve (tokens , cnf )
3538
3639 if err != nil {
3740 return "" , err
@@ -47,6 +50,6 @@ func replaceString(inputMap generator.ParsedMap, inputString string) string {
4750 return inputString
4851}
4952
50- func Insert () error {
53+ func ( c * ConfigManager ) Insert () error {
5154 return fmt .Errorf ("%s" , "NotYetImplemented" )
5255}
0 commit comments