Documentation
¶
Index ¶
- type Backend
- type Entry
- type Handler
- func (h *Handler) Close() error
- func (h *Handler) Name() string
- func (h *Handler) RegisterRoutes(mux *http.ServeMux, ctx context.Context)
- func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *Handler) SwitchBackend(backendType string) error
- func (h *Handler) SwitchHandler(w http.ResponseWriter, r *http.Request)
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 (*Handler) RegisterRoutes ¶
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 ¶
SwitchBackend switches the database backend.
func (*Handler) SwitchHandler ¶
func (h *Handler) SwitchHandler(w http.ResponseWriter, r *http.Request)
SwitchHandler handles backend switching.
Click to show internal directories.
Click to hide internal directories.