Implement config parser.

This commit is contained in:
Christian Schwarz
2017-04-26 18:36:01 +02:00
parent 40f3b530e1
commit 00231ecb73
4 changed files with 305 additions and 0 deletions
+5
View File
@@ -64,6 +64,11 @@ type DirectMapping struct {
}
func (m DirectMapping) Map(source DatasetPath) (target DatasetPath, err error) {
if m.Source == nil {
return m.Target, nil
}
if len(m.Source) != len(source) {
return nil, NoMatchError
}
+5
View File
@@ -35,6 +35,11 @@ func (p DatasetPath) ToString() string {
return strings.Join(p, "/")
}
func NewDatasetPath(s string) (p DatasetPath, err error) {
// TODO validation
return toDatasetPath(s), nil
}
func toDatasetPath(s string) DatasetPath {
return strings.Split(s, "/")
}