-
ZIMP - Unit Test error 2
摘要:RUN TestTransferTx store_test.go:87: Error Trace: /home/runner/work/zimplebank/zimplebank/db/sqlc/store_test.go:87 Error: Not equal: expected: 20 actu
阅读全文
-
AWS - Grant AWS EKS cluster access to Postgres and Redis using security group
摘要:EKS Cluster: RDS (Postgres): Rdis Cluster:
阅读全文
-
ZIMP - import error
摘要:import "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway" is a program, not an importable packagego list package _ ("github.com/grpc-
阅读全文
-
ZIMP - Unit test timed out because of mock
摘要:Running tool: /usr/local/go/bin/go test -timeout 30s -run ^TestCreateUserAPI$ github.com/ZhangZhihuiAAA/zimplebank/gapi -count=1 -v RUN TestCreateUser
阅读全文
-
ZIMP - Unit Test Error 1
摘要:Running tool: /usr/local/go/bin/go test -timeout 30s -run ^TestCreateUserAPI$ github.com/ZhangZhihuiAAA/zimplebank/gapi -count=1 -v RUN TestCreateUser
阅读全文
-
Shell - Pass output as argument to next command
摘要:In bash we can pass the output of one command to the next one as an argument. We will cover multiple examples. xargs is very useful for passing inform
阅读全文
-
ZIMP - 126邮件POP3,SMTP服务器与端口设置
摘要:gmailSmtpAuthAddress = "smtp.gmail.com" gmailSmtpServerAddress = "smtp.gmail.com:587" smtpAuthAddress = "smtp.126.com" smtpServerAddress = "smtp.126.c
阅读全文
-
ZIMP - zerolog
-
Postman - Collection Variables
-
ZIMP - statik error: no zip data registered
摘要:zzh@ZZHPC:/zdata/Github/zimplebank$ make server go run main.go 2023/12/24 20:57:39 failed to create statik fs:statik/fs: no zip data registered exit s
阅读全文
-
ZIMP - Display API Docs using swagger-ui
摘要:zzh@ZZHPC:/zdata/Github$ git clone https://github.com/swagger-api/swagger-ui.git Cloning into 'swagger-ui'... remote: Enumerating objects: 41700, done
阅读全文
-
ZIMP - import error
摘要:Only copying the annotations.proto file is not enough. Copying all .proto files under grpc-gateway/protoc-gen-openapiv2/options will fix this issue:
阅读全文
-
Evans - A GPRC Client
摘要:zzh@ZZHPC:~$ evans --help evans 0.10.11 Usage: evans [global options ...] <command> Options: --silent, -s hide redundant output (default "false") --pa
阅读全文
-
VSCode - proto3 extention
摘要:The above proto3 isn't stable, it can't recognize syntax errors or import errors timely. Change to this one:
阅读全文
-
ZIMP - Session Management
摘要:Access token is for short duration access. Refresh token is for medium duration access, saved in database.
阅读全文
-
ZIMP - dbml2sql
摘要:zzh@ZZHPC:/zdata/Github/zimplebank$ npm install -g @dbml/cli zzh@ZZHPC:/zdata/Github/zimplebank$ dbml2sql --help Usage: dbml2sql [options] <files...>
阅读全文
-
ZIMP - dbdocs
摘要:zzh@ZZHPC:~$ npm install -g dbdocs zzh@ZZHPC:~$ dbdocs login ? Choose a login method: Email ? Your email: ZhangZhihuiAAA@126.com ✔ Request email authe
阅读全文
-
ZIMP - Unit Test
摘要:func TestLoginUserAPI(t *testing.T) { user, password := randomUser(t) testCases := []struct { name string body gin.H buildStubs func(store *mockdb.Moc
阅读全文
-
Github Actions - Disable workflow
-
Github Actions - Error: The connection to the server localhost:8080 was refused - did you specify the right host or port?
摘要:Run kubectl apply -f eks/aws-auth.yaml kubectl apply -f eks/aws-auth.yaml kubectl apply -f eks/deployment.yaml kubectl apply -f eks/service.yaml shell
阅读全文
-
Github Actions - Error: Kubectl '1.29.0' for 'amd64' arch not found
摘要:Error: Kubectl '1.29.0' for 'amd64' arch not found Changing - name: Install kubectl uses: azure/setup-kubectl@v3 with: version: '1.28.2' # version of
阅读全文
-
ZURL
摘要:Markdown: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-
阅读全文
-
K8S - Add-on: cert-manager
摘要:https://cert-manager.io/docs/ cert-manager cert-manager adds certificates and certificate issuers as resource types in Kubernetes clusters, and simpli
阅读全文
-
K8S - Ingress
摘要:If we only have one service, we can easily add an A record in the domain in AWS Route 53. But it will be a pain when we have a lot more of them, becau
阅读全文
-
AWS - Route 53
-
AWS EKS - Cluster Creation
摘要:(default) Choose what logs to be sent to CloudWatch at cluster creation: (default)
阅读全文
-
k8s - Make a service can be accessed externally
摘要:apiVersion: v1 kind: Service metadata: name: zimple-bank-api-service spec: selector: app.kubernetes.io/name: zimple-bank-api ports: - protocol: TCP po
阅读全文
-
Go - error: panic: runtime error: invalid memory address or nil pointer dereference
摘要:Then looking at this code: res, err := client.Do(req) defer res.Body.Close() if err != nil { return nil, err } I'm guessing that err is not nil. You'r
阅读全文
-
AWS EKS: Node Group
摘要:The value of Desired Size of node group can be changed automatically by the value of Desired capacity of Auto scaling group: Better to edit node group
阅读全文
-
k8s - error: 0/1 nodes are available: 1 node(s) had untolerated taint
摘要:Warning FailedScheduling 89s default-scheduler 0/1 nodes are available: 1 node(s) had untolerated taint {node.cloudprovider.kubernetes.io │ │ /uniniti
阅读全文
-
k9s
摘要:Namespace - :ns Enter Pods in a namespace - select a namespace and press Enter All pods - :pod Enter Back to up level - press ESC Exit - :quit Enter S
阅读全文
-
AWS CLI - Access EKS cluster
摘要:zzh@ZZHPC:~$ aws eks update-kubeconfig --name zimple-bank --region ap-southeast-2 An error occurred (AccessDeniedException) when calling the DescribeC
阅读全文
-
AWS - Required permissions for a node group role
摘要:Before you create worker nodes, you must create an IAM role with the following IAM policies: AmazonEKSWorkerNodePolicy AmazonEKS_CNI_Policy AmazonEC2C
阅读全文
-
Kubernetes - Components
-
AWS CLI - ecr
摘要:zzh@ZZHPC:~$ aws ecr get-login-password xxxxxxxxxx zzh@ZZHPC:~$ aws ecr get-login-password | docker login --username AWS --password-stdin 793698357301
阅读全文
-
AWS CLI - secretsmanager
摘要:zzh@ZZHPC:~$ aws configure AWS Access Key ID [None]: xxxxxxxxxxxxxxxxxxxx AWS Secret Access Key [None]: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Defau
阅读全文
-
AWS - Sample Go code to use secrets
摘要:// Use this code snippet in your app. // If you need more information about configurations or implementing the sample code, visit the AWS docs: // htt
阅读全文
-
Github - Actions for AWS ECR
-
Docker Compose: depends_on
摘要:depends_on depends_on expresses startup and shutdown dependencies between services. Short syntax The short syntax variant only specifies service names
阅读全文
-
Go - Run a sql file on PostgreSQL using pgx
摘要:package main import ( "context" "log" "os" "github.com/jackc/pgx/v5/pgxpool" ) const DB_SOURCE = "postgresql://root:aaa@localhost:5432/zimple_bank?ssl
阅读全文
-
Dockerfile - CMD, ARG
摘要:CMD The CMD instruction has three forms: CMD ["executable","param1","param2"] (exec form, this is the preferred form) CMD ["param1","param2"] (as defa
阅读全文
-
PostgreSQL - Start a container with docker compose file
摘要:Docker compose file: services: postgres: image: postgres:16-alpine environment: - POSTGRES_USER=root - POSTGRES_PASSWORD=aaa - POSTGRES_DB=zimple_bank
阅读全文
-
PostgreSQL - error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
摘要:Got below error when createdb: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory This is bec
阅读全文
-
Docker - Remove build cache
摘要:docker builder prune Remove build cache Usage docker builder prune Description Remove build cache Options OptionShortDefaultDescription --all -a Remov
阅读全文
-
Docker: docker compose build --no-cache
摘要:docker compose build --no-cache docker compose up
阅读全文
-
Docker - Build an application to an image and run it
摘要:Dockerfile: # Build stage FROM golang:1.21.5-alpine3.18 AS builder WORKDIR /app COPY . . RUN go env -w GOPROXY=https://goproxy.io,direct RUN go build
阅读全文
-
Go - two bcrypt hashes of the same password are NOT equal
摘要:package main import ( "fmt" "golang.org/x/crypto/bcrypt" ) func main() { password := "abcdef" hashedPassword1, _ := bcrypt.GenerateFromPassword([]byte
阅读全文
-
Timezone - 0001-01-01 00:00:00 UTC
摘要:将一时间戳字段默认值设为0001-01-01 00:00:00 UTC,在timezone为东8区的数据库中字段值显示为: 0001-01-01 08:05:43+08:05:43 Google后找到如下解释: 0001-01-01 00:00:00 UTC. And that is indeed
阅读全文
-
ZIMP - Mock DB for testing HTTP API in go
摘要:https://github.com/uber-go/mock Install mockgen: zzh@ZZHPC:/zdata/Github/zimplebank$ go install go.uber.org/mock/mockgen@latest go: downloading go.ube
阅读全文
-
Viper - Read multiple config files
摘要:Viper uses github.com/mitchellh/mapstructure under the hood for unmarshaling values which uses mapstructure tags by default. supported extensions are
阅读全文
-
Postman - Create a Linux launcher icon
摘要:Create a file named Postman.desktop under ~/.local/share/applications with below content: [Desktop Entry] Type=Application Version=1.0 Name=Postman Co
阅读全文
-
Github Actions - Creating PostgreSQL service containers
摘要:# Service containers to run with `container-job` services: # Label used to access the service container postgres: # Docker Hub image image: postgres #
阅读全文
-
SQLC - Change Parameter Name
摘要:-- name: ListAccounts :many SELECT * FROM accounts WHERE owner = $1 ORDER BY id LIMIT $2 OFFSET $3; -- name: UpdateAccount :one UPDATE accounts SET ba
阅读全文
-
PostgreSQL - ERROR: deadlock detected
摘要:ERROR: deadlock detectedDETAIL: Process 209 waits for ShareLock on transaction 1034; blocked by process 201.Process 201 waits for ShareLock on transac
阅读全文
-
PostgreSQL - Check blocking SQL statements
摘要:pg_locks view Looking at pg_locks shows you what locks are granted and what processes are waiting for locks to be acquired. A good query to start look
阅读全文
|