diff --git a/Makefile b/Makefile index bda0374..443313b 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,8 @@ include tools/commitlint/rules.mk include tools/git-verify-nodiff/rules.mk include tools/golangci-lint/rules.mk include tools/goreview/rules.mk +include tools/protoc-gen-go/rules.mk +include tools/protoc-gen-go-grpc/rules.mk include tools/semantic-release/rules.mk .PHONY: go-test @@ -41,7 +43,7 @@ $(protoc_gen_go_aiptest): @go build -o $@ . .PHONY: buf-generate -buf-generate: $(buf) $(protoc_gen_go_aiptest) +buf-generate: $(buf) $(protoc_gen_go_aiptest) $(protoc_gen_go) $(protoc_gen_go_grpc) $(info [$@] generating protobuf stubs...) @rm -rf proto/gen @$(buf) generate --path proto/src/einride diff --git a/buf.gen.yaml b/buf.gen.yaml index 426de14..ae22c2a 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -5,6 +5,10 @@ plugins: out: proto/gen opt: module=github.com/einride/protoc-gen-go-aiptest/proto/gen + - name: go-grpc + out: proto/gen + opt: module=github.com/einride/protoc-gen-go-aiptest/proto/gen + - name: go-aiptest out: proto/gen opt: module=github.com/einride/protoc-gen-go-aiptest/proto/gen diff --git a/go.mod b/go.mod index ce2fe6a..a7e0059 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,10 @@ go 1.15 require ( go.einride.tech/aip v0.44.0 - google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6 + golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d // indirect + golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 // indirect + google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67 + google.golang.org/grpc v1.39.1 + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 google.golang.org/protobuf v1.27.1 ) diff --git a/go.sum b/go.sum index 1dfc95c..1fa0382 100644 --- a/go.sum +++ b/go.sum @@ -49,41 +49,65 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.einride.tech/aip v0.44.0 h1:/3TMSgnMlYTIk8a5BifwsbJevfWkqOOSdQKAZgty9YU= go.einride.tech/aip v0.44.0/go.mod h1:/u8X6zaQ5Tb8rHQk171k4nyfPjQmSQxJs97ZsYoPgK4= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d h1:20cMwl2fHAzkJMEA+8J4JgqBQcQGzbisXo31MIeenXI= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 h1:siQdpVirKtzPhKl3lZWozZraCFObP8S1v6PRp0bLrtU= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -93,16 +117,20 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6 h1:4Xw2NwItrJOFR5s6PnK98PI6Bgw1LhMP1j/rO5WP0S4= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67 h1:VmMSf20ssFK0+u1dscyTH9bU4/M4y+X/xNfkvD6kGtM= +google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.39.1 h1:f37vZbBVTiJ6jKG5mWz8ySOBxNqy6ViPgyhSdVnxF3E= google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/internal/plugin/service.go b/internal/plugin/service.go index 971f415..c8b8cc2 100644 --- a/internal/plugin/service.go +++ b/internal/plugin/service.go @@ -18,6 +18,24 @@ func (s *serviceGenerator) Generate(f *protogen.GeneratedFile) error { } func (s *serviceGenerator) generateFixture(f *protogen.GeneratedFile) { + context := f.QualifiedGoIdent(protogen.GoIdent{ + GoName: "Context", + GoImportPath: "context", + }) + + service := f.QualifiedGoIdent(protogen.GoIdent{ + GoName: s.service.GoName + "Server", + GoImportPath: s.service.Methods[0].Input.GoIdent.GoImportPath, + }) + f.P("type ", s.service.GoName, " struct {") + + f.P("// Context to use for running tests.") + f.P("Context ", context) + f.P() + + f.P("// The service to test.") + f.P("Service ", service) + f.P() f.P("}") } diff --git a/proto/gen/einride/example/freight/v1/freight_service_grpc.pb.go b/proto/gen/einride/example/freight/v1/freight_service_grpc.pb.go new file mode 100644 index 0000000..149dce0 --- /dev/null +++ b/proto/gen/einride/example/freight/v1/freight_service_grpc.pb.go @@ -0,0 +1,671 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package examplefreightv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// FreightServiceClient is the client API for FreightService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type FreightServiceClient interface { + // Get a shipper. + // See: https://google.aip.dev/131 (Standard methods: Get). + GetShipper(ctx context.Context, in *GetShipperRequest, opts ...grpc.CallOption) (*Shipper, error) + // List shippers. + // See: https://google.aip.dev/132 (Standard methods: List). + ListShippers(ctx context.Context, in *ListShippersRequest, opts ...grpc.CallOption) (*ListShippersResponse, error) + // Create a shipper. + // See: https://google.aip.dev/133 (Standard methods: Create). + CreateShipper(ctx context.Context, in *CreateShipperRequest, opts ...grpc.CallOption) (*Shipper, error) + // Update a shipper. + // See: https://google.aip.dev/134 (Standard methods: Update). + UpdateShipper(ctx context.Context, in *UpdateShipperRequest, opts ...grpc.CallOption) (*Shipper, error) + // Delete a shipper. + // See: https://google.aip.dev/135 (Standard methods: Delete). + // See: https://google.aip.dev/164 (Soft delete). + DeleteShipper(ctx context.Context, in *DeleteShipperRequest, opts ...grpc.CallOption) (*Shipper, error) + // Get a site. + // See: https://google.aip.dev/131 (Standard methods: Get). + GetSite(ctx context.Context, in *GetSiteRequest, opts ...grpc.CallOption) (*Site, error) + // List sites for a shipper. + // See: https://google.aip.dev/132 (Standard methods: List). + ListSites(ctx context.Context, in *ListSitesRequest, opts ...grpc.CallOption) (*ListSitesResponse, error) + // Create a site. + // See: https://google.aip.dev/133 (Standard methods: Create). + CreateSite(ctx context.Context, in *CreateSiteRequest, opts ...grpc.CallOption) (*Site, error) + // Update a site. + // See: https://google.aip.dev/134 (Standard methods: Update). + UpdateSite(ctx context.Context, in *UpdateSiteRequest, opts ...grpc.CallOption) (*Site, error) + // Delete a site. + // See: https://google.aip.dev/135 (Standard methods: Delete). + // See: https://google.aip.dev/164 (Soft delete). + DeleteSite(ctx context.Context, in *DeleteSiteRequest, opts ...grpc.CallOption) (*Site, error) + // Get a shipment. + // See: https://google.aip.dev/131 (Standard methods: Get). + GetShipment(ctx context.Context, in *GetShipmentRequest, opts ...grpc.CallOption) (*Shipment, error) + // List shipments for a shipper. + // See: https://google.aip.dev/132 (Standard methods: List). + ListShipments(ctx context.Context, in *ListShipmentsRequest, opts ...grpc.CallOption) (*ListShipmentsResponse, error) + // Create a shipment. + // See: https://google.aip.dev/133 (Standard methods: Create). + CreateShipment(ctx context.Context, in *CreateShipmentRequest, opts ...grpc.CallOption) (*Shipment, error) + // Update a shipment. + // See: https://google.aip.dev/134 (Standard methods: Update). + UpdateShipment(ctx context.Context, in *UpdateShipmentRequest, opts ...grpc.CallOption) (*Shipment, error) + // Delete a shipment. + // See: https://google.aip.dev/135 (Standard methods: Delete). + // See: https://google.aip.dev/164 (Soft delete). + DeleteShipment(ctx context.Context, in *DeleteShipmentRequest, opts ...grpc.CallOption) (*Shipment, error) +} + +type freightServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewFreightServiceClient(cc grpc.ClientConnInterface) FreightServiceClient { + return &freightServiceClient{cc} +} + +func (c *freightServiceClient) GetShipper(ctx context.Context, in *GetShipperRequest, opts ...grpc.CallOption) (*Shipper, error) { + out := new(Shipper) + err := c.cc.Invoke(ctx, "/einride.example.freight.v1.FreightService/GetShipper", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *freightServiceClient) ListShippers(ctx context.Context, in *ListShippersRequest, opts ...grpc.CallOption) (*ListShippersResponse, error) { + out := new(ListShippersResponse) + err := c.cc.Invoke(ctx, "/einride.example.freight.v1.FreightService/ListShippers", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *freightServiceClient) CreateShipper(ctx context.Context, in *CreateShipperRequest, opts ...grpc.CallOption) (*Shipper, error) { + out := new(Shipper) + err := c.cc.Invoke(ctx, "/einride.example.freight.v1.FreightService/CreateShipper", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *freightServiceClient) UpdateShipper(ctx context.Context, in *UpdateShipperRequest, opts ...grpc.CallOption) (*Shipper, error) { + out := new(Shipper) + err := c.cc.Invoke(ctx, "/einride.example.freight.v1.FreightService/UpdateShipper", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *freightServiceClient) DeleteShipper(ctx context.Context, in *DeleteShipperRequest, opts ...grpc.CallOption) (*Shipper, error) { + out := new(Shipper) + err := c.cc.Invoke(ctx, "/einride.example.freight.v1.FreightService/DeleteShipper", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *freightServiceClient) GetSite(ctx context.Context, in *GetSiteRequest, opts ...grpc.CallOption) (*Site, error) { + out := new(Site) + err := c.cc.Invoke(ctx, "/einride.example.freight.v1.FreightService/GetSite", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *freightServiceClient) ListSites(ctx context.Context, in *ListSitesRequest, opts ...grpc.CallOption) (*ListSitesResponse, error) { + out := new(ListSitesResponse) + err := c.cc.Invoke(ctx, "/einride.example.freight.v1.FreightService/ListSites", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *freightServiceClient) CreateSite(ctx context.Context, in *CreateSiteRequest, opts ...grpc.CallOption) (*Site, error) { + out := new(Site) + err := c.cc.Invoke(ctx, "/einride.example.freight.v1.FreightService/CreateSite", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *freightServiceClient) UpdateSite(ctx context.Context, in *UpdateSiteRequest, opts ...grpc.CallOption) (*Site, error) { + out := new(Site) + err := c.cc.Invoke(ctx, "/einride.example.freight.v1.FreightService/UpdateSite", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *freightServiceClient) DeleteSite(ctx context.Context, in *DeleteSiteRequest, opts ...grpc.CallOption) (*Site, error) { + out := new(Site) + err := c.cc.Invoke(ctx, "/einride.example.freight.v1.FreightService/DeleteSite", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *freightServiceClient) GetShipment(ctx context.Context, in *GetShipmentRequest, opts ...grpc.CallOption) (*Shipment, error) { + out := new(Shipment) + err := c.cc.Invoke(ctx, "/einride.example.freight.v1.FreightService/GetShipment", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *freightServiceClient) ListShipments(ctx context.Context, in *ListShipmentsRequest, opts ...grpc.CallOption) (*ListShipmentsResponse, error) { + out := new(ListShipmentsResponse) + err := c.cc.Invoke(ctx, "/einride.example.freight.v1.FreightService/ListShipments", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *freightServiceClient) CreateShipment(ctx context.Context, in *CreateShipmentRequest, opts ...grpc.CallOption) (*Shipment, error) { + out := new(Shipment) + err := c.cc.Invoke(ctx, "/einride.example.freight.v1.FreightService/CreateShipment", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *freightServiceClient) UpdateShipment(ctx context.Context, in *UpdateShipmentRequest, opts ...grpc.CallOption) (*Shipment, error) { + out := new(Shipment) + err := c.cc.Invoke(ctx, "/einride.example.freight.v1.FreightService/UpdateShipment", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *freightServiceClient) DeleteShipment(ctx context.Context, in *DeleteShipmentRequest, opts ...grpc.CallOption) (*Shipment, error) { + out := new(Shipment) + err := c.cc.Invoke(ctx, "/einride.example.freight.v1.FreightService/DeleteShipment", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// FreightServiceServer is the server API for FreightService service. +// All implementations must embed UnimplementedFreightServiceServer +// for forward compatibility +type FreightServiceServer interface { + // Get a shipper. + // See: https://google.aip.dev/131 (Standard methods: Get). + GetShipper(context.Context, *GetShipperRequest) (*Shipper, error) + // List shippers. + // See: https://google.aip.dev/132 (Standard methods: List). + ListShippers(context.Context, *ListShippersRequest) (*ListShippersResponse, error) + // Create a shipper. + // See: https://google.aip.dev/133 (Standard methods: Create). + CreateShipper(context.Context, *CreateShipperRequest) (*Shipper, error) + // Update a shipper. + // See: https://google.aip.dev/134 (Standard methods: Update). + UpdateShipper(context.Context, *UpdateShipperRequest) (*Shipper, error) + // Delete a shipper. + // See: https://google.aip.dev/135 (Standard methods: Delete). + // See: https://google.aip.dev/164 (Soft delete). + DeleteShipper(context.Context, *DeleteShipperRequest) (*Shipper, error) + // Get a site. + // See: https://google.aip.dev/131 (Standard methods: Get). + GetSite(context.Context, *GetSiteRequest) (*Site, error) + // List sites for a shipper. + // See: https://google.aip.dev/132 (Standard methods: List). + ListSites(context.Context, *ListSitesRequest) (*ListSitesResponse, error) + // Create a site. + // See: https://google.aip.dev/133 (Standard methods: Create). + CreateSite(context.Context, *CreateSiteRequest) (*Site, error) + // Update a site. + // See: https://google.aip.dev/134 (Standard methods: Update). + UpdateSite(context.Context, *UpdateSiteRequest) (*Site, error) + // Delete a site. + // See: https://google.aip.dev/135 (Standard methods: Delete). + // See: https://google.aip.dev/164 (Soft delete). + DeleteSite(context.Context, *DeleteSiteRequest) (*Site, error) + // Get a shipment. + // See: https://google.aip.dev/131 (Standard methods: Get). + GetShipment(context.Context, *GetShipmentRequest) (*Shipment, error) + // List shipments for a shipper. + // See: https://google.aip.dev/132 (Standard methods: List). + ListShipments(context.Context, *ListShipmentsRequest) (*ListShipmentsResponse, error) + // Create a shipment. + // See: https://google.aip.dev/133 (Standard methods: Create). + CreateShipment(context.Context, *CreateShipmentRequest) (*Shipment, error) + // Update a shipment. + // See: https://google.aip.dev/134 (Standard methods: Update). + UpdateShipment(context.Context, *UpdateShipmentRequest) (*Shipment, error) + // Delete a shipment. + // See: https://google.aip.dev/135 (Standard methods: Delete). + // See: https://google.aip.dev/164 (Soft delete). + DeleteShipment(context.Context, *DeleteShipmentRequest) (*Shipment, error) + mustEmbedUnimplementedFreightServiceServer() +} + +// UnimplementedFreightServiceServer must be embedded to have forward compatible implementations. +type UnimplementedFreightServiceServer struct { +} + +func (UnimplementedFreightServiceServer) GetShipper(context.Context, *GetShipperRequest) (*Shipper, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetShipper not implemented") +} +func (UnimplementedFreightServiceServer) ListShippers(context.Context, *ListShippersRequest) (*ListShippersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListShippers not implemented") +} +func (UnimplementedFreightServiceServer) CreateShipper(context.Context, *CreateShipperRequest) (*Shipper, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateShipper not implemented") +} +func (UnimplementedFreightServiceServer) UpdateShipper(context.Context, *UpdateShipperRequest) (*Shipper, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateShipper not implemented") +} +func (UnimplementedFreightServiceServer) DeleteShipper(context.Context, *DeleteShipperRequest) (*Shipper, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteShipper not implemented") +} +func (UnimplementedFreightServiceServer) GetSite(context.Context, *GetSiteRequest) (*Site, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSite not implemented") +} +func (UnimplementedFreightServiceServer) ListSites(context.Context, *ListSitesRequest) (*ListSitesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListSites not implemented") +} +func (UnimplementedFreightServiceServer) CreateSite(context.Context, *CreateSiteRequest) (*Site, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateSite not implemented") +} +func (UnimplementedFreightServiceServer) UpdateSite(context.Context, *UpdateSiteRequest) (*Site, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateSite not implemented") +} +func (UnimplementedFreightServiceServer) DeleteSite(context.Context, *DeleteSiteRequest) (*Site, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteSite not implemented") +} +func (UnimplementedFreightServiceServer) GetShipment(context.Context, *GetShipmentRequest) (*Shipment, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetShipment not implemented") +} +func (UnimplementedFreightServiceServer) ListShipments(context.Context, *ListShipmentsRequest) (*ListShipmentsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListShipments not implemented") +} +func (UnimplementedFreightServiceServer) CreateShipment(context.Context, *CreateShipmentRequest) (*Shipment, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateShipment not implemented") +} +func (UnimplementedFreightServiceServer) UpdateShipment(context.Context, *UpdateShipmentRequest) (*Shipment, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateShipment not implemented") +} +func (UnimplementedFreightServiceServer) DeleteShipment(context.Context, *DeleteShipmentRequest) (*Shipment, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteShipment not implemented") +} +func (UnimplementedFreightServiceServer) mustEmbedUnimplementedFreightServiceServer() {} + +// UnsafeFreightServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to FreightServiceServer will +// result in compilation errors. +type UnsafeFreightServiceServer interface { + mustEmbedUnimplementedFreightServiceServer() +} + +func RegisterFreightServiceServer(s grpc.ServiceRegistrar, srv FreightServiceServer) { + s.RegisterService(&FreightService_ServiceDesc, srv) +} + +func _FreightService_GetShipper_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetShipperRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FreightServiceServer).GetShipper(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/einride.example.freight.v1.FreightService/GetShipper", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FreightServiceServer).GetShipper(ctx, req.(*GetShipperRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FreightService_ListShippers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListShippersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FreightServiceServer).ListShippers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/einride.example.freight.v1.FreightService/ListShippers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FreightServiceServer).ListShippers(ctx, req.(*ListShippersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FreightService_CreateShipper_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateShipperRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FreightServiceServer).CreateShipper(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/einride.example.freight.v1.FreightService/CreateShipper", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FreightServiceServer).CreateShipper(ctx, req.(*CreateShipperRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FreightService_UpdateShipper_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateShipperRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FreightServiceServer).UpdateShipper(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/einride.example.freight.v1.FreightService/UpdateShipper", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FreightServiceServer).UpdateShipper(ctx, req.(*UpdateShipperRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FreightService_DeleteShipper_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteShipperRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FreightServiceServer).DeleteShipper(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/einride.example.freight.v1.FreightService/DeleteShipper", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FreightServiceServer).DeleteShipper(ctx, req.(*DeleteShipperRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FreightService_GetSite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSiteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FreightServiceServer).GetSite(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/einride.example.freight.v1.FreightService/GetSite", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FreightServiceServer).GetSite(ctx, req.(*GetSiteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FreightService_ListSites_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListSitesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FreightServiceServer).ListSites(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/einride.example.freight.v1.FreightService/ListSites", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FreightServiceServer).ListSites(ctx, req.(*ListSitesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FreightService_CreateSite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateSiteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FreightServiceServer).CreateSite(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/einride.example.freight.v1.FreightService/CreateSite", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FreightServiceServer).CreateSite(ctx, req.(*CreateSiteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FreightService_UpdateSite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateSiteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FreightServiceServer).UpdateSite(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/einride.example.freight.v1.FreightService/UpdateSite", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FreightServiceServer).UpdateSite(ctx, req.(*UpdateSiteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FreightService_DeleteSite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteSiteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FreightServiceServer).DeleteSite(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/einride.example.freight.v1.FreightService/DeleteSite", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FreightServiceServer).DeleteSite(ctx, req.(*DeleteSiteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FreightService_GetShipment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetShipmentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FreightServiceServer).GetShipment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/einride.example.freight.v1.FreightService/GetShipment", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FreightServiceServer).GetShipment(ctx, req.(*GetShipmentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FreightService_ListShipments_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListShipmentsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FreightServiceServer).ListShipments(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/einride.example.freight.v1.FreightService/ListShipments", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FreightServiceServer).ListShipments(ctx, req.(*ListShipmentsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FreightService_CreateShipment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateShipmentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FreightServiceServer).CreateShipment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/einride.example.freight.v1.FreightService/CreateShipment", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FreightServiceServer).CreateShipment(ctx, req.(*CreateShipmentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FreightService_UpdateShipment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateShipmentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FreightServiceServer).UpdateShipment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/einride.example.freight.v1.FreightService/UpdateShipment", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FreightServiceServer).UpdateShipment(ctx, req.(*UpdateShipmentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FreightService_DeleteShipment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteShipmentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FreightServiceServer).DeleteShipment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/einride.example.freight.v1.FreightService/DeleteShipment", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FreightServiceServer).DeleteShipment(ctx, req.(*DeleteShipmentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// FreightService_ServiceDesc is the grpc.ServiceDesc for FreightService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var FreightService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "einride.example.freight.v1.FreightService", + HandlerType: (*FreightServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetShipper", + Handler: _FreightService_GetShipper_Handler, + }, + { + MethodName: "ListShippers", + Handler: _FreightService_ListShippers_Handler, + }, + { + MethodName: "CreateShipper", + Handler: _FreightService_CreateShipper_Handler, + }, + { + MethodName: "UpdateShipper", + Handler: _FreightService_UpdateShipper_Handler, + }, + { + MethodName: "DeleteShipper", + Handler: _FreightService_DeleteShipper_Handler, + }, + { + MethodName: "GetSite", + Handler: _FreightService_GetSite_Handler, + }, + { + MethodName: "ListSites", + Handler: _FreightService_ListSites_Handler, + }, + { + MethodName: "CreateSite", + Handler: _FreightService_CreateSite_Handler, + }, + { + MethodName: "UpdateSite", + Handler: _FreightService_UpdateSite_Handler, + }, + { + MethodName: "DeleteSite", + Handler: _FreightService_DeleteSite_Handler, + }, + { + MethodName: "GetShipment", + Handler: _FreightService_GetShipment_Handler, + }, + { + MethodName: "ListShipments", + Handler: _FreightService_ListShipments_Handler, + }, + { + MethodName: "CreateShipment", + Handler: _FreightService_CreateShipment_Handler, + }, + { + MethodName: "UpdateShipment", + Handler: _FreightService_UpdateShipment_Handler, + }, + { + MethodName: "DeleteShipment", + Handler: _FreightService_DeleteShipment_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "einride/example/freight/v1/freight_service.proto", +} diff --git a/proto/gen/einride/example/freight/v1/testing/freight_service.go b/proto/gen/einride/example/freight/v1/testing/freight_service.go index f217561..99bffd0 100644 --- a/proto/gen/einride/example/freight/v1/testing/freight_service.go +++ b/proto/gen/einride/example/freight/v1/testing/freight_service.go @@ -1,4 +1,14 @@ package examplefreightv1test +import ( + context "context" + v1 "github.com/einride/protoc-gen-go-aiptest/proto/gen/einride/example/freight/v1" +) + type FreightService struct { + // Context to use for running tests. + Context context.Context + + // The service to test. + Service v1.FreightServiceServer } diff --git a/tools.go b/tools.go new file mode 100644 index 0000000..52a2c4d --- /dev/null +++ b/tools.go @@ -0,0 +1,5 @@ +//+build tools + +package tools + +import _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" diff --git a/tools/protoc-gen-go-grpc/rules.mk b/tools/protoc-gen-go-grpc/rules.mk new file mode 100644 index 0000000..71021b7 --- /dev/null +++ b/tools/protoc-gen-go-grpc/rules.mk @@ -0,0 +1,7 @@ +grpc_go_cwd := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) +protoc_gen_go_grpc := $(grpc_go_cwd)/bin/protoc-gen-go_grpc +export PATH := $(dir $(protoc_gen_go_grpc)):$(PATH) + +$(protoc_gen_go_grpc): $(grpc_go_cwd)/../../go.mod + $(info [protoc-gen-go-grpc] building binary..) + @cd $(grpc_go_cwd)/../.. && go build -o $@ google.golang.org/grpc/cmd/protoc-gen-go-grpc