Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate a custom function. #773

Open
salemmohammed opened this issue Apr 5, 2024 · 1 comment
Open

Generate a custom function. #773

salemmohammed opened this issue Apr 5, 2024 · 1 comment

Comments

@salemmohammed
Copy link

Hi,

I need to create a custom function that becomes a part of the generated code. Below is my IDL file. I want BatchRequest1 to be handled by a custom function. This function should then be integrated into the generated code. How can I accomplish this?

syntax = "proto3";
package cockroach.roachpb;
option go_package = "github.com/cockroachdb/cockroach/pkg/kv/kvpb";
import "gogoproto/gogo.proto";
import "google/protobuf/descriptor.proto";

// Define a custom option to specify whether a message should be intercepted.
extend google.protobuf.MessageOptions {
bool intercept = 1000;
}

message BatchRequest1 {
option (intercept) = true; // Annotate the message with the custom option to specify interception.
string key1 = 1;
}

message BatchResponse1 {
string key2 = 1;
}

// Batch and RangeFeed service implemented by nodes for KV API requests.
service Internal1 {
rpc Batch1 (BatchRequest1) returns (BatchResponse1) {}
}

Thank you all.

@awalterschulze
Copy link
Member

I couldn't puzzle out exactly what you want, as there was no example generated code included.
You could add that to help others understand, but I have to warn you gogoprotobuf is deprecated
Good luck

@gogo gogo deleted a comment from salemmohammed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants