* change column to read from information_schema * reactor generate mode from datasource * reactor generate mode from datasource * add primary key check logic * resolve rebase conflicts * add naming style * add filename test case * resolve rebase conflicts * reactor test * add test case * change shell script to makefile * update rpc new * update gen_test.go * format code * format code * update test * generates alias
25 lines
623 B
Go
25 lines
623 B
Go
package generator
|
|
|
|
type NamingStyle = string
|
|
|
|
const (
|
|
namingLower NamingStyle = "lower"
|
|
namingCamel NamingStyle = "camel"
|
|
namingSnake NamingStyle = "snake"
|
|
)
|
|
|
|
// IsNamingValid validates whether the namingStyle is valid or not,return
|
|
// namingStyle and true if it is valid, or else return empty string
|
|
// and false, and it is a valid value even namingStyle is empty string
|
|
func IsNamingValid(namingStyle string) (NamingStyle, bool) {
|
|
if len(namingStyle) == 0 {
|
|
namingStyle = namingLower
|
|
}
|
|
switch namingStyle {
|
|
case namingLower, namingCamel, namingSnake:
|
|
return namingStyle, true
|
|
default:
|
|
return "", false
|
|
}
|
|
}
|