Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Add String() to enum type

天舟ee2b5970cf44
diff --git a/backend/api/principal.go b/backend/api/principal.go
index 67ef677503..79b9fb22b7 100644
--- a/backend/api/principal.go
+++ b/backend/api/principal.go
@@ -12,6 +12,18 @@ const (
Active PrincipalStatus = "ACTIVE"
)
+func (e PrincipalStatus) String() string {
+ switch e {
+ case Unknown:
+ return "UNKNOWN"
+ case Invited:
+ return "INVITED"
+ case Active:
+ return "ACTIVE"
+ }
+ return ""
+}
+
type PrincipalType string
const (
@@ -19,6 +31,16 @@ const (
BOT PrincipalType = "BOT"
)
+func (e PrincipalType) String() string {
+ switch e {
+ case EndUser:
+ return "END_USER"
+ case BOT:
+ return "BOT"
+ }
+ return ""
+}
+
type Principal struct {
ID int `jsonapi:"primary,principal"`