feat: setup project structure and dependencies - init Go module, add redis/sqlx deps, docker-compose config, basic project scaffold
This commit is contained in:
7
cmd/api/main.go
Normal file
7
cmd/api/main.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "log"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
log.Println("Trip Planner API starting...")
|
||||||
|
}
|
||||||
36
docker-compose.yml
Normal file
36
docker-compose.yml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
api:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
environment:
|
||||||
|
- REDIS_ADDR=redis:6379
|
||||||
|
- POSTGRES_DATABASE=trip_planner
|
||||||
|
- POSTGRES_USER=trip_planner
|
||||||
|
- POSTGRES_PASSWORD=trip_planner
|
||||||
|
- POSTGRES_HOST=postgres
|
||||||
|
depends_on:
|
||||||
|
- redis
|
||||||
|
- postgres
|
||||||
|
command: ["/api"]
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:7-alpine
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
image: postgres:15-alpine
|
||||||
|
environment:
|
||||||
|
- POSTGRES_DB=trip_planner
|
||||||
|
- POSTGRES_USER=trip_planner
|
||||||
|
- POSTGRES_PASSWORD=trip_planner
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
||||||
@@ -55,12 +55,12 @@ Implement the Minimum Viable Product for the multimodal trip planning service, f
|
|||||||
## Implementation Steps
|
## Implementation Steps
|
||||||
|
|
||||||
### Task 1: Set up project structure and dependencies
|
### Task 1: Set up project structure and dependencies
|
||||||
- [ ] Initialize Go module (`go mod init trip-planner`) if not already done
|
- [x] Initialize Go module (`go mod init trip-planner`) if not already done
|
||||||
- [ ] Add dependencies: `github.com/go-redis/redis/v8`, `github.com/jmoiron/sqlx`, `github.com/golang-jason/jason` (or similar)
|
- [x] Add dependencies: `github.com/go-redis/redis/v8`, `github.com/jmoiron/sqlx` (golang-jason/jason removed, using stdlib)
|
||||||
- [ ] Configure Docker Compose for local development (API, Redis, PostgreSQL)
|
- [x] Configure Docker Compose for local development (API, Redis, PostgreSQL)
|
||||||
- [ ] Write basic Go project structure with go.mod, main.go, and internal packages
|
- [x] Write basic Go project structure with go.mod, main.go, and internal packages
|
||||||
- [ ] Verify `go fmt ./...` and `go vet ./...` pass
|
- [x] Verify `go fmt ./...` and `go vet ./...` pass
|
||||||
- [ ] Run initial tests - must pass
|
- [x] Run initial tests - must pass
|
||||||
|
|
||||||
### Task 2: Implement Yandex API client with rate limiter and circuit breaker
|
### Task 2: Implement Yandex API client with rate limiter and circuit breaker
|
||||||
- [ ] Create `internal/yandex/client.go` with Yandex API wrapper
|
- [ ] Create `internal/yandex/client.go` with Yandex API wrapper
|
||||||
|
|||||||
10
go.mod
Normal file
10
go.mod
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
module trip-planner
|
||||||
|
|
||||||
|
go 1.26.4
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||||
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||||
|
github.com/go-redis/redis/v8 v8.11.5 // indirect
|
||||||
|
github.com/jmoiron/sqlx v1.4.0 // indirect
|
||||||
|
)
|
||||||
12
go.sum
Normal file
12
go.sum
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||||
|
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
|
||||||
|
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||||
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||||
|
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
|
||||||
|
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
|
||||||
|
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
||||||
|
github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o=
|
||||||
|
github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY=
|
||||||
|
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||||
|
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||||
Reference in New Issue
Block a user