VSCode - Disable go test cache
摘要:or Adding "-count=1" to "go.testFlags" can disable go test cache.
阅读全文
PostgreSQL - Change Timezone
摘要:The default timezone of a newly created database is UTC. You can set the timezone to a new value sessionly or globally: zzh@ZZHPC:~$ docker exec -it p
阅读全文
SQLC - Problem: can't recognize the numeric data types in PostgreSQL
摘要:Problem: sqlc can't recognize PostgreSQL data types numeric and decimal with the default database driver package database/sql, it makes them string. U
阅读全文
SQLC - Installation
摘要:go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest zzh@ZZHPC:~
sqlcversionv1.24.0zzh@ZZHPC:/zdata/Github/zimplebank sqlc init sqlc.yaml is added
阅读全文
PostgreSQL - Execute sql file using psql
摘要:zzh@ZZHPC:~
sudoaptinstallpostgresql−clientzzh@ZZHPC: psql --version psql (PostgreSQL) 14.9 (Ubuntu 14.9-0ubuntu0.22.04.1) zzh@ZZHPC:~$ psql po
阅读全文
Makefile - Error: Makefile:2: *** missing separator. Stop.
摘要:Got below error: Makefile:2: *** missing separator. Stop. Check the Makefile using cat -e -t -v: zzh@ZZHPC:/zdata/Github/zimplebank$ cat -vE -t Makefi
阅读全文
VI - Global Replacement
摘要:Global replacement really uses two ex commands: :g (global) and :s (substitute). Since the syntax of global replacement commands can get fairly comple
阅读全文
Ubuntu - Check Ubuntu Version
摘要:zzh@ZZHPC:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.3 LTS Release: 22.04 Codename: jammy zzh@ZZ
阅读全文
VSCode - Column Editing Mode
摘要:The keyboard shortcut "Ctrl+Shift+L" used to work well to get into column editing mode, but it isn't working now. Checking the shortcut: Deleting the
阅读全文
OpenSSL - Generate random string
摘要:zzh@ZZHPC:~$ openssl rand -hex 64 273fabd76b8dd62621325e4b04af332dd739702ae553ffc034a4af205faedbfee21202d3808e3640770b682c151aaa8308871533572d60947724
阅读全文
PostgreSQL - Transaction Isolation Level
摘要:zzh@ZZHPC:~$ docker run --name postgres16 -p 5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=aaa -d postgres:alpine 8e36b7bdc47572723a416c319b83f
阅读全文
MySQL - Transaction Isolation Levels
摘要:REPEATABLE READ (default) READ COMMITTED READ UNCOMMITTED SERIALIZABLE zzh@ZZHPC:~$ docker run --name mysql8 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=aaa -
阅读全文
Makefile - What is a Makefile and how does it work?
摘要:If you want to run or update a task when certain files are updated, the make utility can come in handy. The make utility requires a file, Makefile (or
阅读全文
Docker - Run PostgreSQL
摘要:zzh@ZZHPC:~
dockerpullpostgres:alpinezzh@ZZHPC: docker images REPOSITORY TAG IMAGE ID CREATED SIZE postgres alpine 642d75c6be0c 9 days ago 245MB
阅读全文
GRPC - TLS Credentials
摘要:Adding certificate information to a server implementation is twofold: implement logic to load credentials and create a TransportCredentials(http://mng
阅读全文
OpenSSL - Certificate Generation
摘要:zzh@ZZHPC:~$ openssl req --help Usage: req [options] General options: -help Display this summary -engine val Use engine, possibly a hardware device -k
阅读全文
Microservice- Resiliency patterns: Circuit Breaker Pattern
摘要:The retry pattern works well for covering transient failures, but if we don’t know how long the problem will last, we may end up putting a high load o
阅读全文
Microservice- Resiliency patterns: Retry Pattern
摘要:Retry Pattern Transient faults occur when a momentary loss of service functionality self-corrects. The retry pattern in gRPC enables us to retry a fai
阅读全文
Microservice- Resiliency patterns: Timeout Pattern
摘要:Timeout Pattern What is context.Context? The context in Go enables you to specify deadlines, cancellation signals, or key-value pairs available betwee
阅读全文
Docker - Run MySQL
摘要:zzh@ZZHPC:~$ docker run -p 3306:3306 -e MYSQL_ROOT_PASSWORD=verysecretpass -e MYSQL_DATABASE=order mysql In this case, our data source URL isroot:very
阅读全文
Microservice - Project folder structure for hexagonal architecture
摘要:grpc.go is for defining the handlers, and server.go mostly runs the server and register endpoints inside the grpc.go file. While there are no written
阅读全文
Microservice - Hexagonal Architecture
摘要:Hexagonal architecture (https://alistair.cockburn.us/hexagonal-architecture/), proposed by Alistair Cockburn in 2005, is an architectural pattern that
阅读全文
Protobuf - Protocol Buffer Compiler
摘要:zzh@ZZHPC:~
sudoaptinstall−yprotobuf−compilerzzh@ZZHPC:/zdata/Github/zimplebank protoc --versionlibprotoc 3.12.4 This version is too old. zzh@Z
阅读全文
Protobuf - FIELD NUMBERS
摘要:Required fields in a message can be thought of as frequently used fields since you cannot skip them as you can for optional fields. It is a best pract
阅读全文
Microservice - Data Consistency
摘要:To have data consistency in a distributed system, you have two options: a two-phase commit (2PC) and saga. 2PC coordinates all the processes that form
阅读全文