我有 django REST API,我正在尝试将其转换为 gRPC。我遵循Django grpc 框架指南并创建了以下文件:
class Organization(models.Model):
Org_name = models.CharField(max_length=100, unique=True, primary_key=True, db_index=True)
Address = models.CharField(max_length=100)
Description = models.CharField(max_length=500)
Number_of_emp = models.IntegerField()
Run Code Online (Sandbox Code Playgroud)
package org;
import "google/protobuf/empty.proto";
service OrganizationController {
rpc List(OrganizationListRequest) returns (Organizations) {}
rpc Create(Organization) returns (Organization) {}
rpc Retrieve(OrganizationRetrieveRequest) returns (Organization) {}
rpc Update(Organization) returns (Organization) {}
rpc Destroy(Organization) returns (google.protobuf.Empty) {}
}
message Organization {
string Org_name = 1;
string Address = 2;
string Description = 3;
int32 Number_of_emp = 4; …Run Code Online (Sandbox Code Playgroud)