Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Camel ¶ added in v0.0.10
camel is a modified Title function from package strings, converting to CamelCase. see isSeperator for conversion rules.
Types ¶
type Column ¶
Column represents a database table for purposes of code generation.
func NewColumn ¶
NewColumn creates a new Column from a schema.Column.
func (Column) ValueSuffix ¶ added in v0.0.8
ValueSuffix returns the string which has to be appended to the name to access it's value, eg. ".Bool" for sql.NullBool
type Foreign ¶ added in v0.0.2
type Foreign struct { schema.Foreign Child Table ChildColumns []Column Parent Table ParentColumns []Column References []Reference // contains filtered or unexported fields }
Foreign represents a foreign constraint for purposes of code generation.
type Output ¶ added in v0.0.2
type Output struct { PackageTmpl *template.Template TableTmpl *template.Template ScanFromTmpl *template.Template CloneTmpl *template.Template SelectTmpl *template.Template InsertTmpl *template.Template FindTmpl *template.Template UpdateTmpl *template.Template DeleteTmpl *template.Template ProcedureTmpl *template.Template ViewTmpl *template.Template ForeignTmpl *template.Template // contains filtered or unexported fields }
Output generates Go code from gathered DB information.
Output-values should be created using NewOutput. The members holding the templates can be modified afterwards, to permit usage of custom templates.
func NewOutput ¶ added in v0.0.2
NewOutput creates a new initialized Output.
pkg is inserted as package name into the generated code. an example of how to generate an appropriate tables slice can be found in the command rom.
func (Output) Execute ¶ added in v0.0.2
func (o Output) Execute(w io.Writer, tables bool, methods bool, primary bool, foreign bool, procedures bool, views bool) error
Execute generates Go-code for database access.
w specifies where code is written to, the boolean arguments select if code is generated for table types, methods to access the database, methods to access the database by primary key and methods to access the database by foreign key (currently unimplemented).
type Parameter ¶ added in v0.0.4
Parameter represents a parameter to a stored procedure.
type Procedure ¶ added in v0.0.4
type Procedure struct { schema.Procedure Parameters []Parameter // contains filtered or unexported fields }
Procedure represents data about a stored procedure.
func NewProcedure ¶ added in v0.0.4
func (Procedure) In ¶ added in v0.0.4
In returns all parameters of a stored procedure declared as IN.
func (Procedure) Out ¶ added in v0.0.4
Out returns all parameters of a stored procedure declared as OUT.
type Reference ¶ added in v0.0.8
Reference represents a column mapping of a foreign constraint for purposes of code generation.
type Table ¶
type Table struct { schema.Table Columns []Column Primary []Column Foreign []Foreign Imports []string // contains filtered or unexported fields }
Table represents a database table for purposes of code generation. It is acting as collection of all data about a table and it's columns.