valuations-api

module
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: Apache-2.0

README

valuations-api

Api for obtaining and querying vehicle valuations.

Developing locally

TL;DR

cp settings.sample.yaml settings.yaml
docker compose up -d
go run ./cmd/valuations-api

Create DB locally: create database valuations_api with owner dimo;

GRPC Generating client and server code

  1. Install the protocol compiler plugins for Go using the following commands
brew install protobuf
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
  1. Run protoc in the root directory
protoc --go_out=. --go_opt=paths=source_relative \
    --go-grpc_out=. --go-grpc_opt=paths=source_relative \
    pkg/grpc/*.proto

Linting

brew install golangci-lint

golangci-lint run

This should use the settings from .golangci.yml, which you can override.

If brew version does not work, download from https://github.com/golangci/golangci-lint/releases (darwin arm64 if M1), then copy to /usr/local/bin and sudo xattr -c golangci-lint

Make sure you're running the docker image (ie. docker compose up)

If you get a command not found error with sqlboiler, make sure your go install is correct. Instructions here

Local development

Swagger

Generate swagger docs: swag init -g cmd/valuations-api/main.go --parseDependency --parseInternal --generatedTime true

Requirements: go install github.com/swaggo/swag/cmd/swag@latest

Migrations

goose -dir internal/infrastructure/db/migrations create slugs_not_null sql

Run the migrations up: go run ./cmd/valuations-api migrate

Regen the models: sqlboiler psql --no-tests --wipe

Directories

Path Synopsis
cmd
Package docs Code generated by swaggo/swag at 2024-04-19 15:40:00.736438 -0400 EDT m=+1.328499084.
Package docs Code generated by swaggo/swag at 2024-04-19 15:40:00.736438 -0400 EDT m=+1.328499084.
internal
api
core/commands/mocks
Package mock_commands is a generated GoMock package.
Package mock_commands is a generated GoMock package.
core/services/mocks
Code generated by MockGen.
Code generated by MockGen.
rpc
pkg

Jump to

Keyboard shortcuts

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