text

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DateTime added in v2.1.0

type DateTime struct {
	types.QBase `json:",inline" bson:",inline"`

	// Format is the format of the date time field.
	// Validations:
	// - required
	Format string `json:"format" bson:"format" validate:"required"`

	// Type is the type of the date time field.
	// Validations:
	// - required
	Type DateTypeFormat `json:"type" bson:"type" validate:"required"`
}

DateTime represents a date time question type. QuestionType: types.QTypeDateTime

func CastToDateTime added in v2.1.0

func CastToDateTime(questionValue any) (*DateTime, error)

CastToDateTime casts the given interface to a DateTime type.

type DateTypeFormat added in v2.1.0

type DateTypeFormat string
const (
	DateTypeFormatDate     DateTypeFormat = "date"
	DateTypeFormatTime     DateTypeFormat = "time"
	DateTypeFormatDateTime DateTypeFormat = "datetime"
)

func (*DateTypeFormat) UnmarshalBSONValue added in v2.1.0

func (s *DateTypeFormat) UnmarshalBSONValue(typ bsontype.Type, raw []byte) error

func (*DateTypeFormat) UnmarshalJSON added in v2.1.0

func (s *DateTypeFormat) UnmarshalJSON(b []byte) error

type Email

type Email struct {
	types.QBase `json:",inline" bson:",inline"`

	// AllowedDomains list of allowed domains for the email field.
	// Validations:
	// - optional
	// - if defined, each domain must have a length of at least 1
	AllowedDomains []string `json:"allowedDomains,omitempty" bson:"allowedDomains,omitempty" validate:"omitempty,dive,min=1"`
}

Email represents an email question type. QuestionType: types.QTypeEmail

func CastToEmail

func CastToEmail(questionValue any) (*Email, error)

CastToEmail casts the given interface to an Email type.

type FreeText

type FreeText struct {
	types.QBase `json:",inline" bson:",inline"`

	// Min is an optional minimum length for the text area field.
	// Validations:
	// - optional
	// - if defined:
	//   * must be greater than or equal to 0
	//   * if max is defined, must be less than to max
	Min *int `json:"min,omitempty" bson:"min,omitempty" validate:"omitempty,min=0,ltfield=Max"`

	// Max is an optional maximum length for the text area field.
	// Validations:
	// - optional
	// - if defined:
	//   * must be greater than or equal to 0
	//   * if min is defined, must be greater than to min
	Max *int `json:"max,omitempty" bson:"max,omitempty" validate:"omitempty,min=0,gtfield=Min"`
}

FreeText represents a free text question type. Types: - types.QTypeInputText - types.QTypeTextArea

func CastToFreeText

func CastToFreeText(questionValue any) (*FreeText, error)

CastToFreeText casts the given interface to a FreeText type.

type IdentificationNumber added in v2.1.0

type IdentificationNumber struct {
	types.QBase `json:",inline" bson:",inline"`
}

IdentificationNumber represents an identification number question type. QuestionType: types.QTypeIdentificationNumber

type InformationText

type InformationText struct {
	types.QBase `json:",inline" bson:",inline"`

	// Text is the text to be displayed.
	// Validations:
	// - required
	// - min length: 1
	Text string `json:"text,omitempty" bson:"text,omitempty" validate:"required,min=1"`
}

InformationText represents an information text question type. Types: - types.QTypeInformation

type Telephone

type Telephone struct {
	types.QBase `json:",inline" bson:",inline"`

	// AllowedCountryCodes list of allowed country codes for the telephone field.
	// Validations:
	// - optional
	// - if defined, each country code must have a length of at least 1
	AllowedCountryCodes []string `json:"allowedCountryCodes,omitempty" bson:"allowedCountryCodes,omitempty" validate:"omitempty,dive,min=1"`
}

Telephone represents a telephone question type. QuestionType: types.QTypeTelephone

func CastToTelephone

func CastToTelephone(questionValue any) (*Telephone, error)

CastToTelephone casts the given interface to a Telephone type.

Jump to

Keyboard shortcuts

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