From 8ee476ba9ab276b3c2069592a03bd20e883e37ad Mon Sep 17 00:00:00 2001 From: hanJoker Date: Sat, 3 Sep 2022 00:28:37 +0800 Subject: [PATCH] move driver from / to backend --- {driver => backend/driver}/Dockerfile | 0 {driver => backend/driver}/LICENSE | 0 {driver => backend/driver}/Makefile | 0 backend/driver/README.md | 52 ++++++++++++++++++- .../api/helloworld/v1/error_reason.pb.go | 0 .../api/helloworld/v1/error_reason.proto | 0 .../driver}/api/helloworld/v1/greeter.pb.go | 0 .../driver}/api/helloworld/v1/greeter.proto | 0 .../api/helloworld/v1/greeter_grpc.pb.go | 0 .../api/helloworld/v1/greeter_http.pb.go | 0 {driver => backend/driver}/cmd/driver/main.go | 0 {driver => backend/driver}/cmd/driver/wire.go | 0 .../driver}/cmd/driver/wire_gen.go | 0 .../driver}/configs/config.yaml | 0 {driver => backend/driver}/go.mod | 0 {driver => backend/driver}/go.sum | 0 .../driver}/internal/biz/README.md | 0 .../driver}/internal/biz/biz.go | 0 .../driver}/internal/biz/greeter.go | 0 .../driver}/internal/conf/conf.pb.go | 0 .../driver}/internal/conf/conf.proto | 0 .../driver}/internal/data/README.md | 0 .../driver}/internal/data/data.go | 0 .../driver}/internal/data/greeter.go | 0 .../driver}/internal/server/grpc.go | 0 .../driver}/internal/server/http.go | 0 .../driver}/internal/server/server.go | 0 .../driver}/internal/service/README.md | 0 .../driver}/internal/service/greeter.go | 0 .../driver}/internal/service/service.go | 0 {driver => backend/driver}/openapi.yaml | 0 .../driver}/third_party/README.md | 0 .../driver}/third_party/errors/errors.proto | 0 .../third_party/google/api/annotations.proto | 0 .../third_party/google/api/client.proto | 0 .../google/api/field_behavior.proto | 0 .../driver}/third_party/google/api/http.proto | 0 .../third_party/google/api/httpbody.proto | 0 .../third_party/google/protobuf/any.proto | 0 .../third_party/google/protobuf/api.proto | 0 .../google/protobuf/compiler/plugin.proto | 0 .../google/protobuf/descriptor.proto | 0 .../google/protobuf/duration.proto | 0 .../third_party/google/protobuf/empty.proto | 0 .../google/protobuf/field_mask.proto | 0 .../google/protobuf/source_context.proto | 0 .../third_party/google/protobuf/struct.proto | 0 .../google/protobuf/timestamp.proto | 0 .../third_party/google/protobuf/type.proto | 0 .../google/protobuf/wrappers.proto | 0 .../third_party/openapi/v3/annotations.proto | 0 .../third_party/openapi/v3/openapi.proto | 0 .../driver}/third_party/validate/README.md | 0 .../third_party/validate/validate.proto | 0 driver/.gitignore | 36 ------------- driver/README.md | 51 ------------------ 56 files changed, 51 insertions(+), 88 deletions(-) rename {driver => backend/driver}/Dockerfile (100%) rename {driver => backend/driver}/LICENSE (100%) rename {driver => backend/driver}/Makefile (100%) rename {driver => backend/driver}/api/helloworld/v1/error_reason.pb.go (100%) rename {driver => backend/driver}/api/helloworld/v1/error_reason.proto (100%) rename {driver => backend/driver}/api/helloworld/v1/greeter.pb.go (100%) rename {driver => backend/driver}/api/helloworld/v1/greeter.proto (100%) rename {driver => backend/driver}/api/helloworld/v1/greeter_grpc.pb.go (100%) rename {driver => backend/driver}/api/helloworld/v1/greeter_http.pb.go (100%) rename {driver => backend/driver}/cmd/driver/main.go (100%) rename {driver => backend/driver}/cmd/driver/wire.go (100%) rename {driver => backend/driver}/cmd/driver/wire_gen.go (100%) rename {driver => backend/driver}/configs/config.yaml (100%) rename {driver => backend/driver}/go.mod (100%) rename {driver => backend/driver}/go.sum (100%) rename {driver => backend/driver}/internal/biz/README.md (100%) rename {driver => backend/driver}/internal/biz/biz.go (100%) rename {driver => backend/driver}/internal/biz/greeter.go (100%) rename {driver => backend/driver}/internal/conf/conf.pb.go (100%) rename {driver => backend/driver}/internal/conf/conf.proto (100%) rename {driver => backend/driver}/internal/data/README.md (100%) rename {driver => backend/driver}/internal/data/data.go (100%) rename {driver => backend/driver}/internal/data/greeter.go (100%) rename {driver => backend/driver}/internal/server/grpc.go (100%) rename {driver => backend/driver}/internal/server/http.go (100%) rename {driver => backend/driver}/internal/server/server.go (100%) rename {driver => backend/driver}/internal/service/README.md (100%) rename {driver => backend/driver}/internal/service/greeter.go (100%) rename {driver => backend/driver}/internal/service/service.go (100%) rename {driver => backend/driver}/openapi.yaml (100%) rename {driver => backend/driver}/third_party/README.md (100%) rename {driver => backend/driver}/third_party/errors/errors.proto (100%) rename {driver => backend/driver}/third_party/google/api/annotations.proto (100%) rename {driver => backend/driver}/third_party/google/api/client.proto (100%) rename {driver => backend/driver}/third_party/google/api/field_behavior.proto (100%) rename {driver => backend/driver}/third_party/google/api/http.proto (100%) rename {driver => backend/driver}/third_party/google/api/httpbody.proto (100%) rename {driver => backend/driver}/third_party/google/protobuf/any.proto (100%) rename {driver => backend/driver}/third_party/google/protobuf/api.proto (100%) rename {driver => backend/driver}/third_party/google/protobuf/compiler/plugin.proto (100%) rename {driver => backend/driver}/third_party/google/protobuf/descriptor.proto (100%) rename {driver => backend/driver}/third_party/google/protobuf/duration.proto (100%) rename {driver => backend/driver}/third_party/google/protobuf/empty.proto (100%) rename {driver => backend/driver}/third_party/google/protobuf/field_mask.proto (100%) rename {driver => backend/driver}/third_party/google/protobuf/source_context.proto (100%) rename {driver => backend/driver}/third_party/google/protobuf/struct.proto (100%) rename {driver => backend/driver}/third_party/google/protobuf/timestamp.proto (100%) rename {driver => backend/driver}/third_party/google/protobuf/type.proto (100%) rename {driver => backend/driver}/third_party/google/protobuf/wrappers.proto (100%) rename {driver => backend/driver}/third_party/openapi/v3/annotations.proto (100%) rename {driver => backend/driver}/third_party/openapi/v3/openapi.proto (100%) rename {driver => backend/driver}/third_party/validate/README.md (100%) rename {driver => backend/driver}/third_party/validate/validate.proto (100%) delete mode 100644 driver/.gitignore delete mode 100644 driver/README.md diff --git a/driver/Dockerfile b/backend/driver/Dockerfile similarity index 100% rename from driver/Dockerfile rename to backend/driver/Dockerfile diff --git a/driver/LICENSE b/backend/driver/LICENSE similarity index 100% rename from driver/LICENSE rename to backend/driver/LICENSE diff --git a/driver/Makefile b/backend/driver/Makefile similarity index 100% rename from driver/Makefile rename to backend/driver/Makefile diff --git a/backend/driver/README.md b/backend/driver/README.md index 48d3d3f..8fd6153 100644 --- a/backend/driver/README.md +++ b/backend/driver/README.md @@ -1 +1,51 @@ -# 司机服务 \ No newline at end of file +# Kratos Project Template + +## Install Kratos +``` +go install github.com/go-kratos/kratos/cmd/kratos/v2@latest +``` +## Create a service +``` +# Create a template project +kratos new server + +cd server +# Add a proto template +kratos proto add api/server/server.proto +# Generate the proto code +kratos proto client api/server/server.proto +# Generate the source code of service by proto file +kratos proto server api/server/server.proto -t internal/service + +go generate ./... +go build -o ./bin/ ./... +./bin/server -conf ./configs +``` +## Generate other auxiliary files by Makefile +``` +# Download and update dependencies +make init +# Generate API files (include: pb.go, http, grpc, validate, swagger) by proto file +make api +# Generate all files +make all +``` +## Automated Initialization (wire) +``` +# install wire +go get github.com/google/wire/cmd/wire + +# generate wire +cd cmd/server +wire +``` + +## Docker +```bash +# build +docker build -t . + +# run +docker run --rm -p 8000:8000 -p 9000:9000 -v :/data/conf +``` + diff --git a/driver/api/helloworld/v1/error_reason.pb.go b/backend/driver/api/helloworld/v1/error_reason.pb.go similarity index 100% rename from driver/api/helloworld/v1/error_reason.pb.go rename to backend/driver/api/helloworld/v1/error_reason.pb.go diff --git a/driver/api/helloworld/v1/error_reason.proto b/backend/driver/api/helloworld/v1/error_reason.proto similarity index 100% rename from driver/api/helloworld/v1/error_reason.proto rename to backend/driver/api/helloworld/v1/error_reason.proto diff --git a/driver/api/helloworld/v1/greeter.pb.go b/backend/driver/api/helloworld/v1/greeter.pb.go similarity index 100% rename from driver/api/helloworld/v1/greeter.pb.go rename to backend/driver/api/helloworld/v1/greeter.pb.go diff --git a/driver/api/helloworld/v1/greeter.proto b/backend/driver/api/helloworld/v1/greeter.proto similarity index 100% rename from driver/api/helloworld/v1/greeter.proto rename to backend/driver/api/helloworld/v1/greeter.proto diff --git a/driver/api/helloworld/v1/greeter_grpc.pb.go b/backend/driver/api/helloworld/v1/greeter_grpc.pb.go similarity index 100% rename from driver/api/helloworld/v1/greeter_grpc.pb.go rename to backend/driver/api/helloworld/v1/greeter_grpc.pb.go diff --git a/driver/api/helloworld/v1/greeter_http.pb.go b/backend/driver/api/helloworld/v1/greeter_http.pb.go similarity index 100% rename from driver/api/helloworld/v1/greeter_http.pb.go rename to backend/driver/api/helloworld/v1/greeter_http.pb.go diff --git a/driver/cmd/driver/main.go b/backend/driver/cmd/driver/main.go similarity index 100% rename from driver/cmd/driver/main.go rename to backend/driver/cmd/driver/main.go diff --git a/driver/cmd/driver/wire.go b/backend/driver/cmd/driver/wire.go similarity index 100% rename from driver/cmd/driver/wire.go rename to backend/driver/cmd/driver/wire.go diff --git a/driver/cmd/driver/wire_gen.go b/backend/driver/cmd/driver/wire_gen.go similarity index 100% rename from driver/cmd/driver/wire_gen.go rename to backend/driver/cmd/driver/wire_gen.go diff --git a/driver/configs/config.yaml b/backend/driver/configs/config.yaml similarity index 100% rename from driver/configs/config.yaml rename to backend/driver/configs/config.yaml diff --git a/driver/go.mod b/backend/driver/go.mod similarity index 100% rename from driver/go.mod rename to backend/driver/go.mod diff --git a/driver/go.sum b/backend/driver/go.sum similarity index 100% rename from driver/go.sum rename to backend/driver/go.sum diff --git a/driver/internal/biz/README.md b/backend/driver/internal/biz/README.md similarity index 100% rename from driver/internal/biz/README.md rename to backend/driver/internal/biz/README.md diff --git a/driver/internal/biz/biz.go b/backend/driver/internal/biz/biz.go similarity index 100% rename from driver/internal/biz/biz.go rename to backend/driver/internal/biz/biz.go diff --git a/driver/internal/biz/greeter.go b/backend/driver/internal/biz/greeter.go similarity index 100% rename from driver/internal/biz/greeter.go rename to backend/driver/internal/biz/greeter.go diff --git a/driver/internal/conf/conf.pb.go b/backend/driver/internal/conf/conf.pb.go similarity index 100% rename from driver/internal/conf/conf.pb.go rename to backend/driver/internal/conf/conf.pb.go diff --git a/driver/internal/conf/conf.proto b/backend/driver/internal/conf/conf.proto similarity index 100% rename from driver/internal/conf/conf.proto rename to backend/driver/internal/conf/conf.proto diff --git a/driver/internal/data/README.md b/backend/driver/internal/data/README.md similarity index 100% rename from driver/internal/data/README.md rename to backend/driver/internal/data/README.md diff --git a/driver/internal/data/data.go b/backend/driver/internal/data/data.go similarity index 100% rename from driver/internal/data/data.go rename to backend/driver/internal/data/data.go diff --git a/driver/internal/data/greeter.go b/backend/driver/internal/data/greeter.go similarity index 100% rename from driver/internal/data/greeter.go rename to backend/driver/internal/data/greeter.go diff --git a/driver/internal/server/grpc.go b/backend/driver/internal/server/grpc.go similarity index 100% rename from driver/internal/server/grpc.go rename to backend/driver/internal/server/grpc.go diff --git a/driver/internal/server/http.go b/backend/driver/internal/server/http.go similarity index 100% rename from driver/internal/server/http.go rename to backend/driver/internal/server/http.go diff --git a/driver/internal/server/server.go b/backend/driver/internal/server/server.go similarity index 100% rename from driver/internal/server/server.go rename to backend/driver/internal/server/server.go diff --git a/driver/internal/service/README.md b/backend/driver/internal/service/README.md similarity index 100% rename from driver/internal/service/README.md rename to backend/driver/internal/service/README.md diff --git a/driver/internal/service/greeter.go b/backend/driver/internal/service/greeter.go similarity index 100% rename from driver/internal/service/greeter.go rename to backend/driver/internal/service/greeter.go diff --git a/driver/internal/service/service.go b/backend/driver/internal/service/service.go similarity index 100% rename from driver/internal/service/service.go rename to backend/driver/internal/service/service.go diff --git a/driver/openapi.yaml b/backend/driver/openapi.yaml similarity index 100% rename from driver/openapi.yaml rename to backend/driver/openapi.yaml diff --git a/driver/third_party/README.md b/backend/driver/third_party/README.md similarity index 100% rename from driver/third_party/README.md rename to backend/driver/third_party/README.md diff --git a/driver/third_party/errors/errors.proto b/backend/driver/third_party/errors/errors.proto similarity index 100% rename from driver/third_party/errors/errors.proto rename to backend/driver/third_party/errors/errors.proto diff --git a/driver/third_party/google/api/annotations.proto b/backend/driver/third_party/google/api/annotations.proto similarity index 100% rename from driver/third_party/google/api/annotations.proto rename to backend/driver/third_party/google/api/annotations.proto diff --git a/driver/third_party/google/api/client.proto b/backend/driver/third_party/google/api/client.proto similarity index 100% rename from driver/third_party/google/api/client.proto rename to backend/driver/third_party/google/api/client.proto diff --git a/driver/third_party/google/api/field_behavior.proto b/backend/driver/third_party/google/api/field_behavior.proto similarity index 100% rename from driver/third_party/google/api/field_behavior.proto rename to backend/driver/third_party/google/api/field_behavior.proto diff --git a/driver/third_party/google/api/http.proto b/backend/driver/third_party/google/api/http.proto similarity index 100% rename from driver/third_party/google/api/http.proto rename to backend/driver/third_party/google/api/http.proto diff --git a/driver/third_party/google/api/httpbody.proto b/backend/driver/third_party/google/api/httpbody.proto similarity index 100% rename from driver/third_party/google/api/httpbody.proto rename to backend/driver/third_party/google/api/httpbody.proto diff --git a/driver/third_party/google/protobuf/any.proto b/backend/driver/third_party/google/protobuf/any.proto similarity index 100% rename from driver/third_party/google/protobuf/any.proto rename to backend/driver/third_party/google/protobuf/any.proto diff --git a/driver/third_party/google/protobuf/api.proto b/backend/driver/third_party/google/protobuf/api.proto similarity index 100% rename from driver/third_party/google/protobuf/api.proto rename to backend/driver/third_party/google/protobuf/api.proto diff --git a/driver/third_party/google/protobuf/compiler/plugin.proto b/backend/driver/third_party/google/protobuf/compiler/plugin.proto similarity index 100% rename from driver/third_party/google/protobuf/compiler/plugin.proto rename to backend/driver/third_party/google/protobuf/compiler/plugin.proto diff --git a/driver/third_party/google/protobuf/descriptor.proto b/backend/driver/third_party/google/protobuf/descriptor.proto similarity index 100% rename from driver/third_party/google/protobuf/descriptor.proto rename to backend/driver/third_party/google/protobuf/descriptor.proto diff --git a/driver/third_party/google/protobuf/duration.proto b/backend/driver/third_party/google/protobuf/duration.proto similarity index 100% rename from driver/third_party/google/protobuf/duration.proto rename to backend/driver/third_party/google/protobuf/duration.proto diff --git a/driver/third_party/google/protobuf/empty.proto b/backend/driver/third_party/google/protobuf/empty.proto similarity index 100% rename from driver/third_party/google/protobuf/empty.proto rename to backend/driver/third_party/google/protobuf/empty.proto diff --git a/driver/third_party/google/protobuf/field_mask.proto b/backend/driver/third_party/google/protobuf/field_mask.proto similarity index 100% rename from driver/third_party/google/protobuf/field_mask.proto rename to backend/driver/third_party/google/protobuf/field_mask.proto diff --git a/driver/third_party/google/protobuf/source_context.proto b/backend/driver/third_party/google/protobuf/source_context.proto similarity index 100% rename from driver/third_party/google/protobuf/source_context.proto rename to backend/driver/third_party/google/protobuf/source_context.proto diff --git a/driver/third_party/google/protobuf/struct.proto b/backend/driver/third_party/google/protobuf/struct.proto similarity index 100% rename from driver/third_party/google/protobuf/struct.proto rename to backend/driver/third_party/google/protobuf/struct.proto diff --git a/driver/third_party/google/protobuf/timestamp.proto b/backend/driver/third_party/google/protobuf/timestamp.proto similarity index 100% rename from driver/third_party/google/protobuf/timestamp.proto rename to backend/driver/third_party/google/protobuf/timestamp.proto diff --git a/driver/third_party/google/protobuf/type.proto b/backend/driver/third_party/google/protobuf/type.proto similarity index 100% rename from driver/third_party/google/protobuf/type.proto rename to backend/driver/third_party/google/protobuf/type.proto diff --git a/driver/third_party/google/protobuf/wrappers.proto b/backend/driver/third_party/google/protobuf/wrappers.proto similarity index 100% rename from driver/third_party/google/protobuf/wrappers.proto rename to backend/driver/third_party/google/protobuf/wrappers.proto diff --git a/driver/third_party/openapi/v3/annotations.proto b/backend/driver/third_party/openapi/v3/annotations.proto similarity index 100% rename from driver/third_party/openapi/v3/annotations.proto rename to backend/driver/third_party/openapi/v3/annotations.proto diff --git a/driver/third_party/openapi/v3/openapi.proto b/backend/driver/third_party/openapi/v3/openapi.proto similarity index 100% rename from driver/third_party/openapi/v3/openapi.proto rename to backend/driver/third_party/openapi/v3/openapi.proto diff --git a/driver/third_party/validate/README.md b/backend/driver/third_party/validate/README.md similarity index 100% rename from driver/third_party/validate/README.md rename to backend/driver/third_party/validate/README.md diff --git a/driver/third_party/validate/validate.proto b/backend/driver/third_party/validate/validate.proto similarity index 100% rename from driver/third_party/validate/validate.proto rename to backend/driver/third_party/validate/validate.proto diff --git a/driver/.gitignore b/driver/.gitignore deleted file mode 100644 index c299074..0000000 --- a/driver/.gitignore +++ /dev/null @@ -1,36 +0,0 @@ -# Reference https://github.com/github/gitignore/blob/master/Go.gitignore -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Dependency directories (remove the comment below to include it) -vendor/ - -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# OS General -Thumbs.db -.DS_Store - -# project -*.cert -*.key -*.log -bin/ - -# Develop tools -.vscode/ -.idea/ -*.swp diff --git a/driver/README.md b/driver/README.md deleted file mode 100644 index 8fd6153..0000000 --- a/driver/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# Kratos Project Template - -## Install Kratos -``` -go install github.com/go-kratos/kratos/cmd/kratos/v2@latest -``` -## Create a service -``` -# Create a template project -kratos new server - -cd server -# Add a proto template -kratos proto add api/server/server.proto -# Generate the proto code -kratos proto client api/server/server.proto -# Generate the source code of service by proto file -kratos proto server api/server/server.proto -t internal/service - -go generate ./... -go build -o ./bin/ ./... -./bin/server -conf ./configs -``` -## Generate other auxiliary files by Makefile -``` -# Download and update dependencies -make init -# Generate API files (include: pb.go, http, grpc, validate, swagger) by proto file -make api -# Generate all files -make all -``` -## Automated Initialization (wire) -``` -# install wire -go get github.com/google/wire/cmd/wire - -# generate wire -cd cmd/server -wire -``` - -## Docker -```bash -# build -docker build -t . - -# run -docker run --rm -p 8000:8000 -p 9000:9000 -v :/data/conf -``` -