Skip to content

Go (golang) cookbook for common patterns and requirements

License

Notifications You must be signed in to change notification settings

ayubmalik/go-cookbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-cookbook

Go (golang) cookbook for common patterns and requirements e.g. PostgreSQL, logging, gRPC, JWT auth etc.

Each folder contains a specific example for a given use case and is described below.

Some examples use [https://docs.docker.com/compose/install/](Docker compose) to run servers e.g. postgres, so you should have it installed.

** Absolutely no guarantee that these examples are bug free or production ready! **

Cookbooks

Uses the standard library and postgres driver to read and write data, with a simple repository pattern. The entity/table is a simple NHS Pharmacy object taken from public UK data.

Uses docker compose and PostgreSQL to create the tables.

See https://pkg.go.dev/database/sql

Uses the popular https://github.com/jackc/pgx library and postgres driver to read and write data, with a simple repository pattern. The entity/table is a simple NHS Pharmacy object taken from public UK data.

Uses docker compose and PostgreSQL to create the tables.

Same as sql-pgx, but uses a custom connection pool instead of pgx.Connect() method

Use standard library logger to set various formatting options and also how to write to a file, and both std out and file

Use the Uber Zap framework with development and production mode example.

MQTT examples to connect to AWS IOT using Eclipse Paho library. You will need an AWS account etc etc.

Using standard lib to create a SHA256 hash from io.Reader and example test.

slice tricks

Cribbed from here the Go Wiki, just some common slice usages/tricks.

About

Go (golang) cookbook for common patterns and requirements

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages