fix(lint): Start to apply linter recommandation
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@ -6,28 +6,28 @@ import (
|
||||
"github.com/juju/errors"
|
||||
)
|
||||
|
||||
// ApiTypeName
|
||||
type ApiTypeName string
|
||||
// APITypeName
|
||||
type APITypeName string
|
||||
|
||||
const (
|
||||
ApiTypeName_GIN_GONIC ApiTypeName = "Gin Gonic"
|
||||
ApiTypeName_GO_SWAGGER ApiTypeName = "Go Swagger"
|
||||
ApiTypeName_MOJOLICIOUS ApiTypeName = "Mojolicious"
|
||||
ApiTypeName_NULL ApiTypeName = ""
|
||||
APITypeName_GIN_GONIC APITypeName = "Gin Gonic"
|
||||
APITypeName_GO_SWAGGER APITypeName = "Go Swagger"
|
||||
APITypeName_MOJOLICIOUS APITypeName = "Mojolicious"
|
||||
APITypeName_NULL APITypeName = ""
|
||||
)
|
||||
|
||||
// GetListOfApiTypeName returns a list of ApiTypeName
|
||||
func GetListOfApiTypeName() []ApiTypeName {
|
||||
return []ApiTypeName{
|
||||
ApiTypeName_GIN_GONIC,
|
||||
ApiTypeName_GO_SWAGGER,
|
||||
ApiTypeName_MOJOLICIOUS,
|
||||
// GetListOfAPITypeName returns a list of APITypeName
|
||||
func GetListOfAPITypeName() []APITypeName {
|
||||
return []APITypeName{
|
||||
APITypeName_GIN_GONIC,
|
||||
APITypeName_GO_SWAGGER,
|
||||
APITypeName_MOJOLICIOUS,
|
||||
}
|
||||
}
|
||||
|
||||
// IsValid validates enum values
|
||||
func (e ApiTypeName) IsValid() bool {
|
||||
for _, v := range GetListOfApiTypeName() {
|
||||
func (e APITypeName) IsValid() bool {
|
||||
for _, v := range GetListOfAPITypeName() {
|
||||
if e == v {
|
||||
return true
|
||||
}
|
||||
@ -36,27 +36,27 @@ func (e ApiTypeName) IsValid() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func NewApiTypeName(in string) (ApiTypeName, error) {
|
||||
out := ApiTypeName_NULL
|
||||
func NewAPITypeName(in string) (APITypeName, error) {
|
||||
out := APITypeName_NULL
|
||||
if in != "" {
|
||||
out = ApiTypeName(in)
|
||||
out = APITypeName(in)
|
||||
if !out.IsValid() {
|
||||
return ApiTypeName_NULL, errors.BadRequestf("Value %s invalid for enum ApiTypeName", in)
|
||||
return APITypeName_NULL, errors.BadRequestf("Value %s invalid for enum APITypeName", in)
|
||||
}
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// NewApiTypeNameFromInput
|
||||
func NewApiTypeNameFromInput(in string) (ApiTypeName, error) {
|
||||
// NewAPITypeNameFromInput
|
||||
func NewAPITypeNameFromInput(in string) (APITypeName, error) {
|
||||
|
||||
in = strings.ToLower(in)
|
||||
in = strings.ReplaceAll(in, " ", "-")
|
||||
in = strings.ReplaceAll(in, "_", "-")
|
||||
|
||||
out := ApiTypeName_NULL
|
||||
out := APITypeName_NULL
|
||||
if in != "" {
|
||||
for _, apiTypeName := range GetListOfApiTypeName() {
|
||||
for _, apiTypeName := range GetListOfAPITypeName() {
|
||||
apiTypeStr := strings.ToLower(string(apiTypeName))
|
||||
apiTypeStr = strings.ReplaceAll(apiTypeStr, " ", "-")
|
||||
apiTypeStr = strings.ReplaceAll(apiTypeStr, "_", "-")
|
||||
@ -64,7 +64,7 @@ func NewApiTypeNameFromInput(in string) (ApiTypeName, error) {
|
||||
return apiTypeName, nil
|
||||
}
|
||||
}
|
||||
return ApiTypeName_NULL, errors.BadRequestf("Value %s invalid for enum ApiTypeName", in)
|
||||
return APITypeName_NULL, errors.BadRequestf("Value %s invalid for enum APITypeName", in)
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user