fields

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binary

type Binary struct {
	JSON            string
	String          string
	Help            string
	Stored          bool
	Required        bool
	ReadOnly        bool
	RequiredFunc    func(models.Environment) (bool, models.Conditioner)
	ReadOnlyFunc    func(models.Environment) (bool, models.Conditioner)
	InvisibleFunc   func(models.Environment) (bool, models.Conditioner)
	Unique          bool
	Index           bool
	Compute         models.Methoder
	Depends         []string
	Related         string
	NoCopy          bool
	GoType          interface{}
	OnChange        models.Methoder
	OnChangeWarning models.Methoder
	OnChangeFilters models.Methoder
	Constraint      models.Methoder
	Inverse         models.Methoder
	Contexts        models.FieldContexts
	Default         func(models.Environment) interface{}
}

A Binary is a field for storing binary data, such as images.

Clients are expected to handle binary fields as file uploads.

TypeBinary fields are stored in the database. Consider other disk based alternatives if you have a large amount of data to store.

func (Binary) DeclareField

func (bf Binary) DeclareField(fc *models.FieldsCollection, name string) *models.Field

DeclareField creates a binary field for the given models.FieldsCollection with the given name.

type Boolean

type Boolean struct {
	JSON            string
	String          string
	Help            string
	Stored          bool
	Required        bool
	ReadOnly        bool
	RequiredFunc    func(models.Environment) (bool, models.Conditioner)
	ReadOnlyFunc    func(models.Environment) (bool, models.Conditioner)
	InvisibleFunc   func(models.Environment) (bool, models.Conditioner)
	Unique          bool
	Index           bool
	Compute         models.Methoder
	Depends         []string
	Related         string
	NoCopy          bool
	GoType          interface{}
	OnChange        models.Methoder
	OnChangeWarning models.Methoder
	OnChangeFilters models.Methoder
	Constraint      models.Methoder
	Inverse         models.Methoder
	Contexts        models.FieldContexts
	Default         func(models.Environment) interface{}
}

A Boolean is a field for storing true/false values.

Clients are expected to handle boolean fields as checkboxes.

func (Boolean) DeclareField

func (bf Boolean) DeclareField(fc *models.FieldsCollection, name string) *models.Field

DeclareField creates a boolean field for the given models.FieldsCollection with the given name.

type Char

type Char struct {
	JSON            string
	String          string
	Help            string
	Stored          bool
	Required        bool
	ReadOnly        bool
	RequiredFunc    func(models.Environment) (bool, models.Conditioner)
	ReadOnlyFunc    func(models.Environment) (bool, models.Conditioner)
	InvisibleFunc   func(models.Environment) (bool, models.Conditioner)
	Unique          bool
	Index           bool
	Compute         models.Methoder
	Depends         []string
	Related         string
	NoCopy          bool
	Size            int
	GoType          interface{}
	Translate       bool
	OnChange        models.Methoder
	OnChangeWarning models.Methoder
	OnChangeFilters models.Methoder
	Constraint      models.Methoder
	Inverse         models.Methoder
	Contexts        models.FieldContexts
	Default         func(models.Environment) interface{}
}

A Char is a field for storing short text. There is no default max size, but it can be forced by setting the Size value.

Clients are expected to handle TypeChar fields as single line inputs.

func (Char) DeclareField

func (cf Char) DeclareField(fc *models.FieldsCollection, name string) *models.Field

DeclareField creates a char field for the given models.FieldsCollection with the given name.

type Date

type Date struct {
	JSON            string
	String          string
	Help            string
	Stored          bool
	Required        bool
	ReadOnly        bool
	RequiredFunc    func(models.Environment) (bool, models.Conditioner)
	ReadOnlyFunc    func(models.Environment) (bool, models.Conditioner)
	InvisibleFunc   func(models.Environment) (bool, models.Conditioner)
	Unique          bool
	Index           bool
	Compute         models.Methoder
	Depends         []string
	Related         string
	GroupOperator   string
	NoCopy          bool
	GoType          interface{}
	OnChange        models.Methoder
	OnChangeWarning models.Methoder
	OnChangeFilters models.Methoder
	Constraint      models.Methoder
	Inverse         models.Methoder
	Contexts        models.FieldContexts
	Default         func(models.Environment) interface{}
}

A Date is a field for storing dates without time.

Clients are expected to handle Date fields with a date picker.

func (Date) DeclareField

