Documentation ¶
Index ¶
- Variables
- func AsEnum(t types.Type) (*types.Enum, error)
- func AsEnumInstance(t types.Type, enums enum.Enums) (*enum.Enum, error)
- func AsRef(t types.Type) (*types.Reference, error)
- func Help(t types.Type, f string, nullable bool, enums enum.Enums) (string, error)
- func ToGoRowType(t types.Type, nullable bool, pkg string, enums enum.Enums, database string) (string, error)
- func ToGoString(t types.Type, nullable bool, prop string, alwaysString bool) string
- func ToGoType(t types.Type, nullable bool, pkg string, enums enum.Enums) (string, error)
- func ToGoViewString(t *types.Wrapped, prop string, nullable bool, format string, display string, ...) string
- func ToSQLType(t types.Type, database string) (string, error)
- type Args
- type Column
- func (c *Column) AddTag(t string)
- func (c *Column) BC() string
- func (c *Column) Camel() string
- func (c *Column) CamelNoReplace() string
- func (c *Column) CamelPlural() string
- func (c *Column) Clone() *Column
- func (c *Column) Derived() bool
- func (c *Column) HasTag(t string) bool
- func (c *Column) Help(enums enum.Enums) (string, error)
- func (c *Column) IconDerived() string
- func (c *Column) NameQuoted() string
- func (c *Column) NeedsErr(_ string, db string) bool
- func (c *Column) Plural() string
- func (c *Column) Proper() string
- func (c *Column) ProperDerived() string
- func (c *Column) ProperPlural() string
- func (c *Column) RemoveTag(t string)
- func (c *Column) SQL() string
- func (c *Column) SetAcronyms(acronyms ...string)
- func (c *Column) ShouldDisplay(k string) bool
- func (c *Column) String() string
- func (c *Column) Title() string
- func (c *Column) TitleLower() string
- func (c *Column) ToGoEditString(prefix string, format string, id string, enums enum.Enums) (string, error)
- func (c *Column) ToGoMapParse() (string, error)
- func (c *Column) ToGoRowType(pkg string, enums enum.Enums, database string) (string, error)
- func (c *Column) ToGoString(prefix string) string
- func (c *Column) ToGoType(pkg string, enums enum.Enums) (string, error)
- func (c *Column) ToGoViewString(prefix string, verbose bool, url bool, enums enum.Enums, src string) string
- func (c *Column) ToSQLType(database string) (string, error)
- func (c *Column) ZeroVal() string
- type Columns
- func (c Columns) Args(pkg string, enums enum.Enums) (string, error)
- func (c Columns) CamelNames() []string
- func (c Columns) ForDisplay(k string) Columns
- func (c Columns) Get(name string) *Column
- func (c Columns) GoRowTypes(pkg string, enums enum.Enums, database string) ([]string, error)
- func (c Columns) GoTypeKeys(pkg string, enums enum.Enums) ([]string, error)
- func (c Columns) GoTypes(pkg string, enums enum.Enums) ([]string, error)
- func (c Columns) HasFormat(f string) bool
- func (c Columns) MaxCamelLength() int
- func (c Columns) MaxGoRowTypeLength(pkg string, enums enum.Enums, database string) int
- func (c Columns) MaxGoTypeLength(pkg string, enums enum.Enums) int
- func (c Columns) Names() []string
- func (c Columns) NamesQuoted() []string
- func (c Columns) NonPKs() Columns
- func (c Columns) NotDerived() Columns
- func (c Columns) OneWithTag(t string) (*Column, error)
- func (c Columns) PKs() Columns
- func (c Columns) ProperNames() []string
- func (c Columns) Refs() string
- func (c Columns) SQL() []string
- func (c Columns) SQLQuoted() []string
- func (c Columns) Searches() Columns
- func (c Columns) Smushed() string
- func (c Columns) Titles() []string
- func (c Columns) TitlesLower() []string
- func (c Columns) ToGoStrings(prefix string, alwaysString bool, maxLength int) string
- func (c Columns) ToRefs(prefix string, relCols ...*Column) string
- func (c Columns) Types() types.Types
- func (c Columns) WhereClause(offset int, placeholder string) string
- func (c Columns) WithDisplay(f string) Columns
- func (c Columns) WithFormat(f string) Columns
- func (c Columns) WithTag(t string) Columns
- func (c Columns) WithoutDisplays(f ...string) Columns
- func (c Columns) WithoutFormats(f ...string) Columns
- func (c Columns) WithoutTags(t ...string) Columns
- func (c Columns) ZeroVals() []string
- type Format
- type Formats
- type Group
- type Groups
- type Import
- type ImportType
- type Imports
- type Index
- type Indexes
- type Link
- type Links
- type Model
- func (m *Model) AddTag(t string)
- func (m *Model) AllSearches(db string) []string
- func (m *Model) Breadcrumbs() string
- func (m *Model) CSRoute() string
- func (m *Model) Camel() string
- func (m *Model) CamelLower() string
- func (m *Model) CamelPlural() string
- func (m *Model) CanTraverseRelation() bool
- func (m *Model) ClassRef() string
- func (m *Model) Cleanup()
- func (m *Model) FirstLetter() string
- func (m *Model) GroupString(prefix string, dflt string) string
- func (m *Model) HasSearches() bool
- func (m *Model) HasTag(t string) bool
- func (m *Model) IconSafe() string
- func (m *Model) IndexedColumns(includePK bool) Columns
- func (m *Model) IsSoftDelete() bool
- func (m *Model) LastGroup(prefix string, dflt string) string
- func (m *Model) PKs() Columns
- func (m *Model) PackageWithGroup(prefix string) string
- func (m *Model) Plural() string
- func (m *Model) PluralLower() string
- func (m *Model) Pointer() string
- func (m *Model) Proper() string
- func (m *Model) ProperPlural() string
- func (m *Model) ProperWithGroup() string
- func (m *Model) RelationsFor(col *Column) Relations
- func (m *Model) RemoveTag(t string)
- func (m *Model) Route() string
- func (m *Model) SetAcronyms(acronyms ...string)
- func (m *Model) SoftDeleteSuffix() string
- func (m *Model) Table() string
- func (m *Model) TableNS() string
- func (m *Model) Title() string
- func (m *Model) TitleLower() string
- func (m *Model) TitlePlural() string
- func (m *Model) TitlePluralLower() string
- func (m *Model) Validate(mods []string, models Models, groups Groups) error
- type Models
- func (m Models) ForGroup(pth ...string) Models
- func (m Models) Get(n string) *Model
- func (m Models) HasSearch() bool
- func (m Models) HasSeedData() bool
- func (m Models) ReverseRelations(t string) Relations
- func (m Models) Sorted() Models
- func (m Models) SortedDisplay() Models
- func (m Models) SortedRoutes() Models
- func (m Models) Validate(mods []string, groups Groups) error
- func (m Models) WithTag(tag string) Models
- func (m Models) WithoutTag(tag string) Models
- type Relation
- func (r *Relation) ContainsSource(colName string) bool
- func (r *Relation) Reverse(name string) *Relation
- func (r *Relation) SrcColumns(m *Model) Columns
- func (r *Relation) SrcQuoted() string
- func (r *Relation) TgtColumns(m *Model) Columns
- func (r *Relation) TgtQuoted() string
- func (r *Relation) Uniq() string
- type Relations
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ExampleColumns = Columns{ {Name: "id", Type: types.NewUUID(), PK: true, Search: true, HelpString: "The primary key"}, {Name: "name", Type: types.NewString(), Search: true, HelpString: "The name of the thing"}, {Name: "created", Type: types.NewTimestamp(), SQLDefault: "now()", Tags: []string{"created"}, HelpString: "Created timestamp"}, {Name: "deleted_at", Type: types.NewTimestamp(), Nullable: true, Tags: []string{"deleted"}, HelpString: "Optional timestamp"}, } ExampleRelations = Relations{ {Name: "relation_a", Src: []string{"parent_id"}, Table: "parent", Tgt: []string{"id"}}, } ExampleIndexes = Indexes{ {Name: "example_idx", Decl: `"table_name" ("id", "created")`}, } Examples = map[string]any{ "columns": ExampleColumns, "relations": ExampleRelations, "indexes": ExampleIndexes, } )
View Source
var ( FmtCode = Format{Key: "code", Title: "Code", Description: ""} FmtCodeHidden = Format{Key: "codehidden", Title: "Code (hidden)", Description: ""} FmtColor = Format{Key: "color", Title: "Color", Description: ""} FmtCountry = Format{Key: "country", Title: "Country", Description: ""} FmtHTML = Format{Key: "html", Title: "HTML", Description: ""} FmtIcon = Format{Key: "icon", Title: "Icon", Description: ""} FmtImage = Format{Key: "image", Title: "Image", Description: ""} FmtJSON = Format{Key: "json", Title: "JSON", Description: ""} FmtLinebreaks = Format{Key: "linebreaks", Title: "Linebreaks", Description: ""} FmtSelect = Format{Key: "select", Title: "Select Box", Description: ""} FmtSeconds = Format{Key: "seconds", Title: "Seconds", Description: ""} FmtSI = Format{Key: "si", Title: "SI Units", Description: ""} FmtSQL = Format{Key: "sql", Title: "SQL", Description: ""} FmtTags = Format{Key: "tags", Title: "Tags", Description: ""} FmtURL = Format{Key: "url", Title: "URL", Description: ""} AllFormats = Formats{FmtCode, FmtCodeHidden, FmtColor, FmtCountry, FmtHTML, FmtIcon, FmtImage, FmtJSON, FmtSelect, FmtSeconds, FmtSI, FmtSQL, FmtURL} )
View Source
var ColumnFieldDescs = util.FieldDescs{
{Key: "name", Title: "Name", Description: "The name of the column"},
{Key: "type", Title: "Type", Description: "The type of the column", Type: "type"},
{Key: "pk", Title: "PK", Description: "Indicates if this column is a primary key", Type: "bool"},
{Key: "nullable", Title: "Nullable", Description: "Indicates if this column is nullable", Type: "bool"},
{Key: "search", Title: "Search", Description: "Indicates if this column is included in search", Type: "bool"},
{Key: "indexed", Title: "Indexed", Description: "Indicates if this column is indexed", Type: "bool"},
{Key: "display", Title: "Display", Description: "The display setting of the column's value"},
{Key: "format", Title: "Format", Description: "The formatting applied to the column's value"},
{Key: "example", Title: "Example", Description: "Example annotation for the column's value"},
{Key: "json", Title: "JSON", Description: "JSON field name to use instead of [name]"},
{Key: "validation", Title: "Validation", Description: "Validation annotation for the column's value"},
}
View Source
var IndexFieldDescs = util.FieldDescs{
{Key: "name", Title: "Name", Description: "The name of the index"},
{Key: "decl", Title: "Declaration", Description: "The declaration of the index"},
}
View Source
var LinkFieldDescs = util.FieldDescs{
{Key: "title", Title: "Title", Description: "The title of the link"},
{Key: "url", Title: "URL", Description: "The href of this link"},
{Key: "icon", Title: "Icon", Description: "The icon of this link"},
{Key: "dangerous", Title: "Dangerous", Description: "If set, this link will require confirmation", Type: "bool"},
{Key: "tags", Title: "Tags", Description: "The tags that apply to this link", Type: "[]string"},
}
View Source
var RelationFieldDescs = util.FieldDescs{
{Key: "name", Title: "Name", Description: "The name of the relation"},
{Key: "src", Title: "Source", Description: "The source columns of the relation"},
{Key: "table", Title: "Table", Description: "The target table of the relation"},
{Key: "tgt", Title: "Target", Description: "The target columns of the relation"},
}
Functions ¶
func ToGoRowType ¶
func ToGoString ¶
func ToGoViewString ¶
Types ¶
type Args ¶
type Args struct { Config util.ValueMap `json:"config,omitempty"` ConfigFile json.RawMessage `json:"-"` Enums enum.Enums `json:"enums,omitempty"` EnumFiles map[string]json.RawMessage `json:"-"` Models Models `json:"models,omitempty"` ModelFiles map[string]json.RawMessage `json:"-"` Groups Groups `json:"groups,omitempty"` Acronyms []string `json:"acronyms,omitempty"` GroupsFile json.RawMessage `json:"-"` Modules []string `json:"-"` Database string `json:"-"` }
func (*Args) ApplyAcronyms ¶ added in v1.4.3
func (*Args) DatabaseNow ¶
type Column ¶
type Column struct { Name string `json:"name"` Type *types.Wrapped `json:"type"` PK bool `json:"pk,omitempty"` Nullable bool `json:"nullable,omitempty"` Search bool `json:"search,omitempty"` SQLDefault string `json:"sqlDefault,omitempty"` Indexed bool `json:"indexed,omitempty"` Display string `json:"display,omitempty"` Format string `json:"format,omitempty"` JSON string `json:"json,omitempty"` SQLOverride string `json:"sql,omitempty"` TitleOverride string `json:"title,omitempty"` PluralOverride string `json:"plural,omitempty"` ProperOverride string `json:"proper,omitempty"` Example string `json:"example,omitempty"` Validation string `json:"validation,omitempty"` Values []string `json:"values,omitempty"` Tags []string `json:"tags,omitempty"` HelpString string `json:"helpString,omitempty"` // contains filtered or unexported fields }
func (*Column) CamelNoReplace ¶ added in v1.4.5
func (*Column) CamelPlural ¶
func (*Column) IconDerived ¶ added in v1.5.17
func (*Column) NameQuoted ¶
func (*Column) ProperDerived ¶ added in v1.4.3
func (*Column) ProperPlural ¶
func (*Column) SetAcronyms ¶ added in v1.4.3
func (*Column) ShouldDisplay ¶
func (*Column) TitleLower ¶
func (*Column) ToGoEditString ¶
func (*Column) ToGoMapParse ¶
func (*Column) ToGoRowType ¶
func (*Column) ToGoString ¶
func (*Column) ToGoViewString ¶
type Columns ¶
type Columns []*Column
func (Columns) CamelNames ¶
func (Columns) ForDisplay ¶
func (Columns) GoRowTypes ¶
func (Columns) GoTypeKeys ¶
func (Columns) MaxCamelLength ¶
func (Columns) MaxGoRowTypeLength ¶
func (Columns) NamesQuoted ¶
func (Columns) NotDerived ¶ added in v1.4.3
func (Columns) ProperNames ¶
func (Columns) TitlesLower ¶
func (Columns) ToGoStrings ¶
func (Columns) WithDisplay ¶
func (Columns) WithFormat ¶
func (Columns) WithoutDisplays ¶
func (Columns) WithoutFormats ¶
func (Columns) WithoutTags ¶
type Group ¶
type Group struct { Key string `json:"key"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Route string `json:"route,omitempty"` Icon string `json:"icon,omitempty"` Tags []string `json:"tags,omitempty"` Children Groups `json:"children,omitempty"` Provided bool `json:"provided,omitempty"` }
type Import ¶ added in v1.4.5
type Import struct { Type ImportType `json:"type"` Value string `json:"value"` Alias string `json:"alias,omitempty"` Supported []string `json:"supported,omitempty"` }
func NewImport ¶ added in v1.4.5
func NewImport(t ImportType, v string) *Import
type ImportType ¶ added in v1.4.5
type ImportType string
const ( ImportTypeInternal ImportType = "internal" ImportTypeExternal ImportType = "external" ImportTypeApp ImportType = "app" )
type Imports ¶ added in v1.4.5
type Imports []*Import
func (Imports) RenderHTML ¶ added in v1.4.5
func (Imports) Supporting ¶ added in v1.4.5
type Index ¶
type Model ¶
type Model struct { Name string `json:"name"` Package string `json:"package"` Group []string `json:"group,omitempty"` Schema string `json:"schema,omitempty"` Description string `json:"description,omitempty"` Icon string `json:"icon,omitempty"` Ordering filter.Orderings `json:"ordering,omitempty"` SortIndex int `json:"sortIndex,omitempty"` View string `json:"view,omitempty"` Search []string `json:"search,omitempty"` Tags []string `json:"tags,omitempty"` TitleOverride string `json:"title,omitempty"` PluralOverride string `json:"plural,omitempty"` ProperOverride string `json:"proper,omitempty"` TableOverride string `json:"table,omitempty"` RouteOverride string `json:"route,omitempty"` Config util.ValueMap `json:"config,omitempty"` Columns Columns `json:"columns"` Relations Relations `json:"relations,omitempty"` Indexes Indexes `json:"indexes,omitempty"` SeedData [][]any `json:"seedData,omitempty"` Links Links `json:"links,omitempty"` Imports Imports `json:"imports,omitempty"` // contains filtered or unexported fields }
func (*Model) AllSearches ¶
func (*Model) Breadcrumbs ¶
func (*Model) CamelLower ¶
func (*Model) CamelPlural ¶
func (*Model) CanTraverseRelation ¶
func (*Model) FirstLetter ¶
func (*Model) HasSearches ¶
func (*Model) IndexedColumns ¶
func (*Model) IsSoftDelete ¶
func (*Model) PackageWithGroup ¶
func (*Model) PluralLower ¶
func (*Model) ProperPlural ¶
func (*Model) ProperWithGroup ¶
func (*Model) RelationsFor ¶
func (*Model) SetAcronyms ¶ added in v1.4.3
func (*Model) SoftDeleteSuffix ¶
func (*Model) TitleLower ¶
func (*Model) TitlePlural ¶
func (*Model) TitlePluralLower ¶
type Models ¶
type Models []*Model
func (Models) HasSeedData ¶
func (Models) ReverseRelations ¶
func (Models) SortedDisplay ¶
func (Models) SortedRoutes ¶
func (Models) WithoutTag ¶
type Relation ¶
type Relation struct { Name string `json:"name"` Src []string `json:"src"` Table string `json:"table"` Tgt []string `json:"tgt"` }
func (*Relation) ContainsSource ¶
func (*Relation) SrcColumns ¶
func (*Relation) TgtColumns ¶
Click to show internal directories.
Click to hide internal directories.