NewResolver creates a new resolver that caches resolved variables in memory and in the provided cache
(localCache localcache.Cache, predefinedVariableOptions *PredefinedVariableOptions, flags []string, log log.Logger)
| 24 | |
| 25 | // NewResolver creates a new resolver that caches resolved variables in memory and in the provided cache |
| 26 | func NewResolver(localCache localcache.Cache, predefinedVariableOptions *PredefinedVariableOptions, flags []string, log log.Logger) (Resolver, error) { |
| 27 | memoryCache := map[string]interface{}{} |
| 28 | err := MergeVarsWithFlags(memoryCache, flags) |
| 29 | if err != nil { |
| 30 | return nil, err |
| 31 | } |
| 32 | |
| 33 | return &resolver{ |
| 34 | memoryCache: memoryCache, |
| 35 | localCache: localCache, |
| 36 | options: predefinedVariableOptions, |
| 37 | log: log, |
| 38 | }, nil |
| 39 | } |
| 40 | |
| 41 | func MergeVarsWithFlags(vars map[string]interface{}, flags []string) error { |
| 42 | for _, cmdVar := range flags { |
no test coverage detected