Documentation
¶
Index ¶
- Variables
- func AddOneTimeTemplate(t OneTimeTemplateI)
- func AddTableTemplate(t TableTemplateI)
- func AddTypeTableTemplate(t TypeTableTemplateI)
- func AsConstant(i interface{}, typ query.GoColumnType) string
- func Generate()
- func RegisterControlGenerator(c ControlGenerator)
- type Codegen
- type ColumnType
- type ConnectorParam
- type ControlCreationInfo
- type ControlDescription
- type ControlGenerator
- type ControlGeneratorRegistryKey
- type ControlType
- type ImportType
- type OneTimeTemplateI
- type TableTemplateI
- type TableType
- type Template
- type TypeTableTemplateI
- type TypeTableType
Constants ¶
This section is empty.
Variables ¶
var DefaultControlTypeFunc func(*db.ColumnDescription) ControlCreationInfo = DefaultControlType
DefaultControlTypeFunc is the injected function that determines the default control type for a particular type of database column. It gets initialized here, so that if you want to replace it, you can first call the default function
var DefaultWrapper = "page.Label"
DefaultWrapper defines what wrapper will be used for generated controls. It should correspond to the string the wrapper was registered with.
var GenerateControlIDs = true
GenerateControlIDs will determine if the code generator will assign ids to the controls based on table and column names
var OneTimeTemplates []OneTimeTemplateI
var TableTemplates []TableTemplateI
Will be populated by the individual templates found
var TypeTableTemplates []TypeTableTemplateI
Functions ¶
func AddOneTimeTemplate ¶
func AddOneTimeTemplate(t OneTimeTemplateI)
func AddTableTemplate ¶
func AddTableTemplate(t TableTemplateI)
func AddTypeTableTemplate ¶
func AddTypeTableTemplate(t TypeTableTemplateI)
func AsConstant ¶
func AsConstant(i interface{}, typ query.GoColumnType) string
Returns the value formatted as a constant. Essentially this just surrounds strings in quotes.
func RegisterControlGenerator ¶
func RegisterControlGenerator(c ControlGenerator)
Types ¶
type ColumnType ¶
type ColumnType struct {
*db.ColumnDescription
// Related control information
ControlDescription
}
ColumnType combines a database ColumnDescription with a ControlDescription
type ConnectorParam ¶
type ControlCreationInfo ¶
func DefaultControlType ¶
func DefaultControlType(col *db.ColumnDescription) ControlCreationInfo
type ControlDescription ¶
type ControlDescription struct {
Import *ImportType
ControlType string
NewControlFunc string
ControlName string
ControlID string // default id to generate
DefaultLabel string
Generator ControlGenerator
}
ControlDescription is matched with a ColumnDescription below and provides additional information regarding how information in a column can be used to generated a default control to edit that information.
type ControlGenerator ¶
type ControlGenerator interface {
Type() string
NewFunc() string
Imports() []string
SupportsColumn(col *ColumnType) bool
ConnectorParams() *maps.SliceMap
GenerateCreate(namespace string, col *ColumnType) string
GenerateGet(ctrlName string, objName string, col *ColumnType) string
GeneratePut(ctrlName string, objName string, col *ColumnType) string
}
func GetControlGenerator ¶
func GetControlGenerator(imp string, typ string) ControlGenerator
type ControlGeneratorRegistryKey ¶
type ControlGeneratorRegistryKey struct {
// contains filtered or unexported fields
}
type ControlType ¶
type ControlType int
const ( ControlTypeInteger ControlType = iota + 1 ControlTypeString )
type ImportType ¶
type ImportType struct {
Path string
Namespace string
Alias string // blank if not needing an alias
Primary bool
}
ImportType represents an import path required for a control. This is analyzed per-table.
type OneTimeTemplateI ¶
type TableTemplateI ¶
type TableType ¶
type TableType struct {
*db.TableDescription
Columns []ColumnType
Imports []*ImportType
}
func (*TableType) GetColumnByDbName ¶
func (t *TableType) GetColumnByDbName(name string) *ColumnType
type TypeTableTemplateI ¶
type TypeTableTemplateI interface {
GenerateTypeTable(codegen Codegen, dd *db.DatabaseDescription, t TypeTableType, buf *bytes.Buffer)
FileName(key string, t TypeTableType) string
Overwrite() bool
}
type TypeTableType ¶
type TypeTableType struct {
*db.TypeTableDescription
}