improvements

This commit is contained in:
Lunny Xiao
2025-06-21 15:24:54 -07:00
parent ddd1e6ca83
commit ef7a98b505
9 changed files with 118 additions and 46 deletions
+11
View File
@@ -39,6 +39,10 @@ func (vt VisibleType) IsPrivate() bool {
return vt == VisibleTypePrivate
}
func (vt VisibleType) IsValid() bool {
return vt.String() != ""
}
// VisibilityString provides the mode string of the visibility type (public, limited, private)
func (vt VisibleType) String() string {
for k, v := range VisibilityModes {
@@ -56,3 +60,10 @@ func ExtractKeysFromMapString(in map[string]VisibleType) (keys []string) {
}
return keys
}
func ConvertStringToVisibleType(s string) VisibleType {
if vt, ok := VisibilityModes[s]; ok {
return vt
}
return VisibleType(-1) // Invalid type
}