Use apiextension v1
- upgrade from apiextension v1beta1 to v1 - generate yaml manifest for crd intead of applying it at runtime - users will have to apply the manifest with kubectl - kg and kgctl log an error if the crd is not present - now validation should actually work Signed-off-by: leonnicolas <leonloechner@gmx.de>
This commit is contained in:
59
vendor/github.com/gobuffalo/flect/pluralize.go
generated
vendored
Normal file
59
vendor/github.com/gobuffalo/flect/pluralize.go
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
package flect
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var pluralMoot = &sync.RWMutex{}
|
||||
|
||||
// Pluralize returns a plural version of the string
|
||||
// user = users
|
||||
// person = people
|
||||
// datum = data
|
||||
func Pluralize(s string) string {
|
||||
return New(s).Pluralize().String()
|
||||
}
|
||||
|
||||
// PluralizeWithSize will pluralize a string taking a number number into account.
|
||||
// PluralizeWithSize("user", 1) = user
|
||||
// PluralizeWithSize("user", 2) = users
|
||||
func PluralizeWithSize(s string, i int) string {
|
||||
if i == 1 || i == -1 {
|
||||
return New(s).Singularize().String()
|
||||
}
|
||||
return New(s).Pluralize().String()
|
||||
}
|
||||
|
||||
// Pluralize returns a plural version of the string
|
||||
// user = users
|
||||
// person = people
|
||||
// datum = data
|
||||
func (i Ident) Pluralize() Ident {
|
||||
s := i.LastPart()
|
||||
if len(s) == 0 {
|
||||
return New("")
|
||||
}
|
||||
|
||||
pluralMoot.RLock()
|
||||
defer pluralMoot.RUnlock()
|
||||
|
||||
ls := strings.ToLower(s)
|
||||
if _, ok := pluralToSingle[ls]; ok {
|
||||
return i
|
||||
}
|
||||
if p, ok := singleToPlural[ls]; ok {
|
||||
return i.ReplaceSuffix(s, p)
|
||||
}
|
||||
for _, r := range pluralRules {
|
||||
if strings.HasSuffix(ls, r.suffix) {
|
||||
return i.ReplaceSuffix(s, r.fn(s))
|
||||
}
|
||||
}
|
||||
|
||||
if strings.HasSuffix(ls, "s") {
|
||||
return i
|
||||
}
|
||||
|
||||
return New(i.String() + "s")
|
||||
}
|
Reference in New Issue
Block a user