Documentation
¶
Index ¶
- func CreateLogger(logFile string) (*slog.Logger, error)
- func GetElemType(valueOf reflect.Value) reflect.Type
- func GetElemValue(valueOf reflect.Value) reflect.Value
- func GetFieldNames(typeOf reflect.Type) (names []string)
- func GetTableID(typeOf reflect.Type) (reflect.StructField, bool)
- func GetTableModel(fieldOf reflect.Value) reflect.Value
- func GetTagValue(tag string, key string) (string, bool)
- func HasTagValue(tag string, key string) bool
- func IsFieldHasSchema(valueOf reflect.Value, i int) bool
- func IsTableModel(fieldOf reflect.Value) bool
- func MakeDirForFile(filename string) (err error)
- func ParseSchemaTag(tag string) (schema, prefix string)
- func ParseTableNameByType(typeOf reflect.Type) string
- func ParseTableNameByValue(valueOf reflect.Value) string
- func TableNameMethod(valueOf reflect.Value) string
- func TableNamePattern(name string) string
- func TitleCase(word string) string
- func ToSnakeCase(name string) string
- type CoMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateLogger ¶
CreateLogger create logger by log file If log file directory not exist, create it
func GetFieldNames ¶
func GetTableID ¶
func GetTableID(typeOf reflect.Type) (reflect.StructField, bool)
func HasTagValue ¶
func IsFieldHasSchema ¶
IsFieldHasSchema check if field has schema tag or schema suffix
func IsTableModel ¶
func MakeDirForFile ¶
MakeDirForFile create directory for file if not exist
func ParseSchemaTag ¶
ParseSchemaTag parses the schema tag and returns the schema name and table prefix. Example: "public;prefix:t_" returns ("public", "t_") Example: "auth" returns ("auth", "")
func ParseTableNameByType ¶
ParseTableNameByType parse table name by type
func ParseTableNameByValue ¶
ParseTableNameByValue parse table name by value
func TableNameMethod ¶
TableNameMethod try to get table name from method TableNames If method TableNames is not found, return empty string
func TableNamePattern ¶
TableNamePattern is the default name patterning for mapping struct to table
func ToSnakeCase ¶
ToSnakeCase convert camelCase or PascalCase to snake_case