forms

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiError

type ApiError struct {
	Message string            `json:"message"`
	Fields  map[string]string `json:"fields"`
}

func NewApiError

func NewApiError(message string, fields ...map[string]string) ApiError

func (ApiError) Error

func (e ApiError) Error() string

type CommaSeparatedStrings

type CommaSeparatedStrings []string

CommaSeparatedStrings is a custom type for handling comma-separated values from selectbox component. It implements echo.BindUnmarshaler to split comma-separated strings into a slice. This is needed because the templui selectbox component sends multiple values as "val1,val2,val3" instead of multiple form fields with the same name.

func (*CommaSeparatedStrings) UnmarshalParam

func (css *CommaSeparatedStrings) UnmarshalParam(param string) error

func (*CommaSeparatedStrings) UnmarshalParams

func (css *CommaSeparatedStrings) UnmarshalParams(params []string) error

UnmarshalParam implements echo's BindUnmarshaler interface for custom form binding. It splits comma-separated values into a string slice. UnmarshalParams accepts repeated fields and comma-separated values. shadcn-templ's multiple combobox submits one input per value; the v1 selectbox submitted one comma-separated field.

type CreateProjectForm

type CreateProjectForm struct {
	ID      string   `json:"id" form:"id"`
	Name    string   `json:"name" form:"name" validate:"required,gte=3"`
	Clients []string `json:"clients" form:"clients"`
}

type CreateUserForm

type CreateUserForm struct {
	ID         string                `json:"id" form:"id"`
	Username   string                `json:"username" form:"username" validate:"required,gte=3"`
	FirstName  string                `json:"firstName" form:"firstName" validate:"required,gte=3"`
	LastName   string                `json:"lastName" form:"lastName" validate:"required,gte=3"`
	Role       string                `json:"role" form:"role" validate:"required,oneof=user admin"`
	ProjectIDs CommaSeparatedStrings `json:"projects" form:"projects"`
}

type CredentialGenerationForm

type CredentialGenerationForm struct {
	ProjectID string       `form:"projectId" validate:"required"`
	ClientID  string       `form:"clientId" validate:"required"`
	Expiry    NullableDate `form:"expiry"`
}

type FormBool

type FormBool bool

func (FormBool) Bool

func (b FormBool) Bool() bool

func (*FormBool) UnmarshalParam

func (b *FormBool) UnmarshalParam(param string) error

type LoginForm

type LoginForm struct {
	Username string `json:"username" form:"username" validate:"required,gte=3"`
	Password string `json:"password" form:"password" validate:"required,gte=8"`
	Redirect string `json:"redirect" form:"redirect"`
}

type LoginFormWithToken

type LoginFormWithToken struct {
	Token string `json:"token" form:"token" query:"token" validate:"required,gte=5"`
}

type NullableDate

type NullableDate struct {
	Time  time.Time
	Valid bool
}

NullableDate is a custom type for handling optional date inputs from forms. It implements echo.BindUnmarshaler to support multiple date formats.

func (*NullableDate) UnmarshalParam

func (nd *NullableDate) UnmarshalParam(param string) error

UnmarshalParam implements echo's BindUnmarshaler interface for custom form binding. An empty value means no expiry. YYYY-MM-DD is a UTC calendar day and is stored as the exclusive end of that day, the start of the next UTC day, so the selected day remains valid through its end. RFC3339 values stay absolute instants.

type PageInput

type PageInput struct {
	Search string `json:"search" query:"search"`
	Page   int64  `json:"page" query:"page" default:"0" validate:"gte=0"`
	Size   int64  `json:"size" query:"size" default:"10" validate:"gte=1,lte=100"`
}

type ResetPasswordForm

type ResetPasswordForm struct {
	Password         string `json:"password" form:"password" validate:"required,gte=8"`
	RepeatedPassword string `json:"repeatedPassword" form:"repeatedPassword" validate:"required,gte=8"`
}

Jump to

Keyboard shortcuts

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