fix templates
This commit is contained in:
@ -21,7 +21,7 @@ var protoTemplate string
|
||||
//go:embed templates/backend/main.go.tmpl
|
||||
var mainGoTemplate string
|
||||
|
||||
//go:embed templates/proto/include/*
|
||||
//go:embed proto_include/*
|
||||
var protoInclude embed.FS
|
||||
|
||||
func createCmd() *cli.Command {
|
||||
@ -118,7 +118,7 @@ func createCmd() *cli.Command {
|
||||
return fmt.Errorf("error rendering proto file | %w", err)
|
||||
}
|
||||
|
||||
err = os.CopyFS("proto_include", protoInclude)
|
||||
err = os.CopyFS("./", protoInclude)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error copying proto include files | %w", err)
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ package {{ .AppName }};
|
||||
|
||||
import "gorm/options/gorm.proto";
|
||||
//import "gorm/types/types.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option go_package = "./;pb";
|
||||
|
||||
@ -12,17 +13,38 @@ service {{ .AppNameCaps }} {
|
||||
option (gorm.server).autogen = true;
|
||||
// Add your service methods here
|
||||
|
||||
rpc Create{{ .ObjName }} (Create{{ .ObjName }}Request) returns (Create{{ .ObjName }}Response) {}
|
||||
rpc CreateProduct (CreateProductRequest) returns (CreateProductResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/Product"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
rpc Read{{ .ObjName }} (Read{{ .ObjName }}Request) returns (Read{{ .ObjName }}Response) {}
|
||||
rpc ReadProduct (ReadProductRequest) returns (ReadProductResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/Product/{id}"
|
||||
};
|
||||
}
|
||||
|
||||
rpc List{{ .ObjName }}s (List{{ .ObjName }}sRequest) returns (List{{ .ObjName }}sResponse) {}
|
||||
rpc ListProducts (ListProductsRequest) returns (ListProductsResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/Product"
|
||||
};
|
||||
}
|
||||
|
||||
rpc Update{{ .ObjName }} (Update{{ .ObjName }}Request) returns (Update{{ .ObjName }}Response) {}
|
||||
rpc UpdateProduct (UpdateProductRequest) returns (UpdateProductResponse) {
|
||||
option (google.api.http) = {
|
||||
put: "/v1/Product"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
rpc Delete{{ .ObjName }} (Delete{{ .ObjName }}Request) returns (Delete{{ .ObjName }}Response) {
|
||||
option (gorm.method).object_type = "{{ .ObjName }}";
|
||||
}
|
||||
rpc DeleteProduct (DeleteProductRequest) returns (DeleteProductResponse) {
|
||||
option (gorm.method).object_type = "Product";
|
||||
option (google.api.http) = {
|
||||
delete: "/v1/Product/{id}"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message Create{{ .ObjName }}Request {
|
||||
|
Reference in New Issue
Block a user