guestbook

package
v0.0.0-...-b6b9e4c Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Insert(ctx context.Context, entry Entry) error
	Entries(ctx context.Context) ([]Entry, error)
	Close() error
	Ping(ctx context.Context) error
}

Backend is the interface for guestbook storage backends.

type Entry

type Entry struct {
	Date    time.Time `json:"date"`
	Name    string    `json:"name"`
	Comment string    `json:"comment"`
}

Entry represents a guestbook entry.

type Handler

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

Handler implements handler.Handler for the guestbook endpoint.

func New

func New() *Handler

New creates a new guestbook handler.

func (*Handler) Close

func (h *Handler) Close() error

Close implements graceful shutdown.

func (*Handler) Name

func (h *Handler) Name() string

Name implements handler.Handler.

func (*Handler) RegisterRoutes

func (h *Handler) RegisterRoutes(mux *http.ServeMux, ctx context.Context)

RegisterRoutes implements handler.Handler.

func (*Handler) ServeHTTP

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

ServeHTTP handles the guestbook request.

func (*Handler) SwitchBackend

func (h *Handler) SwitchBackend(backendType string) error

SwitchBackend switches the database backend.

func (*Handler) SwitchHandler

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

SwitchHandler handles backend switching.

Jump to

Keyboard shortcuts

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