Files
masonry/cmd/cli/templates/proto/application.proto.tmpl

100 lines
2.1 KiB
Cheetah

// Code generated by protoc-gen-go. DO NOT EDIT.
syntax = "proto3";
package {{ .AppName }};
import "gorm/options/gorm.proto";
//import "gorm/types/types.proto";
import "google/api/annotations.proto";
option go_package = "./;pb";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "Your API Title"
version: "v1.0"
description: "Your API description"
}
host: "localhost:8080" // Set the server host
};
service {{ .AppNameCaps }} {
option (gorm.server).autogen = true;
// Add your service methods here
rpc CreateProduct (CreateProductRequest) returns (CreateProductResponse) {
option (google.api.http) = {
post: "/v1/Product"
body: "*"
};
}
rpc ReadProduct (ReadProductRequest) returns (ReadProductResponse) {
option (google.api.http) = {
get: "/v1/Product/{id}"
};
}
rpc ListProducts (ListProductsRequest) returns (ListProductsResponse) {
option (google.api.http) = {
get: "/v1/Product"
};
}
rpc UpdateProduct (UpdateProductRequest) returns (UpdateProductResponse) {
option (google.api.http) = {
put: "/v1/Product"
body: "*"
};
}
rpc DeleteProduct (DeleteProductRequest) returns (DeleteProductResponse) {
option (gorm.method).object_type = "Product";
option (google.api.http) = {
delete: "/v1/Product/{id}"
};
}
}
message Create{{ .ObjName }}Request {
{{ .ObjName }} payload = 1;
}
message Create{{ .ObjName }}Response {
{{ .ObjName }} result = 1;
}
message Read{{ .ObjName }}Request {
uint64 id = 1;
}
message Read{{ .ObjName }}Response {
{{ .ObjName }} result = 1;
}
message List{{ .ObjName }}sRequest {}
message List{{ .ObjName }}sResponse {
repeated {{ .ObjName }} results = 1;
}
message Update{{ .ObjName }}Request {
{{ .ObjName }} payload = 1;
}
message Update{{ .ObjName }}Response {
{{ .ObjName }} result = 1;
}
message Delete{{ .ObjName }}Request {
uint64 id = 1;
}
message Delete{{ .ObjName }}Response {}
message {{ .ObjName }} {
option (gorm.opts).ormable = true;
uint64 id = 1;
// add object fields here
}