github.com/lastbackend/toolkit@v0.0.0-20241020043710-cafa37b95aad/examples/service/apis/example.proto (about)

     1  syntax = "proto3";
     2  
     3  package lastbackend.example;
     4  
     5  option go_package = "github.com/lastbackend/toolkit/examples/service/gen;servicepb";
     6  
     7  import "github.com/lastbackend/toolkit/protoc-gen-toolkit/toolkit/options/annotations.proto";
     8  import "github.com/lastbackend/toolkit/examples/service/apis/ptypes/messages.proto";
     9  
    10  // =====================================================
    11  // Generate mocks
    12  // =====================================================
    13  option (toolkit.tests_spec) = {
    14    mockery: {
    15      package: "github.com/lastbackend/toolkit/examples/service/tests/service_mocks"
    16    }
    17  };
    18  
    19  // =====================================================
    20  // Install clients
    21  // =====================================================
    22  option (toolkit.services) = {
    23    service: "example",
    24    package: "github.com/lastbackend/toolkit/examples/service/gen/client"
    25  };
    26  
    27  option (toolkit.plugins) = {
    28    prefix: "pgsql"
    29    plugin: "postgres_gorm"
    30  };
    31  
    32  option (toolkit.plugins) = {
    33    prefix: "redis"
    34    plugin: "redis"
    35  };
    36  
    37  
    38  // =====================================================
    39  // RPC methods
    40  // =====================================================
    41  service Example {
    42    option (toolkit.runtime) = {
    43      servers: [GRPC, HTTP]
    44    };
    45    option (toolkit.server) = {
    46      middlewares: [
    47        "request_id"
    48      ]
    49    };
    50  
    51    //  Example methods
    52    rpc HelloWorld(HelloWorldRequest) returns (HelloWorldResponse) {}
    53  };
    54  
    55  service Sample {
    56    option (toolkit.runtime).plugins = {
    57      prefix: "redis2"
    58      plugin: "redis"
    59    };
    60  };