Documentation
¶
Overview ¶
The task-67 reference CRUD application: the MVP acceptance demonstration. Handlers render fragments through the nethttp adapter (FR-035 opt-in mode selection), emit contract events through the generated ghtmxgen emitters (FR-037), and the templates bind every URL through route-aware bindings (FR-020/FR-021) — zero hand-written htmx glue.
Renaming or deleting any route breaks the build at every binding site; main_test.go proves it. Symbol bindings pin the handler name in the committed generated code, so a rename breaks `go build` immediately; constructor bindings break at the next `ghtmx generate` (which watch and CI keep in the loop).
Index ¶
- Variables
- func ClearCompleted(w http.ResponseWriter, r *http.Request)
- func CreateTodo(w http.ResponseWriter, r *http.Request)
- func DeleteTodo(w http.ResponseWriter, r *http.Request)
- func EditTodo(w http.ResponseWriter, r *http.Request)
- func Index(w http.ResponseWriter, r *http.Request)
- func ListTodos(w http.ResponseWriter, r *http.Request)
- func RenameTodo(w http.ResponseWriter, r *http.Request)
- func Routes() *http.ServeMux
- func TodoStats(w http.ResponseWriter, r *http.Request)
- func ToggleAllTodos(w http.ResponseWriter, r *http.Request)
- func ToggleTodo(w http.ResponseWriter, r *http.Request)
- type Store
- type Todo
Constants ¶
This section is empty.
Variables ¶
var StoreSelector func(*http.Request) *Store
StoreSelector lets an embedder scope the demo's state per request — the docs site keys it by a visitor cookie so no two visitors share a list. Nil (the default, and the reference wiring) means the single shared package store. Install it before serving; handlers read it on every request.
Functions ¶
func ClearCompleted ¶
func ClearCompleted(w http.ResponseWriter, r *http.Request)
ClearCompleted deletes every done todo and returns the refreshed list.
func CreateTodo ¶
func CreateTodo(w http.ResponseWriter, r *http.Request)
CreateTodo adds a todo, announces it through the event contract, and returns the refreshed list fragment.
func DeleteTodo ¶
func DeleteTodo(w http.ResponseWriter, r *http.Request)
DeleteTodo removes a todo; the empty response with an outerHTML swap removes the row client-side.
func EditTodo ¶
func EditTodo(w http.ResponseWriter, r *http.Request)
EditTodo swaps a row for its inline edit form.
func ListTodos ¶
func ListTodos(w http.ResponseWriter, r *http.Request)
ListTodos is the FR-035 demonstration: a browser navigating to /todos gets the full page, an htmx refresh gets the bare list — the adapter selects the mode from the request. The filter buttons call the same bound route with hx-vals, so the view narrows without any hand-written URL.
func RenameTodo ¶
func RenameTodo(w http.ResponseWriter, r *http.Request)
RenameTodo saves an edited title and swaps the row back.
func TodoStats ¶
func TodoStats(w http.ResponseWriter, r *http.Request)
TodoStats renders the stats panel fragment.
func ToggleAllTodos ¶
func ToggleAllTodos(w http.ResponseWriter, r *http.Request)
ToggleAllTodos flips the whole list at once and announces the bulk change through one merged event.
func ToggleTodo ¶
func ToggleTodo(w http.ResponseWriter, r *http.Request)
ToggleTodo flips a todo's done state and returns its refreshed row.