This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { "name": "สมชาย", "used_days": 3, "request_date": "2026-01-05" }, | |
| { "name": "สมหญิง", "used_days": 9, "request_date": "2026-01-06" }, | |
| { "name": "สมศักดิ์", "used_days": 5, "request_date": "2026-01-11" } | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function findStringInList(s, list) { | |
| let controlFlag = false | |
| for (let i = 0; i < list.length; i++) { | |
| if (controlFlag == false) | |
| if (list[i] === s) | |
| controlFlag = true | |
| console.log("Found") | |
| } | |
| if (controlFlag === false) | |
| console.log("Not Found") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package go_docker_sandbox | |
| import ( | |
| "testing" | |
| ) | |
| func TestConnectDB(t *testing.T) { | |
| db := ConnectDB() | |
| if db == nil { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE IF NOT EXISTS product (id SERIAL PRIMARY KEY , name TEXT , price INTEGER); | |
| Insert into product (name, price) values ('SomeProduct' , 3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "3.3" | |
| services: | |
| test_sandbox: | |
| build: | |
| context: . | |
| dockerfile: ./Dockerfile | |
| volumes: | |
| - .:/app | |
| depends_on: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package go_docker_sandbox | |
| import ( | |
| "database/sql" | |
| "log" | |
| _ "github.com/lib/pq" | |
| ) | |
| func ConnectDB() *sql.DB { | |
| url := "postgres://root:root@db/go-example-db?sslmode=disable" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM golang:1.19-alpine | |
| WORKDIR /app | |
| CMD CGO_ENABLED=0 go test -v ./... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM golang:1.19-alpine | |
| WORKDIR /app | |
| COPY . . | |
| CMD CGO_ENABLED=0 go test -v ./... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package go_docker_sandbox | |
| import "testing" | |
| func TestSum(t *testing.T) { | |
| result := Sum(1, 2) | |
| want := 3 | |
| if result != want { | |
| t.Errorf("Want '%d' result '%d'", want, result) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package go_docker_sandbox | |
| func Sum(a, b int) int { | |
| return a + b | |
| } |
NewerOlder