field

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field interface {
	// Type defines the type of the field
	Type() *FieldType
	// Name defines the name of the field
	Name() string
	// Label defines a label suitable to be displayed to users
	Label() string
	// Help defines a text that gives hints to users
	Help() string
	// Placeholder defines a text used for placeholder attribute
	Placeholder() string
	// Rules defines a slice of rules that will be applied to check whether a value for the field is valid
	Rules() []rule.Rule
}

Field defines the configuration of a single attribute of an entity

func NewField

func NewField(
	fieldType *FieldType,
	name string,
	label string,
	help string,
	placeholder string,
	rules []rule.Rule,
) (Field, error)

NewField creates a new instance of CommonField

type FieldType

type FieldType struct {
	// contains filtered or unexported fields
}

FieldType defines the type of the field

var (
	// EMAIL defines the email field
	EMAIL *FieldType = &FieldType{"EMAIL"}
	// TEXT defines the text field
	TEXT *FieldType = &FieldType{"TEXT"}
)

func NewFieldType

func NewFieldType(name string) (*FieldType, error)

NewFieldType creates an instance of FieldType

func (*FieldType) IsZero

func (ft *FieldType) IsZero() bool

IsZero defines whether FieldType is empty

func (*FieldType) Name

func (ft *FieldType) Name() string

Name returns the name of the field type

func (*FieldType) String

func (ft *FieldType) String() string

String defines the string interface

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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