Categorygithub.com/umemak/eventsite_go
repository
0.0.0-20230701024239-9ddcce93fd0a
Repository: https://github.com/umemak/eventsite_go.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

eventsite_go

graph TB

user --> WebApp

WebApp -- :8081 --> API

subgraph backend
  developer --> DDL
  developer --> SQL
  developer --> OpenAPI.yml
  OpenAPI.yml -.-> openapi-generator
  SQL -.-> sqlc
  DDL -.-> sqlc
  sqlc -.-> API
  admin -- :8080 --> adminer
  API -- :3306 --> MySQL
  adminer -- :3306 --> MySQL
  subgraph docker-compose
    MySQL
    API
    adminer
  end
end

subgraph frontend
  FEdeveloper --> WebApp
end

openapi-generator -. server .-> API
openapi-generator -. client .-> WebApp

DDL --> MySQL

Generate OpenAPI Server

MSYS_NO_PATHCONV=1 docker run --rm \
  -v ${PWD}:/local openapitools/openapi-generator-cli generate \
  -t /local/template \
  -i /local/openapi.yml \
  -g go-server \
  --additional-properties=router=chi,featureCORS=true \
  -o /local/out
MSYS_NO_PATHCONV=1 docker run --rm \
  -v ${PWD}:/local openapitools/openapi-generator-cli author template \
  -g go-server \
  -o /local/template

openapi-generator author template -g java --library webclient

Generate Frontend

npx create-next-app@latest --ts frontend

Generate OpenAPI Client

MSYS_NO_PATHCONV=1 docker run --rm \
  -v "${PWD}:/local" openapitools/openapi-generator-cli generate \
  -i /local/openapi.yml \
  -g typescript-axios \
  -o /local/frontend/openapi

--additional-properties=modelPropertyNaming=camelCase,supportsES6=true,withInterfaces=true,typescriptThreePlus=true \

参考

Generate sqlc

sqlc generate

Install sqlc

go install github.com/kyleconroy/sqlc/cmd/[email protected]

https://github.com/kyleconroy/sqlc/issues/1385