[chore] rename New___(string) int signature functions to Parse___(string) int (#3580)

* rename New___(string) int {} signature functions to Parse___(string) int {}

* remove test output
This commit is contained in:
kim 2024-11-28 11:54:22 +00:00 committed by GitHub
commit 312cb8b9c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 26 additions and 26 deletions

View file

@ -19,6 +19,7 @@ package gtsmodel
import (
"path"
"strings"
"time"
)
@ -46,8 +47,8 @@ func (c AdminActionCategory) String() string {
}
}
func NewAdminActionCategory(in string) AdminActionCategory {
switch in {
func ParseAdminActionCategory(in string) AdminActionCategory {
switch strings.ToLower(in) {
case "account":
return AdminActionCategoryAccount
case "domain":
@ -96,8 +97,8 @@ func (t AdminActionType) String() string {
}
}
func NewAdminActionType(in string) AdminActionType {
switch in {
func ParseAdminActionType(in string) AdminActionType {
switch strings.ToLower(in) {
case "disable":
return AdminActionDisable
case "reenable":

View file

@ -17,7 +17,10 @@
package gtsmodel
import "time"
import (
"strings"
"time"
)
// DomainPermission models a domain permission
// entry -- block / allow / draft / exclude.
@ -62,8 +65,8 @@ func (p DomainPermissionType) String() string {
}
}
func NewDomainPermissionType(in string) DomainPermissionType {
switch in {
func ParseDomainPermissionType(in string) DomainPermissionType {
switch strings.ToLower(in) {
case "block":
return DomainPermissionBlock
case "allow":

View file

@ -87,8 +87,8 @@ func (t NotificationType) String() string {
}
}
// NewNotificationType returns a notification type from the given value.
func NewNotificationType(in string) NotificationType {
// ParseNotificationType returns a notification type from the given value.
func ParseNotificationType(in string) NotificationType {
switch strings.ToLower(in) {
case "follow":
return NotificationFollow