model

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HistoryType  = "history"
	RevisionType = "revision"
)

Variables

This section is empty.

Functions

func ColToString

func ColToString(c *Column, prefix string) string

func ColToViewString

func ColToViewString(c *Column, prefix string) string

func Help added in v0.1.39

func Help(t types.Type) string

func ToGoDTOType added in v0.1.39

func ToGoDTOType(t types.Type, nullable bool) string

func ToGoString added in v0.1.39

func ToGoString(t types.Type, prop string) string

func ToGoType added in v0.1.39

func ToGoType(t types.Type, nullable bool) string

func ToGoViewString added in v0.1.39

func ToGoViewString(t types.Type, prop string, nullable bool) string

func ToSQLType added in v0.1.39

func ToSQLType(t types.Type) string

func TypeToString

func TypeToString(t types.Type, prop string) string

func TypeToViewString

func TypeToViewString(t types.Type, prop string, nullable bool) string

Types

type Args

type Args struct {
	Config  util.ValueMap `json:"config,omitempty"`
	Models  Models        `json:"models,omitempty"`
	Modules []string      `json:"-"`
}

func (*Args) HasModule

func (a *Args) HasModule(key string) bool

func (*Args) Validate added in v0.1.35

func (a *Args) Validate() error

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"`
	Display    string         `json:"display,omitempty"`
	Tags       []string       `json:"tags,omitempty"`
}

func (*Column) BC added in v0.1.29

func (c *Column) BC() string

func (*Column) Camel

func (c *Column) Camel() string

func (*Column) CamelPlural added in v0.1.34

func (c *Column) CamelPlural() string

func (*Column) Clone added in v0.1.38

func (c *Column) Clone() *Column

func (*Column) HasTag added in v0.1.29

func (c *Column) HasTag(t string) bool

func (*Column) Help added in v0.1.27

func (c *Column) Help() string

func (*Column) NameQuoted added in v0.1.32

func (c *Column) NameQuoted() string

func (*Column) Plural added in v0.1.29

func (c *Column) Plural() string

func (*Column) Proper

func (c *Column) Proper() string

func (*Column) ProperPlural added in v0.1.29

func (c *Column) ProperPlural() string

func (*Column) ShouldDisplay added in v0.1.48

func (c *Column) ShouldDisplay(k string) bool

func (*Column) Title added in v0.1.29

func (c *Column) Title() string

func (*Column) TitleLower added in v0.1.32

func (c *Column) TitleLower() string

func (*Column) ToGoDTOType

func (c *Column) ToGoDTOType() string

func (*Column) ToGoEditString

func (c *Column) ToGoEditString(prefix string) string

func (*Column) ToGoMapParse

func (c *Column) ToGoMapParse() string

func (*Column) ToGoString

func (c *Column) ToGoString(prefix string) string

func (*Column) ToGoType

func (c *Column) ToGoType() string

func (*Column) ToGoViewString

func (c *Column) ToGoViewString(prefix string) string

func (*Column) ToSQLType added in v0.1.29

func (c *Column) ToSQLType() string

func (*Column) ZeroVal

func (c *Column) ZeroVal() string

type Columns

type Columns []*Column

func (Columns) Args

func (c Columns) Args() string

func (Columns) CamelNames

func (c Columns) CamelNames() []string

func (Columns) ForDisplay added in v0.1.48

func (c Columns) ForDisplay(k string) Columns

func (Columns) Get

func (c Columns) Get(name string) *Column

func (Columns) GoDTOTypeKeys

func (c Columns) GoDTOTypeKeys() []string

func (Columns) GoTypeKeys

func (c Columns) GoTypeKeys() []string

func (Columns) GoTypes added in v0.1.33

func (c Columns) GoTypes() []string

func (Columns) MaxCamelLength added in v0.1.33

func (c Columns) MaxCamelLength() int

func (Columns) MaxGoDTOKeyLength

func (c Columns) MaxGoDTOKeyLength() int

func (Columns) MaxGoKeyLength

func (c Columns) MaxGoKeyLength() int

func (Columns) MaxGoTypeLength added in v0.1.33

func (c Columns) MaxGoTypeLength() int

func (Columns) Names

func (c Columns) Names() []string

func (Columns) NamesQuoted

func (c Columns) NamesQuoted() []string

func (Columns) NonPKs added in v0.1.32

func (c Columns) NonPKs() Columns

func (Columns) OneWithTag added in v0.1.29

func (c Columns) OneWithTag(t string) (*Column, error)

func (Columns) PKs

func (c Columns) PKs() Columns

func (Columns) ProperNames added in v0.1.35

func (c Columns) ProperNames() []string

func (Columns) Refs

func (c Columns) Refs() string

func (Columns) Searches

func (c Columns) Searches() Columns

func (Columns) Smushed

func (c Columns) Smushed() string

func (Columns) TitlesLower added in v0.1.35

func (c Columns) TitlesLower() []string

func (Columns) ToGoStrings added in v0.1.35

func (c Columns) ToGoStrings(prefix string) string

func (Columns) ToRefs added in v0.1.37

func (c Columns) ToRefs(prefix string) string

func (Columns) Types

func (c Columns) Types() types.Types

func (Columns) WhereClause

func (c Columns) WhereClause(offset int) string

func (Columns) WithTag added in v0.1.29

func (c Columns) WithTag(t string) Columns

func (Columns) WithoutTag added in v0.1.29

func (c Columns) WithoutTag(t string) Columns

func (Columns) ZeroVals

func (c Columns) ZeroVals() []string

type HistoryMap added in v0.1.29

type HistoryMap struct {
	Col   *Column `json:"col"`
	Const Columns `json:"const,omitempty"`
	Var   Columns `json:"var,omitempty"`
	Err   error   `json:"-"`
}

type Index added in v0.1.38

type Index struct {
	Name string `json:"name"`
	Decl string `json:"decl"`
}

type Indexes added in v0.1.38

type Indexes []*Index

type Model

type Model struct {
	Name           string           `json:"name"`
	Package        string           `json:"package"`
	Description    string           `json:"description,omitempty"`
	Icon           string           `json:"icon,omitempty"`
	Ordering       filter.Orderings `json:"ordering,omitempty"`
	Search         []string         `json:"search,omitempty"`
	History        string           `json:"history,omitempty"`
	Tags           []string         `json:"tags,omitempty"`
	TitleOverride  string           `json:"title,omitempty"`
	ProperOverride string           `json:"proper,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"`
	// contains filtered or unexported fields
}

func (*Model) Camel

func (m *Model) Camel() string

func (*Model) CamelPlural added in v0.1.38

func (m *Model) CamelPlural() interface{}

func (*Model) ClassRef

func (m *Model) ClassRef() string

func (*Model) FirstLetter

func (m *Model) FirstLetter() string

func (*Model) GroupedColumns added in v0.1.29

func (m *Model) GroupedColumns() Columns

func (*Model) HasTag added in v0.1.29

func (m *Model) HasTag(t string) bool

func (*Model) Help added in v0.1.27

func (m *Model) Help() string

func (*Model) HistoryColumn added in v0.1.29

func (m *Model) HistoryColumn() *Column

func (*Model) HistoryColumns added in v0.1.29

func (m *Model) HistoryColumns(coreColumns bool) *HistoryMap

func (*Model) IconSafe

func (m *Model) IconSafe() string

func (*Model) IsHistory added in v0.1.35

func (m *Model) IsHistory() bool

func (*Model) IsRevision added in v0.1.29

func (m *Model) IsRevision() bool

func (*Model) IsSoftDelete added in v0.1.29

func (m *Model) IsSoftDelete() bool

func (*Model) LinkURL

func (m *Model) LinkURL(prefix string) string

func (*Model) PKs added in v0.1.29

func (m *Model) PKs() Columns

func (*Model) Plural added in v0.1.29

func (m *Model) Plural() string

func (*Model) Proper

func (m *Model) Proper() string

func (*Model) ProperPlural

func (m *Model) ProperPlural() string

func (*Model) RelationsFor added in v0.1.35

func (m *Model) RelationsFor(col *Column) Relations

func (*Model) Route added in v0.1.35

func (m *Model) Route() string

func (*Model) SoftDeleteSuffix added in v0.1.38

func (m *Model) SoftDeleteSuffix() string

func (*Model) Title added in v0.1.32

func (m *Model) Title() string

func (*Model) TitleLower added in v0.1.32

func (m *Model) TitleLower() string

func (*Model) TitlePlural added in v0.1.32

func (m *Model) TitlePlural() string

func (*Model) TitlePluralLower added in v0.1.32

func (m *Model) TitlePluralLower() string

func (*Model) URLPath

func (m *Model) URLPath(prefix string) string

func (*Model) Validate added in v0.1.29

func (m *Model) Validate(mods []string) error

type Models

type Models []*Model

func (Models) Get added in v0.1.35

func (m Models) Get(n string) *Model

func (Models) ReverseRelations added in v0.1.35

func (m Models) ReverseRelations(t string) Relations

type Relation added in v0.1.35

type Relation struct {
	Name  string   `json:"name"`
	Src   []string `json:"src"`
	Table string   `json:"table"`
	Tgt   []string `json:"tgt"`
}

func (*Relation) Reverse added in v0.1.35

func (r *Relation) Reverse(name string) *Relation

func (*Relation) SrcColumns added in v0.1.35

func (r *Relation) SrcColumns(m *Model) Columns

func (*Relation) SrcQuoted added in v0.1.35

func (r *Relation) SrcQuoted() interface{}

func (*Relation) TgtColumns added in v0.1.35

func (r *Relation) TgtColumns(m *Model) Columns

func (*Relation) TgtQuoted added in v0.1.35

func (r *Relation) TgtQuoted() interface{}

func (*Relation) WebPath added in v0.1.35

func (r *Relation) WebPath(src *Model, tgt *Model, prefix string) interface{}

type Relations added in v0.1.35

type Relations []*Relation

Jump to

Keyboard shortcuts

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