Documentation ¶
Index ¶
- Constants
- func AddMethod(iface *ast.InterfaceType, method *ast.Field)
- func GetFuncDecls(file *ast.File) []*ast.FuncDecl
- func GetInterface(file *ast.File, name string) *ast.InterfaceType
- func GetInterfaceMethods(iface *ast.InterfaceType) []*ast.Field
- func HasMethod(iface *ast.InterfaceType, methodName string) bool
- type TypeField
- type TypeHolder
- func (holder *TypeHolder) FieldsAsDMLParams() string
- func (holder *TypeHolder) FieldsEnum() string
- func (holder *TypeHolder) FieldsEnumRef() string
- func (holder *TypeHolder) FieldsInDDL() string
- func (holder *TypeHolder) FieldsInDML() string
- func (holder *TypeHolder) FindFieldName() string
- func (holder *TypeHolder) IDFieldAsDMLParam() string
- func (holder *TypeHolder) IDFieldInDDL() string
- func (holder *TypeHolder) IDFieldName() string
- func (holder *TypeHolder) IDFieldPattern() string
- func (holder *TypeHolder) IDFieldType() string
- func (holder *TypeHolder) IDFieldTypeFormat() string
- func (holder *TypeHolder) IDFieldTypeParse() string
- func (holder *TypeHolder) Identifier() string
- func (holder *TypeHolder) ReplaceInTemplate(templateContent string) string
- func (holder *TypeHolder) ValuesInDMLParams() string
Constants ¶
const ( Datastore = iota + 1 Handler Router )
Categories for output generated files
Variables ¶
This section is empty.
Functions ¶
func AddMethod ¶
func AddMethod(iface *ast.InterfaceType, method *ast.Field)
AddMethod modyfies iface by adding method
func GetFuncDecls ¶
GetFuncDecls returns the list of func declarations
func GetInterface ¶
func GetInterface(file *ast.File, name string) *ast.InterfaceType
GetInterface returns certain interface identified by name
func GetInterfaceMethods ¶
func GetInterfaceMethods(iface *ast.InterfaceType) []*ast.Field
GetInterfaceMethods returns the list of methods in a declared interface
Types ¶
type TypeHolder ¶
TypeHolder holds a type previously read from file
func ComposeTypeHolders ¶
func ComposeTypeHolders(source *io.GoFile) ([]*TypeHolder, error)
ComposeTypeHolders composes the type holders for the types in source file
func (*TypeHolder) FieldsAsDMLParams ¶
func (holder *TypeHolder) FieldsAsDMLParams() string
FieldsAsDMLParams returns something like "field1=$1, field2=$2, field3=$3"
func (*TypeHolder) FieldsEnum ¶
func (holder *TypeHolder) FieldsEnum() string
FieldsEnum returns enum of the fields including type indentifier and field name: "theType.Field1, theType.Field2, theType.FieldN"
func (*TypeHolder) FieldsEnumRef ¶
func (holder *TypeHolder) FieldsEnumRef() string
FieldsEnumRef returns enum of type fields, including type identifiera and field name reference: "&theType.Field1, &theType.Field2, &theType.FieldN"
func (*TypeHolder) FieldsInDDL ¶
func (holder *TypeHolder) FieldsInDDL() string
FieldsInDDL returns the type fields as they are used for SQL DDL operations, like: "Field1 varchar(200), Field2 int, FieldN varchar(200)"
func (*TypeHolder) FieldsInDML ¶
func (holder *TypeHolder) FieldsInDML() string
FieldsInDML returns "field1, field2, field3"
func (*TypeHolder) FindFieldName ¶
func (holder *TypeHolder) FindFieldName() string
FindFieldName return the name of the field used for searches
func (*TypeHolder) IDFieldAsDMLParam ¶
func (holder *TypeHolder) IDFieldAsDMLParam() string
IDFieldAsDMLParam returns something like "id=$4"
func (*TypeHolder) IDFieldInDDL ¶
func (holder *TypeHolder) IDFieldInDDL() string
IDFieldInDDL returns the IDField as seen in SQL DDL operations
func (*TypeHolder) IDFieldName ¶
func (holder *TypeHolder) IDFieldName() string
IDFieldName returns the name of the first field, taken as ID
func (*TypeHolder) IDFieldPattern ¶
func (holder *TypeHolder) IDFieldPattern() string
IDFieldPattern returns the pattern associated with id field type, to be used when routing REST paths
func (*TypeHolder) IDFieldType ¶
func (holder *TypeHolder) IDFieldType() string
IDFieldType returns the type of the first field, taken as ID
func (*TypeHolder) IDFieldTypeFormat ¶
func (holder *TypeHolder) IDFieldTypeFormat() string
IDFieldTypeFormat returns the type formatting instruction to have ID as string
func (*TypeHolder) IDFieldTypeParse ¶
func (holder *TypeHolder) IDFieldTypeParse() string
IDFieldTypeParse returns the type parsing instruction for ID field
func (*TypeHolder) Identifier ¶
func (holder *TypeHolder) Identifier() string
Identifier returns type name in camel case, except first letter, which is lower case: "theType"
func (*TypeHolder) ReplaceInTemplate ¶
func (holder *TypeHolder) ReplaceInTemplate(templateContent string) string
ReplaceInTemplate replaces template marks with holder data
func (*TypeHolder) ValuesInDMLParams ¶
func (holder *TypeHolder) ValuesInDMLParams() string
ValuesInDMLParams returns something like "$1, $2, $3"