Documentation
¶
Index ¶
- Variables
- func AddOneTimeTemplate(t OneTimeTemplateI)
- func AddTableTemplate(t TableTemplateI)
- func AddTypeTableTemplate(t TypeTableTemplateI)
- func AsConstant(i interface{}, typ query.GoColumnType) string
- func ExportCreator(creator interface{}) string
- func Generate()
- func RegisterControlGenerator(c ControlGenerator)
- func WrapFormField(label string, forId string, child string) string
- type CodeGenerator
- type ConnectorParam
- type ControlCreationInfo
- type ControlDescription
- type ControlGenerator
- type ControlGeneratorRegistryKey
- type ControlType
- type ImportPath
- type ImportType
- type OneTimeTemplateI
- type ProviderGenerator
- type TableTemplateI
- type TableType
- type Template
- type TypeTableTemplateI
- type TypeTableType
Constants ¶
This section is empty.
Variables ¶
var BuildingExamples bool
This is specific to automating the build of the examples database code. You do not normally need to set this.
var DefaultControlTypeFunc = 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 DefaultFormFieldCreator = "goraddctrl.FormFieldWrapperCreator"
DefaultWrapper defines what wrapper will be used for generated controls. It should correspond to the string the wrapper was registered with.
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 ExportCreator ¶ added in v0.2.0
func ExportCreator(creator interface{}) string
Exports the given creator so that it can be embedded in a go file. Empty items are not exported Not all creators can be exported. This function is mainly a helper for code generation of controls. Specifically, events and actions do not export cleanly currently. But that should not be a problem for code generation.
func RegisterControlGenerator ¶
func RegisterControlGenerator(c ControlGenerator)
Types ¶
type CodeGenerator ¶ added in v0.2.1
type ConnectorParam ¶
type ControlCreationInfo ¶
TODO: Remove this. We just need a module path to the control I think. Also, explore making a default generator so that you don't need one for all controls, just ones that are different than normal.
func DefaultControlType ¶
func DefaultControlType(ref interface{}) ControlCreationInfo
type ControlDescription ¶
type ControlDescription struct {
Import *ImportType
ControlType string
ControlName string
ControlID string // default id to generate
DefaultLabel string
Generator ControlGenerator
Connector string
}
ControlDescription is matched with a Column below and provides additional information regarding how information in a column can be used to generate a default control to edit that information.
func (*ControlDescription) ControlIDConst ¶ added in v0.2.4
func (cd *ControlDescription) ControlIDConst() string
type ControlGenerator ¶
type ControlGenerator interface {
Type() string
Imports() []ImportPath
SupportsColumn(ref interface{}) bool
GenerateCreator(ref interface{}, desc *ControlDescription) string
GenerateRefresh(ref interface{}, desc *ControlDescription) string
GenerateUpdate(ref interface{}, desc *ControlDescription) 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
type ImportPath ¶ added in v0.2.3
type ImportType ¶
ImportType represents an import path required for a control. This is analyzed per-table.
type OneTimeTemplateI ¶
type ProviderGenerator ¶ added in v0.2.0
type ProviderGenerator interface {
GenerateProvider(ref interface{}, desc *ControlDescription) string
}
type TableTemplateI ¶
type TableType ¶
type TableType struct {
*db.Table
Imports []*ImportType
// contains filtered or unexported fields
}
func (*TableType) ControlDescription ¶ added in v0.7.0
func (t *TableType) ControlDescription(ref interface{}) *ControlDescription
type TypeTableTemplateI ¶
type TypeTableTemplateI interface {
GenerateTypeTable(codegen CodeGenerator, dd *db.Database, t TypeTableType, buf *bytes.Buffer)
FileName(key string, t TypeTableType) string
Overwrite() bool
}