Documentation ¶
Index ¶
- func CamelCaseSlice(elem []string) string
- func CheckProtoSyntax(file *descriptorpb.FileDescriptorProto) error
- func ClearPointer(s string) string
- func ConvertToNullType(field *descriptorpb.FieldDescriptorProto) string
- func ConvertType(field *descriptorpb.FieldDescriptorProto) string
- func ConvertTypeSQLite(field *descriptorpb.FieldDescriptorProto) string
- func CopyMessage(src *descriptorpb.DescriptorProto) *descriptorpb.DescriptorProto
- func DetectField(structName string) string
- func DetectMany(t string) bool
- func DetectReference(structName string) string
- func DetectStoreName(t string) string
- func DetectStructName(t string) string
- func DetectTableName(t string) string
- func DetermineRelationDirection(rd *descriptorpb.DescriptorProto, pd *descriptorpb.DescriptorProto) string
- func DumpPrint(values ...interface{})
- func ExecuteTemplate(tmpl string, funcs template.FuncMap, data any, templates ...IncludeTemplate) (string, error)
- func FirstLetterLower(s string) (string, error)
- func GetDBOptions(f *descriptorpb.FileDescriptorProto) *structify.StructifyDBOptions
- func GetFieldOptions(f *descriptorpb.FieldDescriptorProto) *structify.StructifyFieldOptions
- func GetMessageOptions(d *descriptorpb.DescriptorProto) *structify.StructifyMessageOptions
- func GetUserProtoFile(req *plugingo.CodeGeneratorRequest) *descriptorpb.FileDescriptorProto
- func GetUserProtoFiles(req *plugingo.CodeGeneratorRequest) []*descriptorpb.FileDescriptorProto
- func GoFmt(resp *plugingo.CodeGeneratorResponse) error
- func GoTypeToPostgresType(goType string) string
- func GoTypeToSQLiteType(goType string) string
- func HasIndex(f *descriptorpb.FieldDescriptorProto) bool
- func HasUnique(f *descriptorpb.FieldDescriptorProto) bool
- func IsContainsStar(s string) bool
- func IsOptional(field *descriptorpb.FieldDescriptorProto) bool
- func IsRepeated(field *descriptorpb.FieldDescriptorProto) bool
- func IsUserMessage(f *descriptorpb.FileDescriptorProto, m *descriptorpb.DescriptorProto) bool
- func LowerCamelCase(name string) string
- func LowerClientName(name string) string
- func Plural(name string) string
- func PostgresType(goType string, options *structify.StructifyFieldOptions, isJson bool) string
- func SQLiteType(goType string, options *structify.StructifyFieldOptions, isJson bool) string
- func SliceToString(slice []string) string
- func SnakeCase(name string) string
- func ToLower(name string) string
- func TypePrefix(field *descriptorpb.FieldDescriptorProto, typeName string) string
- func UpperCamelCase(name string) string
- func UpperClientName(name string) string
- type DescriptorMList
- type IncludeTemplate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CamelCaseSlice ¶
CamelCaseSlice returns the camel case of a slice.
func CheckProtoSyntax ¶
func CheckProtoSyntax(file *descriptorpb.FileDescriptorProto) error
CheckProtoSyntax checks if the syntax of the file is proto3.
func ClearPointer ¶
ClearPointer removes the pointer and slice from a string.
func ConvertToNullType ¶ added in v1.1.4
func ConvertToNullType(field *descriptorpb.FieldDescriptorProto) string
ConvertToNullType converts a field descriptor type to its corresponding nullable type.
func ConvertType ¶
func ConvertType(field *descriptorpb.FieldDescriptorProto) string
ConvertType converts a protobuf type to a Go type.
func ConvertTypeSQLite ¶ added in v1.1.0
func ConvertTypeSQLite(field *descriptorpb.FieldDescriptorProto) string
func CopyMessage ¶ added in v1.0.10
func CopyMessage(src *descriptorpb.DescriptorProto) *descriptorpb.DescriptorProto
func DetectMany ¶
DetectMany returns true if the field is a many relation.
func DetectReference ¶
DetectReference returns the reference field name.
func DetectStoreName ¶
DetectStoreName returns the postgres type for the given type.
func DetectStructName ¶
DetectStructName returns the struct name for the given type.
func DetectTableName ¶
DetectTableName returns the postgres type for the given type.
func DetermineRelationDirection ¶
func DetermineRelationDirection(rd *descriptorpb.DescriptorProto, pd *descriptorpb.DescriptorProto) string
DetermineRelationDirection determines the relation direction.
func ExecuteTemplate ¶
func ExecuteTemplate(tmpl string, funcs template.FuncMap, data any, templates ...IncludeTemplate) (string, error)
ExecuteTemplate executes a template.
func FirstLetterLower ¶
FirstLetterLower converts the first letter of a string to lowercase.
func GetDBOptions ¶
func GetDBOptions(f *descriptorpb.FileDescriptorProto) *structify.StructifyDBOptions
GetDBOptions returns the custom options for a file.
func GetFieldOptions ¶
func GetFieldOptions(f *descriptorpb.FieldDescriptorProto) *structify.StructifyFieldOptions
GetFieldOptions returns the custom options for a field.
func GetMessageOptions ¶
func GetMessageOptions(d *descriptorpb.DescriptorProto) *structify.StructifyMessageOptions
GetMessageOptions returns the custom options for a message.
func GetUserProtoFile ¶
func GetUserProtoFile(req *plugingo.CodeGeneratorRequest) *descriptorpb.FileDescriptorProto
GetUserProtoFile returns the first user proto file.
func GetUserProtoFiles ¶
func GetUserProtoFiles(req *plugingo.CodeGeneratorRequest) []*descriptorpb.FileDescriptorProto
GetUserProtoFiles returns the user proto files.
func GoFmt ¶
func GoFmt(resp *plugingo.CodeGeneratorResponse) error
GoFmt formats the generated Go code.
func GoTypeToPostgresType ¶
GoTypeToPostgresType returns the postgres type for the given type.
func GoTypeToSQLiteType ¶ added in v1.1.0
GoTypeToSQLiteType returns the postgres type for the given type.
func HasIndex ¶ added in v1.0.3
func HasIndex(f *descriptorpb.FieldDescriptorProto) bool
HasIndex returns the index option for a field.
func HasUnique ¶ added in v1.0.3
func HasUnique(f *descriptorpb.FieldDescriptorProto) bool
HasUnique returns the unique option for a field.
func IsContainsStar ¶
IsContainsStar returns true if the string contains a star.
func IsOptional ¶
func IsOptional(field *descriptorpb.FieldDescriptorProto) bool
IsOptional returns true if the field is optional and not a string, bytes, int32, int64, float32, float64, bool, uint32, uint64 type or a Google Protobuf wrapper message.
func IsRepeated ¶
func IsRepeated(field *descriptorpb.FieldDescriptorProto) bool
IsRepeated returns true if the field is repeated.
func IsUserMessage ¶
func IsUserMessage(f *descriptorpb.FileDescriptorProto, m *descriptorpb.DescriptorProto) bool
IsUserMessage returns true if the message is not a google.protobuf or structify message.
func LowerCamelCase ¶
LowerCamelCase converts a string to a lowerCamelCase string.
func LowerClientName ¶
LowerClientName returns the lowerCamelCase name of the client.
func PostgresType ¶
func PostgresType(goType string, options *structify.StructifyFieldOptions, isJson bool) string
PostgresType returns the postgres type for the given type.
func SQLiteType ¶ added in v1.1.0
func SQLiteType(goType string, options *structify.StructifyFieldOptions, isJson bool) string
func SliceToString ¶
SliceToString converts a slice of strings to a string.
func TypePrefix ¶
func TypePrefix(field *descriptorpb.FieldDescriptorProto, typeName string) string
TypePrefix returns the type prefix.
func UpperCamelCase ¶
UpperCamelCase converts a string to a CamelCase string.
func UpperClientName ¶
UpperClientName returns the upperCamelCase name of the client.
Types ¶
type DescriptorMList ¶
type DescriptorMList map[string]*descriptorpb.DescriptorProto
DescriptorMList is a map of descriptors.