func (df Date) DeclareField(fc *models.FieldsCollection, name string) *models.Field

DeclareField creates a date field for the given models.FieldsCollection with the given name.

type DateTime

type DateTime struct {
	JSON            string
	String          string
	Help            string
	Stored          bool
	Required        bool
	ReadOnly        bool
	RequiredFunc    func(models.Environment) (bool, models.Conditioner)
	ReadOnlyFunc    func(models.Environment) (bool, models.Conditioner)
	InvisibleFunc   func(models.Environment) (bool, models.Conditioner)
	Unique          bool
	Index           bool
	Compute         models.Methoder
	Depends         []string
	Related         string
	GroupOperator   string
	NoCopy          bool
	GoType          interface{}
	OnChange        models.Methoder
	OnChangeWarning models.Methoder
	OnChangeFilters models.Methoder
	Constraint      models.Methoder
	Inverse         models.Methoder
	Contexts        models.FieldContexts
	Default         func(models.Environment) interface{}
}

A DateTime is a field for storing dates with time.

Clients are expected to handle DateTime fields with a date and time picker.

func (DateTime) DeclareField

func (df DateTime) DeclareField(fc *models.FieldsCollection, name string) *models.Field

DeclareField creates a datetime field for the given models.FieldsCollection with the given name.

type FieldDefinition

type FieldDefinition interface {
	// DeclareField creates a field for the given FieldsCollection with the given name and returns the created field.
	DeclareField(*models.FieldsCollection, string) *models.Field
}

A FieldDefinition is a struct that declares a new field in a fields collection;

type Float

type Float struct {
	JSON            string
	String          string
	Help            string
	Stored          bool
	Required        bool
	ReadOnly        bool
	RequiredFunc    func(models.Environment) (bool, models.Conditioner)
	ReadOnlyFunc    func(models.Environment) (bool, models.Conditioner)
	InvisibleFunc   func(models.Environment) (bool, models.Conditioner)
	Unique          bool
	Index           bool
	Compute         models.Methoder
	Depends         []string
	Related         string
	GroupOperator   string
	NoCopy          bool
	Digits          nbutils.Digits
	GoType          interface{}
	OnChange        models.Methoder
	OnChangeWarning models.Methoder
	OnChangeFilters models.Methoder
	Constraint      models.Methoder
	Inverse         models.Methoder
	Contexts        models.FieldContexts
	Default         func(models.Environment) interface{}
}

A Float is a field for storing decimal numbers.

func (Float) DeclareField

func (ff Float) DeclareField(fc *models.FieldsCollection, name string) *models.Field

DeclareField adds this datetime field for the given models.FieldsCollection with the given name.

type HTML

type HTML struct {
	JSON            string
	String          string
	Help            string
	Stored          bool
	Required        bool
	ReadOnly        bool
	RequiredFunc    func(models.Environment) (bool, models.Conditioner)
	ReadOnlyFunc    func(models.Environment) (bool, models.Conditioner)
	InvisibleFunc   func(models.Environment) (bool, models.Conditioner)
	Unique          bool
	Index           bool
	Compute         models.Methoder
	Depends         []string
	Related         string
	NoCopy          bool
	Size            int
	GoType          interface{}
	Translate       bool
	OnChange        models.Methoder
	OnChangeWarning models.Methoder
	OnChangeFilters models.Methoder
	Constraint      models.Methoder
	Inverse         models.Methoder
	Contexts        models.FieldContexts
	Default         func(models.Environment) interface{}
}

An HTML is a field for storing HTML formatted strings.

Clients are expected to handle HTML fields with multi-line HTML editors.

func (HTML) DeclareField

func (tf HTML) DeclareField(fc *models.FieldsCollection, name string) *models.Field

DeclareField creates a html field for the given models.FieldsCollection with the given name.

type Integer

type Integer struct {
	JSON            string
	String          string
	Help            string
	Stored          bool
	Required        bool
	ReadOnly        bool
	RequiredFunc    func(models.Environment) (bool, models.Conditioner)
	ReadOnlyFunc    func(models.Environment) (bool, models.Conditioner)
	InvisibleFunc   func(models.Environment) (bool, models.Conditioner)
	Unique          bool
	Index           bool
	Compute         models.Methoder
	Depends         []string
	Related         string
	GroupOperator   string
	NoCopy          bool
	GoType          interface{}
	OnChange        models.Methoder
	OnChangeWarning models.Methoder
	OnChangeFilters models.Methoder
	Constraint      models.Methoder
	Inverse         models.Methoder
	Contexts        models.FieldContexts
	Default         func(models.Environment) interface{}
}

