Implement config parser.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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, "/")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user