How divineninja/usld-go-api works
This Go service exposes one listings endpoint: an HTTP client requests listings, the handler queries the MySQL-backed listing view, checks a short-lived in-memory response cache, maps rows into listing JSON, and returns the response. Startup initializes the database from environment variables and registers the route. The tree and sampled source show no other product workflows; the DTO file defines response fields and conversion helpers, though the handler performs its own row mapping.
Main entry points: listing.go Listings handler · db.go MySQL initialization · main.go Service startup · listing_cache.go Response cache
Components 9
HTTP service
- Service startup
go/main.go - Listings handler
go/api/listing.go - Listing response DTO
go/api/listing_dto.go
Listing data
- Response cache
go/api/listing_cache.go - MySQL initialization
go/db/db.go
Other components
- HTTP client
- MySQL database
- Environment variables
- JSON response
Connections 11
- Service startup → MySQL initialization: initializes
- Environment variables → MySQL initialization: configures
- MySQL initialization → MySQL database: opens connection
- Service startup → Listings handler: registers route
- HTTP client → Listings handler: requests listings
- Listings handler → MySQL database: queries listing view
- Listings handler → Response cache: reads cache
- Listings handler → Response cache: writes response
- Listings handler → Listing response DTO: uses conversion helpers
- Listings handler → JSON response: marshals and writes
- JSON response → HTTP client: returns JSON