Skip to content

Commit

Permalink
refactor: remove controller to be kiss (douyu#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
sysulq authored Feb 3, 2023
1 parent 200766c commit 606f86f
Show file tree
Hide file tree
Showing 45 changed files with 2,488 additions and 997 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ jobs:
run: |
make init
make generate
go build -v ./cmd/...
- name: Install ginkgo
run: |
go install github.com/onsi/ginkgo/v2/ginkgo@latest
sudo cp ~/go/bin/ginkgo /usr/local/bin
- name: Test
run: |
Expand Down
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@
.PHONY: init
# install tools
init:
go install github.com/douyu/jupiter/cmd/[email protected]
go install github.com/google/wire/cmd/[email protected]
go install github.com/vektra/mockery/[email protected]
go install gorm.io/gen/tools/[email protected]
go install github.com/bufbuild/buf/cmd/[email protected]
go install github.com/bufbuild/buf/cmd/buf
go install github.com/douyu/jupiter/cmd/jupiter
go install github.com/douyu/jupiter/cmd/protoc-gen-go-echo
go install github.com/douyu/jupiter/cmd/protoc-gen-go-gin
go install github.com/google/wire/cmd/wire
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2
go install github.com/onsi/ginkgo/v2/ginkgo
go install github.com/srikrsna/protoc-gen-gotag
go install github.com/vektra/mockery/v2
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install gorm.io/gen/tools/gentool

.PHONY: generate
# generate code
Expand Down
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,25 +79,21 @@ go run ./cmd/exampleserver --config config/exampleserver/local-live.toml
* HTTP

```bash
curl "localhost:9527?name=bob"
curl "http://localhost:9527/v1/helloworld.Greeter/SayHello/bob"
```

```json
{"error":0,"msg":"请求正常","data":{"message":"hello wolrd"}}
{"error":0,"msg":"","data":{"name":"hello bob","age_number":0,"sex":0,"metadata":null}}
```

* GRPC

```bash
grpcurl -import-path api -proto api/helloworld/v1/helloworld.proto -plaintext -d '{"name":"bob"}' localhost:9528 helloworld.v1.GreeterService/SayHello
buf curl --schema api --protocol grpc --http2-prior-knowledge --data '{"name":"bob"}' http://localhost:9528/helloworld.v1.GreeterService/SayHello
```

```json
{
"data": {
"message": "hello world"
}
}
{"data":{"name":"hello bob"}}
```

Jaeger Admin
Expand Down
8 changes: 8 additions & 0 deletions api/buf.gen.tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: v1

plugins:
- name: gotag
out: .
opt:
- paths=source_relative
- auto=json+form+query-as-camel
15 changes: 15 additions & 0 deletions api/buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: googleapis
repository: googleapis
commit: 75b4300737fb4efca0831636be94e517
- remote: buf.build
owner: grpc-ecosystem
repository: grpc-gateway
commit: a1ecdc58eccd49aa8bea2a7a9022dc27
- remote: buf.build
owner: srikrsna
repository: protoc-gen-gotag
commit: 7a85d3ad2e7642c198480e92bf730c14
6 changes: 6 additions & 0 deletions api/buf.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
version: v1

deps:
- buf.build/googleapis/googleapis
- buf.build/srikrsna/protoc-gen-gotag
- buf.build/grpc-ecosystem/grpc-gateway

lint:
ignore:
- vendor
Expand Down
14 changes: 0 additions & 14 deletions api/common/v1/msg.proto

This file was deleted.

Loading

0 comments on commit 606f86f

Please sign in to comment.