Versions in this module Expand all Collapse all v0 v0.0.1 Apr 7, 2024 Changes in this version + var AutoGenKeyCfg = &AutoKeyMap + func CreateInsertParams(st *Struct) string + func CreateInsertSQL(st *Struct) string + func CreateInsertScan(st *Struct) string + func CreateSelectByPkFuncParams(st *Struct) string + func CreateSelectByPkSQL(st *Struct) string + func CreateSelectByPkSQLParams(st *Struct) string + func CreateSelectByPkScan(st *Struct) string + func OpenDB(connStr string) (*sql.DB, error) + func PgConvertType(col *PgColumn, typeCfg *PgTypeMapConfig) string + func PgExecuteCustomTemplate(st *StructTemplate, customTmpl string) ([]byte, error) + type AutoKeyMap struct + Types []string + type PgColumn struct + DDLType string + DataType string + DefaultValue sql.NullString + FieldOrdinal int + IsPrimaryKey bool + Name string + NotNull bool + func PgLoadColumnDef(db Queryer, schema string, table string) ([]*PgColumn, error) + type PgTable struct + AutoGenPk bool + Columns []*PgColumn + DataType string + Name string + PrimaryKeys []*PgColumn + Schema string + func PgLoadTableDef(db Queryer, schema string) ([]*PgTable, error) + type PgTypeMapConfig map[string]TypeMap + var DefaultTypeMapCfg PgTypeMapConfig = PgTypeMapConfig{ ... } + func PgLoadTypeMapFromFile(filePath string) (*PgTypeMapConfig, error) + type Queryer interface + Exec func(string, ...interface{}) (sql.Result, error) + ExecContext func(context.Context, string, ...interface{}) (sql.Result, error) + Query func(string, ...interface{}) (*sql.Rows, error) + QueryContext func(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRow func(string, ...interface{}) *sql.Row + QueryRowContext func(context.Context, string, ...interface{}) *sql.Row + type Struct struct + Comment string + Fields []*StructField + Name string + Table *PgTable + func PgTableToStruct(t *PgTable, typeCfg *PgTypeMapConfig, keyConfig *AutoKeyMap) (*Struct, error) + type StructField struct + Column *PgColumn + Name string + Tag string + Type string + func PgColToField(col *PgColumn, typeCfg *PgTypeMapConfig) (*StructField, error) + type StructTemplate struct + Struct *Struct + type TypeMap struct + DBTypes []string + NotNullGoType string + NullableGoType string