package infra import ( "database/sql" "net/http" ) // CRUDGenerateHandlers construye los 5 handlers CRUD (list, get, create, update, delete) // a partir de una definicion CRUDResource y una conexion *sql.DB, y los retorna como // un mapa con claves "list", "get", "create", "update", "delete". // // La funcion es pura (no hace I/O por si misma) — solo construye closures. Los handlers // retornados son impuros cuando se invocan. func CRUDGenerateHandlers(res CRUDResource, db *sql.DB) map[string]http.HandlerFunc { return map[string]http.HandlerFunc{ "list": CRUDListHandler(res, db), "get": CRUDGetHandler(res, db), "create": CRUDCreateHandler(res, db), "update": CRUDUpdateHandler(res, db), "delete": CRUDDeleteHandler(res, db), } }