statements

package
v0.0.0-...-17fbf12 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2017 License: MIT Imports: 10 Imported by: 1

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

Constants

This section is empty.

Variables

View Source
var CreateStatementTemplate = `` /* 1948-byte string literal not displayed */

CreateStatementTemplate holds the template for the create sql statement generator

View Source
var DeleteStatementTemplate = `` /* 2047-byte string literal not displayed */

DeleteStatementTemplate holds the template for the delete sql statement generator

View Source
var PackageTemplate = `// Generated struct for {{.Schema.Title}}.
package models
`

PackageTemplate holds the template for the packages of the models

View Source
var SelectStatementTemplate = `` /* 2057-byte string literal not displayed */

SelectStatementTemplate holds the template for the select sql statement generator

View Source
var TableNameTemplate = `` /* 268-byte string literal not displayed */

TableNameTemplate holds the template for the TableName function

View Source
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

func GenerateTableName

func GenerateTableName(context *common.Context, settings schema.Generator, s *schema.Schema) ([]byte, error)

GenerateTableName generates a simple table name getter function

func GenerateUpdate

func GenerateUpdate(context *common.Context, settings schema.Generator, s *schema.Schema) ([]byte, error)

GenerateUpdate generates the update sql statement for the given schema

Types

type Generator

type Generator struct{}

Generator generates the basic CRUD statements.

func (*Generator) Generate

func (g *Generator) Generate(context *common.Context, s *schema.Schema) ([]common.Output, error)

Generate generates the basic CRUD statements for the models

Jump to

Keyboard shortcuts

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