The repository contains a TODO microservice written in Go, using modern approaches, domain driven designs(DDD), idiomatic coding styles and integration with Hashicorp Vault, ElasticSeach, Kafka and many more modern tools.
The application uses some features in supported in Go 1.16+
- usage of embed to bundle static files
os.WriteFile
to write files
# runs and manages sql migration both from CLI and programatically.
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/[email protected]
# converts sql queries into type-safe golang code.
go install github.com/kyleconroy/sqlc/cmd/[email protected]
# creates mock of any interface, basic usgage for unit testing.
go install github.com/maxbrunsfeld/counterfeiter/v6
# generate open api 3 client and types from spec.
go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen
OpenAPI is a specification to document REST API's in standard format, while Swagger offer tools to implement these specifications. Read more anout OpenAPI and swagger here.
Some Blog post covering implementation of swagger in go
- For OpenAPI 2 diff b/w go-swagger and swag - covers pros and cons of both packages.
- serving swagger ui in go - how to setup swagger ui for different frameworks in go.
- detailed impl with go-swagger - have a detailed impl with go-swagger
- openapi - covers about open api.
Some tools and packages availiable
- oapi-codegen - generate client and types for openAPI 3 spec
- swag - easy tool to get openAPI 2 specs
- go-swagger - for openAPI 2
- kin-openapi - create and generate source files
- swagger-ui - download ui files from here
To embed the static-ui, embed
is required. Detail explanantion covered here
For better yaml parsing, used this pkg instead of native marshaler.
Akshit Sadana [email protected]
- Github: @Akshit8
- LinkedIn: @akshitsadana