passes

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenInputStruct

func GenInputStruct(inputName string, params []GoParam) *codegen.GoStruct

GenInputStruct - generate input struct 1. introduce table name when name conflicts. 2. append numbers on fields when they still conflict. 3. add "List" suffix on lists params.

func GenMainStruct

func GenMainStruct(tb schema.SQLTable, name string) *codegen.GoStruct

GenMainStruct - generate main struct.

func GenOutputStruct

func GenOutputStruct(outputName string, output []GoVar) *codegen.GoStruct

GenOutputStruct generate output structs use main object when output is it. introduce table name if fields have name conflicts.

Types

type CodegenPass

type CodegenPass struct {
	Code string
}

CodegenPass - prepare for codegen.

func (*CodegenPass) GenMutationFuncs

func (c *CodegenPass) GenMutationFuncs(
	mainStruct *codegen.GoStruct, mainTable schema.SQLTable,
	mutationSockets []MutationSocket,
	queryFuncs []*codegen.QueryFunc) (rst []*codegen.MutationFunc)

GenMutationFuncs from mutation sockets.

func (*CodegenPass) GenMutationSockets

func (c *CodegenPass) GenMutationSockets(mutations []*driver.Mutation) ([]MutationSocket, error)

GenMutationSockets for mutations.

func (*CodegenPass) GenQueryFuncs

func (c *CodegenPass) GenQueryFuncs(mainStruct *codegen.GoStruct, mainTable schema.SQLTable,
	querySockets []QuerySocket) (queryFuncs []*codegen.QueryFunc)

GenQueryFuncs from query sockets.

func (*CodegenPass) GenQuerySockets

func (c *CodegenPass) GenQuerySockets(queries []*driver.Query) ([]QuerySocket, error)

GenQuerySockets for queries.

func (*CodegenPass) Run

func (c *CodegenPass) Run(repo *driver.Repo) error

Run -

type GoParam

type GoParam = visitors.GoParam

GoParam -

type GoVar

type GoVar = visitors.GoVar

GoVar -

type MutationSocket

type MutationSocket struct {
	Mutation *driver.Mutation
	Params   []GoParam
}

MutationSocket the gateway between go code and sql mutation.

type NormalizePass

type NormalizePass struct {
}

NormalizePass - replace colName with fully qualified names.

func (NormalizePass) Run

func (n NormalizePass) Run(repo *driver.Repo) error

Run -

type Pass

type Pass interface {
	Run(repo *driver.Repo) error
}

Pass - is a series of actions(visitors) applied on AST. Visitor Errors should be handled inside Pass. Caller of Run only need to check error == nil, then panic if false.

type QuerySocket

type QuerySocket struct {
	Query  *driver.Query
	Params []GoParam
	Output []GoVar
}

QuerySocket the gateway between go code and sql query.

Jump to

Keyboard shortcuts

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