An Integer is a field for storing non decimal numbers.

func (Integer) DeclareField

func (i Integer) DeclareField(fc *models.FieldsCollection, name string) *models.Field

DeclareField creates a datetime field for the given models.FieldsCollection with the given name.

type Many2Many

type Many2Many struct {
	JSON             string
	String           string
	Help             string
	Stored           bool
	Required         bool
	ReadOnly         bool
	RequiredFunc     func(models.Environment) (bool, models.Conditioner)
	ReadOnlyFunc     func(models.Environment) (bool, models.Conditioner)
	InvisibleFunc    func(models.Environment) (bool, models.Conditioner)
	Index            bool
	Compute          models.Methoder
	Depends          []string
	Related          string
	NoCopy           bool
	RelationModel    models.Modeler
	M2MLinkModelName string
	M2MOurField      string
	M2MTheirField    string
	OnChange         models.Methoder
	OnChangeWarning  models.Methoder
	OnChangeFilters  models.Methoder
	Constraint       models.Methoder
	Filter           models.Conditioner
	Inverse          models.Methoder
	Default          func(models.Environment) interface{}
}

A Many2Many is a field for storing many-to-many relations.

Clients are expected to handle many2many fields with a table or with tags.

func (Many2Many) DeclareField

func (mf Many2Many) DeclareField(fc *models.FieldsCollection, name string) *models.Field

DeclareField creates a many2many field for the given models.FieldsCollection with the given name.

type Many2One

type Many2One struct {
	JSON            string
	String          string
	Help            string
	Stored          bool
	Required        bool
	ReadOnly        bool
	RequiredFunc    func(models.Environment) (bool, models.Conditioner)
	ReadOnlyFunc    func(models.Environment) (bool, models.Conditioner)
	InvisibleFunc   func(models.Environment) (bool, models.Conditioner)
	Index           bool
	Compute         models.Methoder
	Depends         []string
	Related         string
	NoCopy          bool
	RelationModel   models.Modeler
	Embed           bool
	OnDelete        models.OnDeleteAction
	OnChange        models.Methoder
	OnChangeWarning models.Methoder
	OnChangeFilters models.Methoder
	Constraint      models.Methoder
	Filter          models.Conditioner
	Inverse         models.Methoder
	Contexts        models.FieldContexts
	Default         func(models.Environment) interface{}
}

A Many2One is a field for storing many-to-one relations, i.e. the FK to another model.

Clients are expected to handle many2one fields with a combo-box.

func (Many2One) DeclareField

func (mf Many2One) DeclareField(fc *models.FieldsCollection, name string) *models.Field

DeclareField creates a many2one field for the given models.FieldsCollection with the given name.

type One2Many

type One2Many struct {
	JSON            string
	String          string
	Help            string
	Stored          bool
	Required        bool
	ReadOnly        bool
	RequiredFunc    func(models.Environment) (bool, models.Conditioner)
	ReadOnlyFunc    func(models.Environment) (bool, models.Conditioner)
	InvisibleFunc   func(models.Environment) (bool, models.Conditioner)
	Index           bool
	Compute         models.Methoder
	Depends         []string
	Related         string
	Copy            bool
	RelationModel   models.Modeler
	ReverseFK       string
	OnChange        models.Methoder
	OnChangeWarning models.Methoder
	OnChangeFilters models.Methoder
	Constraint      models.Methoder
	Filter          models.Conditioner
	Inverse         models.Methoder
	Default         func(models.Environment) interface{}
}

A One2Many is a field for storing one-to-many relations.

Clients are expected to handle one2many fields with a table.

func (One2Many) DeclareField

func (of One2Many) DeclareField(fc *models.FieldsCollection, name string) *models.Field

DeclareField creates a one2many field for the given models.FieldsCollection with the given name.

type One2One

