MM-14442: Merge function, to enable merging of configs (#10423)
* MM-14442: Merge function, to enable merging of configs Merge will return a new struct of the same type as base and patch, with patch merged into base. Specifically, patch's values will be preferred except when patch's value is `nil`. Restrictions/guarantees: - base or patch will not be modified - base and patch can be pointers or values - base and patch must be the same type - base and patch must have no unexported types (at the moment) - if maps or slices are different, the entire map or slice will be replaced (at the moment) * License header * major rewrite addressing PR comments from Jesse * MM-14442: merge function for config files - simplified merge for slices and maps - fixed many problems with nested pointers/maps/slices - all references are cloned - 54 new tests, simplified tests for specific problems * MM-14442: fixing formatting, comments
Этот коммит содержится в:
коммит произвёл
Jesse Hallam
родитель
372ef87f76
Коммит
498b988a6b
@@ -26,3 +26,8 @@ func InitializeConfigurationsTable(db *sqlx.DB) error {
|
||||
func ResolveConfigFilePath(path string) (string, error) {
|
||||
return resolveConfigFilePath(path)
|
||||
}
|
||||
|
||||
// GetCommonStore exposes the internal commonStore to test only.
|
||||
func (ms *memoryStore) MergeConfig(patch *model.Config) (*model.Config, error) {
|
||||
return ms.mergeConfig(patch)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user