Documentation ¶
Overview ¶
Package statements creates sql statements for the given schema Currently it provides basic crud operations. All the generated variables are returned in the compliance with std sql package.
Index ¶
- Variables
- func GenerateCreate(context *common.Context, settings schema.Generator, s *schema.Schema) ([]byte, error)
- func GenerateDelete(context *common.Context, settings schema.Generator, s *schema.Schema) ([]byte, error)
- func GenerateModelStatements(context *common.Context, settings schema.Generator, s *schema.Schema) ([]byte, error)
- func GeneratePackage(context *common.Context, settings schema.Generator, s *schema.Schema) ([]byte, error)
- func GenerateSelect(context *common.Context, settings schema.Generator, s *schema.Schema) ([]byte, error)
- func GenerateTableName(context *common.Context, settings schema.Generator, s *schema.Schema) ([]byte, error)
- func GenerateUpdate(context *common.Context, settings schema.Generator, s *schema.Schema) ([]byte, error)
- type Generator
Constants ¶
This section is empty.
Variables ¶
var CreateStatementTemplate = `` /* 1948-byte string literal not displayed */
CreateStatementTemplate holds the template for the create sql statement generator
var DeleteStatementTemplate = `` /* 2047-byte string literal not displayed */
DeleteStatementTemplate holds the template for the delete sql statement generator
var PackageTemplate = `// Generated struct for {{.Schema.Title}}.
package models
`
PackageTemplate holds the template for the packages of the models
var SelectStatementTemplate = `` /* 2057-byte string literal not displayed */
SelectStatementTemplate holds the template for the select sql statement generator
var TableNameTemplate = `` /* 268-byte string literal not displayed */
TableNameTemplate holds the template for the TableName function
var UpdateStatementTemplate = `` /* 1691-byte string literal not displayed */
UpdateStatementTemplate holds the template for the update sql statement generator
Functions ¶
func GenerateCreate ¶
func GenerateCreate(context *common.Context, settings schema.Generator, s *schema.Schema) ([]byte, error)
GenerateCreate generates the create sql statement for the given schema
func GenerateDelete ¶
func GenerateDelete(context *common.Context, settings schema.Generator, s *schema.Schema) ([]byte, error)
GenerateDelete generates the delete sql statement for the given schema
func GenerateModelStatements ¶
func GenerateModelStatements(context *common.Context, settings schema.Generator, s *schema.Schema) ([]byte, error)
GenerateModelStatements generates the CRUD statements for the model struct
func GeneratePackage ¶
func GeneratePackage(context *common.Context, settings schema.Generator, s *schema.Schema) ([]byte, error)
GeneratePackage generates the imports according to the schema. TODO remove this function
func GenerateSelect ¶
func GenerateSelect(context *common.Context, settings schema.Generator, s *schema.Schema) ([]byte, error)
GenerateSelect generates the select sql statement for the given schema