type One2One struct {
	JSON            string
	String          string
	Help            string
	Stored          bool
	Required        bool
	ReadOnly        bool
	RequiredFunc    func(models.Environment) (bool, models.Conditioner)
	ReadOnlyFunc    func(models.Environment) (bool, models.Conditioner)
	InvisibleFunc   func(models.Environment) (bool, models.Conditioner)
	Index           bool
	Compute         models.Methoder
	Depends         []string
	Related         string
	NoCopy          bool
	RelationModel   models.Modeler
	Embed           bool
	OnDelete        models.OnDeleteAction
	OnChange        models.Methoder
	OnChangeWarning models.Methoder
	OnChangeFilters models.Methoder
	Constraint      models.Methoder
	Filter          models.Conditioner
	Inverse         models.Methoder
	Contexts        models.FieldContexts
	Default         func(models.Environment) interface{}
}

A One2One is a field for storing one-to-one relations, i.e. the FK to another model with a unique constraint.

Clients are expected to handle one2one fields with a combo-box.

func (One2One) DeclareField

func (of One2One) DeclareField(fc *models.FieldsCollection, name string) *models.Field

DeclareField creates a one2one field for the given models.FieldsCollection with the given name.

type Rev2One

type Rev2One struct {
	JSON            string
	String          string
	Help            string
	Stored          bool
	Required        bool
	ReadOnly        bool
	RequiredFunc    func(models.Environment) (bool, models.Conditioner)
	ReadOnlyFunc    func(models.Environment) (bool, models.Conditioner)
	InvisibleFunc   func(models.Environment) (bool, models.Conditioner)
	Index           bool
	Compute         models.Methoder
	Depends         []string
	Related         string
	Copy            bool
	RelationModel   models.Modeler
	ReverseFK       string
	OnChange        models.Methoder
	OnChangeWarning models.Methoder
	OnChangeFilters models.Methoder
	Constraint      models.Methoder
	Filter          models.Conditioner
	Inverse         models.Methoder
	Default         func(models.Environment) interface{}
}

A Rev2One is a field for storing reverse one-to-one relations, i.e. the relation on the model without FK.

Clients are expected to handle rev2one fields with a combo-box.

func (Rev2One) DeclareField

func (rf Rev2One) DeclareField(fc *models.FieldsCollection, name string) *models.Field

DeclareField creates a rev2one field for the given models.FieldsCollection with the given name.

type Selection

type Selection struct {
	JSON            string
	String          string
	Help            string
	Stored          bool
	Required        bool
	ReadOnly        bool
	RequiredFunc    func(models.Environment) (bool, models.Conditioner)
	ReadOnlyFunc    func(models.Environment) (bool, models.Conditioner)
	InvisibleFunc   func(models.Environment) (bool, models.Conditioner)
	Unique          bool
	Index           bool
	Compute         models.Methoder
	Depends         []string
	Related         string
	NoCopy          bool
	Selection       types.Selection
	SelectionFunc   func() types.Selection
	OnChange        models.Methoder
	OnChangeWarning models.Methoder
	OnChangeFilters models.Methoder
	Constraint      models.Methoder
	Inverse         models.Methoder
	Contexts        models.FieldContexts
	Default         func(models.Environment) interface{}
}

A Selection is a field for storing a value from a preset list.

Clients are expected to handle selection fields with a combo-box or radio buttons.

func (Selection) DeclareField

func (sf Selection) DeclareField(fc *models.FieldsCollection, name string) *models.Field

DeclareField creates a selection field for the given models.FieldsCollection with the given name.

type Text

type Text struct {
	JSON            string
	String          string
	Help            string
	Stored          bool
	Required        bool
	ReadOnly        bool
	RequiredFunc    func(models.Environment) (bool, models.Conditioner)
	ReadOnlyFunc    func(models.Environment) (bool, models.Conditioner)
	InvisibleFunc   func(models.Environment) (bool, models.Conditioner)
	Unique          bool
	Index           bool
	Compute         models.Methoder
	Depends         []string
	Related         string
	NoCopy          bool
	Size            int
	GoType          interface{}
	Translate       bool
	OnChange        models.Methoder
	OnChangeWarning models.Methoder
	OnChangeFilters models.Methoder
	Constraint      models.Methoder
	Inverse         models.Methoder
	Contexts        models.FieldContexts
	Default         func(models.Environment) interface{}
}

A Text is a field for storing long text. There is no default max size, but it can be forced by setting the Size value.

Clients are expected to handle text fields as multi-line inputs.

func (Text) DeclareField

func (tf Text) DeclareField(fc *models.FieldsCollection, name string) *models.Field

DeclareField creates a text field for the given models.FieldsCollection with the given name.

Jump to

Keyboard shortcuts

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