SimpleBank

command module
v0.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 6 Imported by: 0

README

SimpleBank

Section Database


  1. DB Migration lib
$ # Go 1.16+
$ go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@$TAG
  1. migration in sqlc
  • sqlc does not perform database migrations for you. However, sqlc is able to differentiate between up and down migrations. sqlc ignores down migrations when parsing SQL files.

  • sqlc supports parsing migrations from the following tools:

    • dbmate
    • golang-migrate
    • goose
    • sql-migrate
    • tern
  1. comparing database/sql package, gorm, sqlx, and sqlc
  1. Transaction
  • A transaction is a single logical unit of work that accesses and possibly modifies the contents of a database. Transactions access data using read and write operations.
  • In order to maintain consistency in a database, before and after the transaction, certain properties are followed. These are called ACID properties.

https://www.geeksforgeeks.org/acid-properties-in-dbms/

  1. sql anomaly
  1. Deadlock in database

    In a database, a deadlock is a situation in which two or more transactions are waiting for one another to give up locks. For example, Transaction A might hold a lock on some rows in the Accounts table and needs to update some rows in the Orders table to finish.

  2. Github CI

Section RESTFful API


  1. Gin
  1. Viper Viper lib For Easy configuration File management tools https://github.com/spf13/vigo-per

  2. Mock Testing Mock testing are using "White Box" testing techniques, used to testing every functional func in code. https://github.com/golang/mock

  3. Testing Method TDD / BDD / ATDD

  • TDD (test-driven development) approach with step:
    • First creating failing unit test.
    • Then start implementing unit test with MINIMAL code until all unit test condition are satisfied.
    • Last testing are passed, programmer refactor the design & making an improvement without changing the behavior from second step.
  • TDD in short explanation:
    • TDD steps :
      • Create unit test(Code) that including all process nedeed/writen.
      • Test unitTest (Failed result test).
      • Then repeating changes/implement code until all test are passed.
      • Done TDD cycle.
    • TDD Auidence are programmer-side since it's focuses more on code implementation of a feature.
    • TDD are more likely realted to "White Box" testing techniques.
  • BDD (Behavioral-Driven Development) are derived/similar from TDD but using the Given-When-Then approach is used for writing test cases. Some Given-When-Then example:

    • Given the user has entered valid login credentials
    • When a user clicks on the login button
    • Then display the successful validation message
  • BDD in short explanation:

    • BDD Steps are similar to TDD but "unit test" test are changed to Behavioral test that writen and describe in human language (ex:English).
    • BDD Auidence are more wide to other than programmer team, because main focus on Understanding Requirements.
    • BDD are more likely realted to "Black Box" testing techniques.
  • ATDD (Acceptance Test-Driven development) are similar with BDD focuses more on the behavior of the feature, whereas ATDD focuses on capturing the precise requirements. ATDD in short explanation:

    • BDD are still very similar to BDD testing techniques but focusing in More detailed an precise requirements at development feature.

https://www.techtarget.com/searchsoftwarequality/definition/test-driven-development https://www.browserstack.com/guide/tdd-vs-bdd-vs-atdd

  1. PASETO

Section Deploying aplication


  1. Docker iamges tag :
  1. Docker build Documentation:
  1. Connecting docker container with docker network
  • create a new docker network and listed images to network
  1. Create docker serveral docker images with docker-compose.yaml
  • With docker-compose.yaml we can automated creating serveral docker images and listed it to same network automaticly

ETC


Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
costumValidator
Costum validator for json request
Costum validator for json request
db
mock
Package mockdb is a generated GoMock package.
Package mockdb is a generated GoMock package.
Enum of currency that support in apps
Enum of currency that support in apps

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL