fields

package
v0.0.0-...-40253c5 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterCustom

func RegisterCustom(name string, field Field) error

func Validate

func Validate(field Field, req *http.Request, existing interface{}) (interface{}, error)

Types

type BaseField

type BaseField struct {
	Name          string
	Label         string
	DefaultValue  interface{}
	Blank         bool
	Null          bool
	ColumnName    string
	List          bool
	Searchable    bool
	Width         int
	Right         bool
	Help          string
	RelationTable string
}

func (*BaseField) Attrs

func (b *BaseField) Attrs() *BaseField

func (*BaseField) BaseRender

func (b *BaseField) BaseRender(w io.Writer, tmpl *template.Template, value interface{}, errStr string, startRow bool, ctx map[string]interface{})

func (*BaseField) Configure

func (b *BaseField) Configure(tagMap map[string]string) error

func (*BaseField) RenderString

func (b *BaseField) RenderString(val interface{}) template.HTML

func (*BaseField) Validate

func (b *BaseField) Validate(val string) (interface{}, error)

type BooleanField

type BooleanField struct {
	*BaseField
}

func (*BooleanField) BaseRender

func (b *BooleanField) BaseRender(w io.Writer, value interface{}, errStr string, startRow bool, ctx map[string]interface{})

func (*BooleanField) Configure

func (b *BooleanField) Configure(tagMap map[string]string) error

func (*BooleanField) Render

func (b *BooleanField) Render(w io.Writer, val interface{}, err string, startRow bool)

func (*BooleanField) RenderString

func (b *BooleanField) RenderString(val interface{}) template.HTML

func (*BooleanField) Validate

func (b *BooleanField) Validate(val string) (interface{}, error)

type Field

type Field interface {
	Configure(map[string]string) error
	Render(w io.Writer, val interface{}, err string, startRow bool)
	RenderString(val interface{}) template.HTML
	Validate(string) (interface{}, error)
	Attrs() *BaseField
}

func GetCustom

func GetCustom(name string) Field

type FileField

type FileField struct {
	*BaseField
	UploadTo string
}

func (*FileField) Configure

func (f *FileField) Configure(tagMap map[string]string) error

func (*FileField) HandleFile

func (f *FileField) HandleFile(file *multipart.FileHeader) (string, error)

func (*FileField) Render

func (f *FileField) Render(w io.Writer, val interface{}, err string, startRow bool)

func (*FileField) Validate

func (f *FileField) Validate(val string) (interface{}, error)

type FileHandlerField

type FileHandlerField interface {
	HandleFile(*multipart.FileHeader) (string, error)
}

type FloatField

type FloatField struct {
	*BaseField
	// contains filtered or unexported fields
}

func (*FloatField) Configure

func (f *FloatField) Configure(tagMap map[string]string) error

func (*FloatField) Render

func (f *FloatField) Render(w io.Writer, val interface{}, err string, startRow bool)

func (*FloatField) Validate

func (f *FloatField) Validate(val string) (interface{}, error)

type ForeignKeyField

type ForeignKeyField struct {
	*BaseField
	// contains filtered or unexported fields
}

func (*ForeignKeyField) GetListColumn

func (f *ForeignKeyField) GetListColumn() string

func (*ForeignKeyField) GetModelSlug

func (f *ForeignKeyField) GetModelSlug() string

func (*ForeignKeyField) GetRelatedTable

func (f *ForeignKeyField) GetRelatedTable() string

func (*ForeignKeyField) GetRelationTable

func (f *ForeignKeyField) GetRelationTable() string

func (*ForeignKeyField) Render

func (f *ForeignKeyField) Render(w io.Writer, val interface{}, err string, startRow bool)

func (*ForeignKeyField) SetListColumn

func (f *ForeignKeyField) SetListColumn(column string)

func (*ForeignKeyField) SetModelSlug

func (f *ForeignKeyField) SetModelSlug(slug string)

func (*ForeignKeyField) SetRelatedTable

func (f *ForeignKeyField) SetRelatedTable(table string)

func (*ForeignKeyField) Validate

func (f *ForeignKeyField) Validate(val string) (interface{}, error)

type IntField

type IntField struct {
	*BaseField
	// contains filtered or unexported fields
}

func (*IntField) Configure

func (i *IntField) Configure(tagMap map[string]string) error

func (*IntField) Render

func (i *IntField) Render(w io.Writer, val interface{}, err string, startRow bool)

func (*IntField) Validate

func (i *IntField) Validate(val string) (interface{}, error)

type ManyToManyField

type ManyToManyField struct {
	*BaseField
	// contains filtered or unexported fields
}

func (*ManyToManyField) GetListColumn

func (m *ManyToManyField) GetListColumn() string

func (*ManyToManyField) GetModelSlug

func (m *ManyToManyField) GetModelSlug() string

func (*ManyToManyField) GetRelatedTable

func (m *ManyToManyField) GetRelatedTable() string

func (*ManyToManyField) GetRelationTable

func (m *ManyToManyField) GetRelationTable() string

func (*ManyToManyField) Render

func (m *ManyToManyField) Render(w io.Writer, val interface{}, err string, startRow bool)

func (*ManyToManyField) SetListColumn

func (m *ManyToManyField) SetListColumn(column string)

func (*ManyToManyField) SetModelSlug

func (m *ManyToManyField) SetModelSlug(slug string)

func (*ManyToManyField) SetRelatedTable

func (m *ManyToManyField) SetRelatedTable(table string)

func (*ManyToManyField) Validate

func (m *ManyToManyField) Validate(val string) (interface{}, error)

type RelationalField

type RelationalField interface {
	SetRelatedTable(string)
	GetRelatedTable() string
	SetListColumn(string)
	GetListColumn() string
	SetModelSlug(string)
	GetModelSlug() string
	GetRelationTable() string
}

type TextField

type TextField struct {
	*BaseField

	MaxLength int
	// contains filtered or unexported fields
}

func (*TextField) Configure

func (t *TextField) Configure(tagMap map[string]string) error

func (*TextField) Render

func (t *TextField) Render(w io.Writer, val interface{}, err string, startRow bool)

func (*TextField) Validate

func (t *TextField) Validate(val string) (interface{}, error)

type TimeField

type TimeField struct {
	*BaseField
	Format string
}

func (*TimeField) Configure

func (t *TimeField) Configure(tagMap map[string]string) error

func (*TimeField) Render

func (t *TimeField) Render(w io.Writer, val interface{}, err string, startRow bool)

func (*TimeField) RenderString

func (t *TimeField) RenderString(val interface{}) template.HTML

func (*TimeField) Validate

func (t *TimeField) Validate(val string) (interface{}, error)

type URLField

type URLField struct {
	*BaseField
}

func (*URLField) Render

func (n *URLField) Render(w io.Writer, val interface{}, err string, startRow bool)

func (*URLField) RenderString

func (n *URLField) RenderString(val interface{}) template.HTML

func (*URLField) Validate

func (n *URLField) Validate(val string) (interface{}, error)

Jump to

Keyboard shortcuts

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