~/talk

From Bland to Spiky: How Generics Made My Service Super Robust

Talkat GoLab 2024 · 2024-11-11..11-13· [go]
links:none on file
slides:none on file

Built a REST service using Go generics across API, service and GORM database layers to replace a dozen near-identical CRUD endpoints, avoiding switch payload.(type) and code generation. Uses Go generics (post‑1.18), fuo for OpenAPI, UUIDs for IDs, and saves items for address/name/dateOfBirth models into separate tables; implemented generic factory pattern with required getBase/setBase helpers and lightweight casting. Added toModel/toResponse request/response wrappers for frontend shape changes. The system works in production, mobile clients are satisfied, and compile/runtime overhead is negligible.

AI-written summary · about

  1. 0:00Introduction and speaker intro
  2. 1:30Problem with legacy API
  3. 4:02Service design goals
  4. 7:16Why generics were needed
  5. 9:24Failed template approach
  6. 11:33Generics 101 crash course
  7. 14:25First generic implementation
  8. 17:00Interface and base model
  9. 19:37Third iteration with constraints
  10. 22:09Database layer integration
  11. 23:36Testing and validation
  12. 24:10Hedgehog factory success
  13. 25:58Mobile app requirements change
  14. 28:34Fourth iteration for responses
  15. 31:09Final working solution
  16. 33:00Lessons learned and benefits
  17. 36:56Q&A session
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.