How leoneville/gopportunities works
This repository implements a job-opening HTTP API. A client request enters through the Gin router, is dispatched to a CRUD handler, validated where applicable, and reads or writes an opening in SQLite before the handler formats a JSON response. The API also exposes Swagger UI. Configuration and handler initialization are shown, but the implementation of the top-level configuration and router initializers is not excerpted, so those internal links are left unverified where necessary.
Main entry points: routes.go API routes · opening.go Opening model · createOpening.go Create opening · updateOpening.go Update opening
Components 17
Startup and routing
- Application startup
main.go - Configuration init
config/config.go - HTTP router
router/router.go - API routes
router/routes.go
Opening operations
- Create opening
handler/createOpening.go - List openings
handler/listOpenings.go - Show opening
handler/showOpening.go - Update opening
handler/updateOpening.go - Delete opening
handler/deleteOpening.go
Persistence and model
- SQLite initialization
config/sqlite.go - SQLite database
- Opening model
schemas/opening.go
API support
- Request validation
handler/request.go - JSON responses
handler/response.go - Handler initialization
handler/handler.go - Swagger documentation
docs/docs.go
Other components
- API client
Connections 31
- API client → HTTP router: sends requests
- Application startup → Configuration init: initializes
main.go - Application startup → HTTP router: starts
main.go - HTTP router → API routes: registers routes
- API routes → Create opening: dispatches POST
router/routes.go - API routes → Show opening: dispatches GET
router/routes.go - API routes → List openings: dispatches GET
router/routes.go - API routes → Update opening: dispatches PUT
router/routes.go - API routes → Delete opening: dispatches DELETE
router/routes.go - API routes → Handler initialization: initializes handlers
router/routes.go - API routes → Swagger documentation: serves UI
router/routes.go - Handler initialization → SQLite initialization: gets database
- SQLite initialization → SQLite database: opens and migrates
config/sqlite.go - SQLite initialization → Opening model: migrates model
config/sqlite.go - Create opening → Request validation: validates input
handler/createOpening.go - Update opening → Request validation: validates input
handler/updateOpening.go - Create opening → SQLite database: creates record
handler/createOpening.go - List openings → SQLite database: queries records
handler/listOpenings.go - Show opening → SQLite database: reads record
handler/showOpening.go - Update opening → SQLite database: reads and saves
handler/updateOpening.go - Delete opening → SQLite database: reads and deletes
handler/deleteOpening.go - Create opening → Opening model: uses model
handler/createOpening.go - List openings → Opening model: uses model
handler/listOpenings.go - Show opening → Opening model: uses model
handler/showOpening.go - Update opening → Opening model: uses model
handler/updateOpening.go - Delete opening → Opening model: uses model
handler/deleteOpening.go - Create opening → JSON responses: formats JSON
handler/createOpening.go - List openings → JSON responses: formats JSON
handler/listOpenings.go - Show opening → JSON responses: formats JSON
handler/showOpening.go - Update opening → JSON responses: formats JSON
handler/updateOpening.go - Delete opening → JSON responses: formats JSON
handler/deleteOpening.go