package ident
import (
"strings"
"google.golang.org/protobuf/compiler/protogen"
)
func WithChild(id protogen.GoIdent, child string) protogen.GoIdent {
return WithSuffix(id, "."+child)
}
func WithPrefix(id protogen.GoIdent, prefix string) protogen.GoIdent {
id.GoName = prefix + id.GoName
return id
}
func WithSuffix(id protogen.GoIdent, suffix string) protogen.GoIdent {
id.GoName = id.GoName + suffix
return id
}
func LeafName(id protogen.GoIdent) string {
names := strings.Split(id.GoName, ".")
return names[len(names)-1]
}