Documentation
¶
Index ¶
- func GetBuf(m map[string]*bytes.Buffer, name string) *bytes.Buffer
- func PgLoadEnums(args *internal.ArgType, db *sql.DB, typeMap map[string]*bytes.Buffer) (map[string]*templates.EnumTemplate, error)
- func PgLoadForeignKeys(args *internal.ArgType, db *sql.DB, typeMap map[string]*bytes.Buffer, ...) (map[string]*templates.FkTemplate, error)
- func PgLoadIdx(args *internal.ArgType, db *sql.DB, typeMap map[string]*bytes.Buffer, ...) (map[string]*templates.IdxTemplate, error)
- func PgLoadProcs(args *internal.ArgType, db *sql.DB, typeMap map[string]*bytes.Buffer) (map[string]*templates.ProcTemplate, error)
- func PgLoadSchemaTypes(args *internal.ArgType, db *sql.DB, typeMap map[string]*bytes.Buffer) error
- func PgLoadTables(args *internal.ArgType, db *sql.DB, typeMap map[string]*bytes.Buffer) (map[string]*templates.TableTemplate, error)
- func PgParseQuery(args *internal.ArgType, db *sql.DB, typeMap map[string]*bytes.Buffer) error
- func PgParseType(args *internal.ArgType, dt string, nullable bool) (int, string, string)
- type Driver
- type LoadFunc
- type Loader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBuf ¶
GetBuf is a utility func to retrieve a previously defined byte.Buffer with name from m, creating a new byte.Buffer if necessary.
func PgLoadEnums ¶
func PgLoadEnums(args *internal.ArgType, db *sql.DB, typeMap map[string]*bytes.Buffer) (map[string]*templates.EnumTemplate, error)
PgLoadEnums reads the enums from the database, writing the values to the typeMap and returning the created EnumTemplates.
func PgLoadForeignKeys ¶
func PgLoadForeignKeys(args *internal.ArgType, db *sql.DB, typeMap map[string]*bytes.Buffer, tableMap map[string]*templates.TableTemplate) (map[string]*templates.FkTemplate, error)
PgLoadForeignKeys loads foreign key relationships from the database.
func PgLoadIdx ¶
func PgLoadIdx(args *internal.ArgType, db *sql.DB, typeMap map[string]*bytes.Buffer, tableMap map[string]*templates.TableTemplate) (map[string]*templates.IdxTemplate, error)
PgLoadIdx loads indexes from the database.
func PgLoadProcs ¶
func PgLoadProcs(args *internal.ArgType, db *sql.DB, typeMap map[string]*bytes.Buffer) (map[string]*templates.ProcTemplate, error)
PgLoadProcs reads the procs from the database, writing the values to the typeMap and returning the created ProcTemplates.
func PgLoadSchemaTypes ¶
PgLoadSchemaTypes loads the postgres type definitions from a database.
func PgLoadTables ¶
func PgLoadTables(args *internal.ArgType, db *sql.DB, typeMap map[string]*bytes.Buffer) (map[string]*templates.TableTemplate, error)
PgLoadTables loads the table definitions from the database, writing the resulting templates to typeMap and returning the created templates.TableTemplates.
func PgParseQuery ¶
PgParseQuery parses the query and generates a type for it.
Types ¶
type Driver ¶
type Driver interface { ParseQuery(*internal.ArgType, *sql.DB, map[string]*bytes.Buffer) error LoadSchemaTypes(*internal.ArgType, *sql.DB, map[string]*bytes.Buffer) error }
Driver is the common interface for database drivers that can generate code from a database schema.