loaders

package
v0.0.0-...-a82cec0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2016 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBuf

func GetBuf(m map[string]*bytes.Buffer, name string) *bytes.Buffer

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

func PgLoadSchemaTypes(args *internal.ArgType, db *sql.DB, typeMap map[string]*bytes.Buffer) error

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

func PgParseQuery(args *internal.ArgType, db *sql.DB, typeMap map[string]*bytes.Buffer) error

PgParseQuery parses the query and generates a type for it.

func PgParseType

func PgParseType(args *internal.ArgType, dt string, nullable bool) (int, string, string)

PgParseType parse a postgres type into a Go type based on the column definition.

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.

type LoadFunc

type LoadFunc func(*internal.ArgType, *sql.DB, map[string]*bytes.Buffer) error

LoadFunc is the func signature for loading types from a database schema.

type Loader

type Loader struct {
	QueryFunc      LoadFunc
	LoadSchemaFunc LoadFunc
}

Loader is a handle

func (Loader) LoadSchemaTypes

func (l Loader) LoadSchemaTypes(args *internal.ArgType, db *sql.DB, typeMap map[string]*bytes.Buffer) error

LoadSchemaTypes satisfies Driver's LoadSchemaTypes.

func (Loader) ParseQuery

func (l Loader) ParseQuery(args *internal.ArgType, db *sql.DB, typeMap map[string]*bytes.Buffer) error

ParseQuery satisfies Driver's ParseQuery.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL