Documentation
¶
Index ¶
- func GenerateFieldIndexName(tableName, fieldName string) string
- func GenerateIndexName(tableName string, fields []string, unique bool, existingName string) string
- func IsCamelCase(s string) bool
- func IsPascalCase(s string) bool
- func IsSimpleType(t reflect.Type) bool
- func IsSnakeCase(s string) bool
- func NormalizeIndexName(name string) string
- func Pluralize(s string) string
- func ScanRow(rows *sql.Rows, dest any) error
- func ScanRowContext(db interface{ ... }, ctx context.Context, query string, args []any, dest any) error
- func ScanRowSimple(row *sql.Row, dest any) error
- func ScanRows(rows *sql.Rows, dest any) error
- func ScanRowsToMaps(rows *sql.Rows) ([]map[string]any, error)
- func Singularize(s string) string
- func ToBool(v any) bool
- func ToCamelCase(s string) string
- func ToFloat32(v any) float32
- func ToFloat64(v any) float64
- func ToInt(v any) int
- func ToInt64(v any) int64
- func ToInterface(v any) any
- func ToPascalCase(s string) string
- func ToSnakeCase(s string) string
- func ToString(v any) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateFieldIndexName ¶ added in v0.6.0
GenerateFieldIndexName generates an index name for a single field index
func GenerateIndexName ¶ added in v0.6.0
GenerateIndexName generates a consistent index name for database indexes If the index already has a name, it returns that name unchanged Otherwise, it generates a name based on the table name and fields
func IsCamelCase ¶
IsCamelCase checks if a string is in camelCase format
func IsPascalCase ¶
IsPascalCase checks if a string is in PascalCase format
func IsSimpleType ¶
IsSimpleType checks if a type is a simple type (not struct, slice, etc.)
func IsSnakeCase ¶
IsSnakeCase checks if a string is in snake_case format
func NormalizeIndexName ¶ added in v0.6.0
NormalizeIndexName normalizes index name for comparison Removes common prefixes and suffixes to allow flexible matching
func ScanRowContext ¶
func ScanRowContext(db interface {
QueryContext(context.Context, string, ...any) (*sql.Rows, error)
},
ctx context.Context, query string, args []any, dest any) error
ScanRowContext handles scanning from QueryRowContext for both simple and complex types
func ScanRowSimple ¶
ScanRowSimple scans a sql.Row into dest (for simple queries)
func ScanRowsToMaps ¶
ScanRowsToMaps scans SQL rows into a slice of maps This is useful for raw queries where the result structure is not known at compile time
func Singularize ¶
Singularize converts plural to singular (simple version)
func ToBool ¶
ToBool converts various types to bool Handles different database driver representations: - bool: direct conversion - int/int64: 0 = false, non-zero = true - string: "true"/"1" = true, "false"/"0" = false - nil: false
func ToFloat32 ¶
ToFloat32 converts various types to float32 Similar to ToFloat64 but returns float32
func ToFloat64 ¶
ToFloat64 converts various types to float64 Handles different database driver representations: - float32/float64: direct conversion - int/int32/int64: conversion - string: parsing - bool: true = 1.0, false = 0.0 - nil: 0.0
func ToInt64 ¶
ToInt64 converts various types to int64 Handles different database driver representations: - int/int32/int64: direct conversion - uint/uint32/uint64: conversion with bounds checking - float32/float64: truncation - string: parsing - bool: true = 1, false = 0 - nil: 0
func ToInterface ¶
ToInterface converts database-specific types to standard Go types Useful for normalizing results from different database drivers
Types ¶
This section is empty.