form

package
v1.18.4 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dispatch

func Dispatch(path string, msg hermod.Message) error

Dispatch sends a message to the source that holds the given path.

func Register

func Register(path string) chan hermod.Message

Register creates the channel a form source reads its path from. It holds the path if nothing else does, and otherwise waits to take it over.

func Unregister

func Unregister(path string, ch chan hermod.Message)

Unregister releases a channel's claim on a path. Only the channel that holds the path removes it, so an outgoing engine's teardown cannot remove the source that took over from it.

Types

type FormSource

type FormSource struct {
	Path    string
	Storage Storage
	// contains filtered or unexported fields
}

FormSource implements the hermod.Source interface for receiving form submissions.

func NewFormSource

func NewFormSource(path string, storage Storage) *FormSource

NewFormSource creates a new FormSource.

func (*FormSource) Ack

func (s *FormSource) Ack(ctx context.Context, msg hermod.Message) error

func (*FormSource) Close

func (s *FormSource) Close() error

func (*FormSource) Ping

func (s *FormSource) Ping(ctx context.Context) error

func (*FormSource) Read

func (s *FormSource) Read(ctx context.Context) (hermod.Message, error)

func (*FormSource) Sample

func (s *FormSource) Sample(ctx context.Context, table string) (hermod.Message, error)

type FormSubmission

type FormSubmission struct {
	ID        string
	Timestamp time.Time
	Path      string
	Data      []byte
	Status    string
}

type FormSubmissionFilter

type FormSubmissionFilter struct {
	Path   string
	Status string
	Limit  int
	Page   int
}

type Storage

type Storage interface {
	CreateFormSubmission(ctx context.Context, sub FormSubmission) error
	ListFormSubmissions(ctx context.Context, filter FormSubmissionFilter) ([]FormSubmission, int, error)
	UpdateFormSubmissionStatus(ctx context.Context, id string, status string) error
}

Jump to

Keyboard shortcuts

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