pogen

command module
v0.0.0-...-900b70e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2021 License: MIT Imports: 10 Imported by: 0

README

pogen

Generator of function to get http path pattern in proto option from http.Request.URL.Path

If you have this kind of grpc-gateway like proto file, http.Request.URL.Path can be /users/1.

With generated codes, You can get users/{userId} for analysis or metrics.

service UserService {
  rpc GetStatus(UserRequest) returns (UserResponse) {
    option (google.api.http) = {
      get: "/users/{userId}"
      body: "*"
    };
  }
}

Usage

go run main.go -p example -o example/example.go -d example/proto

Options

  -d string
        proto directory name (default "proto/service")
  -o string
        output file (default "output.go")
  -p string
        package name (default "main")

Problem

Getting pattern from http.Request.URL.Path is not efficient. order is o(n).

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Code generated by pogen.
Code generated by pogen.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL