contactsedit

package
v0.0.0-...-b666bd7 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(log *slog.Logger, db *db.DB) http.Handler

func ValidationMessages

func ValidationMessages(msgs []string) templ.Component

func View

func View(m Model) templ.Component

Types

type Handler

type Handler struct {
	Log *slog.Logger
	DB  *db.DB
}

func (*Handler) DisplayForm

func (h *Handler) DisplayForm(w http.ResponseWriter, r *http.Request, m Model)

func (*Handler) Get

func (h *Handler) Get(w http.ResponseWriter, r *http.Request)

func (*Handler) Post

func (h *Handler) Post(w http.ResponseWriter, r *http.Request)

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Model

type Model struct {
	Initial          bool
	SubmitButtonText string

	Name  string
	Email string
	Error string
}

func ModelFromContact

func ModelFromContact(contact db.Contact) (m Model)

func NewModel

func NewModel() Model

func (*Model) EmailHasError

func (m *Model) EmailHasError() bool

func (*Model) NameHasError

func (m *Model) NameHasError() bool

func (*Model) Validate

func (m *Model) Validate() (msgs []string)

func (*Model) ValidateEmail

func (m *Model) ValidateEmail() (msgs []string)

func (*Model) ValidateName

func (m *Model) ValidateName() (msgs []string)

Jump to

Keyboard shortcuts

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