Giter Club home page Giter Club logo

simplebank's Introduction

This is based on a youtube series https://youtu.be/rx6CPDK_5mU?si=_gupEzl0PzUwhWrx

The Diagram for the postgress database was made on https://dbdiagram.io/

docker pull postgres:16.2-alpine

docker run --name postgres16.2 -p 5431:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=secret -d postgres:16.2-bullseye

docker exec -it postgres16.2 psql -U root

docker inspect
-f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' postgres16.2

migrate create -ext sql -dir db/migration -seq init_schema // mkdir -p db/migration

Make file add the commands, make sure of *Tabs instead of spaces

Running the migrate command to create the initial schema migrate -path db/migration --database "postgresql://root:secret@localhost:5431/simple_bank?sslmode=disable" -verbose up

Install sqlc 'brew install sqlc"

ACID Atomicity Either all operations complete successfully or none do. Consistency The db state must be valid after the transaction. All constraints must be satisfied Isolation Concurrent transactions cannot affect each other

Durability Data written by a sucessful transaction must be permanent

Completed all the tests of CRUD and ACID

Set up github actions with creating .github/workflows/ci.yaml file

Setup api using golang and gin
// https://github.com/gin-gonic/gin

Used viper for reading app.env and loading a config file // https://github.com/spf13/viper

Mocking database with mockgen https://github.com/uber-go/mock

To generate the mockdb use command make mock

To create branch to move on with git checkout -b ft/docker

Create the Docker file, making sure that you create a small image by building in stages

to remove built images use Docker rmi "image id" to stop built running containers use Docker stop "container id" to remove built containers use Docker rm "container id"

to start running containers use docker run --name simplebank -p 8080:8080 -e GIN_MODE=release -e DB_SOURCE="postgresql://root:[email protected]/simple_bank?sslmode=disable" simplebank:latest

simplebank's People

Contributors

adeflesk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.