diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-22 17:35:49 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-22 17:35:49 -0600 |
| commit | 20ef0d92694465ac86b550df139e8366a0a2b4fa (patch) | |
| tree | 3f14589e1ce6eb9306a3af31c3a1f9e1af5ed637 /vendor/github.com/authzed/spicedb/pkg/namespace/mapper.go | |
| parent | 44e0d272c040cdc53a98b9f1dc58ae7da67752e6 (diff) | |
feat: connect to spicedb
Diffstat (limited to 'vendor/github.com/authzed/spicedb/pkg/namespace/mapper.go')
| -rw-r--r-- | vendor/github.com/authzed/spicedb/pkg/namespace/mapper.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vendor/github.com/authzed/spicedb/pkg/namespace/mapper.go b/vendor/github.com/authzed/spicedb/pkg/namespace/mapper.go new file mode 100644 index 0000000..148ca8e --- /dev/null +++ b/vendor/github.com/authzed/spicedb/pkg/namespace/mapper.go @@ -0,0 +1,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{} |
