snapshot of https://github.com/centrifugal/centrifugo.git (master, 2026-09-16; blobs > 131072B omitted)
This commit is contained in:
12
internal/gen/utils.go
Normal file
12
internal/gen/utils.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package gen
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func CamelToSnake(s string) string {
|
||||
re := regexp.MustCompile("([a-z0-9])([A-Z])")
|
||||
snake := re.ReplaceAllString(s, "${1}_${2}")
|
||||
return strings.ToLower(snake)
|
||||
}
|
||||
Reference in New Issue
Block a user