blob: 148ca8e8028450444fc6c95fc87ed17cc310bf4d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package namespace
// Mapper provides an interface for creating synthetic namespace names from
// user provided namespace names.
type Mapper interface {
// Encode translates a given namespace name to an encoded namespace identifier.
Encode(name string) (string, error)
// Reverse translates a given namespace identifier to the user supplied namespace name.
Reverse(id string) (string, error)
}
type passthrough struct{}
// Encode implements Mapper
func (p passthrough) Encode(name string) (string, error) {
return name, nil
}
// Reverse implements Mapper
func (p passthrough) Reverse(id string) (string, error) {
return id, nil
}
// PassthroughMapper is a mapper implementation which passes through the original namespace
// names unmodified.
var PassthroughMapper Mapper = passthrough{}
|