aboutsummaryrefslogtreecommitdiff
path: root/backend/general/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/general/utils.go')
-rw-r--r--backend/general/utils.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/backend/general/utils.go b/backend/general/utils.go
new file mode 100644
index 0000000..fe0854a
--- /dev/null
+++ b/backend/general/utils.go
@@ -0,0 +1,16 @@
+package general
+
+import (
+ "fmt"
+ "strings"
+)
+
+func ParseURI(uri string) (repo, collection, rkey string, err error) {
+ // URI format: 'at://DID/collection/recordkey'
+ parts := strings.Split(strings.TrimPrefix(uri, "at://"), "/")
+ if len(parts) != 3 {
+ return "", "", "", fmt.Errorf("invalid URI format: %s", uri)
+ }
+
+ return parts[0], parts[1], parts[2], nil
+}