--- name: crud_generate_handlers kind: function lang: go domain: infra version: "1.0.0" purity: pure signature: "func CRUDGenerateHandlers(res CRUDResource, db *sql.DB) map[string]http.HandlerFunc" description: "Compone los 5 handlers CRUD (list, get, create, update, delete) en un mapa con claves estandar. La funcion factory es pura — solo construye closures a partir de la definicion y la conexion de bd. Los handlers resultantes son impuros al invocarse." tags: [crud, factory, handlers, compose, http, infra] uses_functions: [crud_list_handler_go_infra, crud_get_handler_go_infra, crud_create_handler_go_infra, crud_update_handler_go_infra, crud_delete_handler_go_infra] uses_types: [CRUDResource_go_infra] returns: [] returns_optional: false error_type: "" imports: [database/sql, net/http] params: - name: res desc: "definicion CRUDResource del recurso" - name: db desc: "conexion *sql.DB a SQLite" output: "map con keys 'list', 'get', 'create', 'update', 'delete' -> http.HandlerFunc" tested: true tests: ["retorna las 5 keys esperadas", "cada handler funciona end-to-end"] test_file_path: "functions/infra/crud_test.go" file_path: "functions/infra/crud_generate_handlers.go" --- ## Ejemplo ```go handlers := CRUDGenerateHandlers(res, db) mux.Handle("GET /api/projects", handlers["list"]) mux.Handle("POST /api/projects", handlers["create"]) ``` ## Notas Funcion pura — solo ensambla closures. Para registrar todas las rutas en un paso, ver CRUDRegisterRoutes. El mapa incluye exactamente las claves list, get, create, update, delete (en minuscula).