Git Product home page Git Product logo

tg's People

Contributors

alpunic avatar seniorgolang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tg's Issues

Generator version is nowhere to be seen

So, you generally want to know which version the code was generated with, so everyone on the team can use the same version to regenerate, producing small, meaningful diffs instead of changing each of the 30 generated files in 100 places.

Unfortunately, the generator doesn't leave any trace of its version, neither in the generated code's comments:

// GENERATED BY 'T'ransport 'G'enerator. DO NOT EDIT.

nor even in its own binary (that I've built from a tagged release downloaded from here):

$ tg        
NAME:
   golang service 't'ransport 'g'enerator (tg) - make Go-Kit API easy

USAGE:
   tg [global options] command [command options] [arguments...]

VERSION:
   local.dev
...

Stop it! Get some help. What command-line utility doesn't report its own version, ffs? At least put the commit hash there somewhere

DOCS: http-path annotation probably incorrect

In docs:

http-path - HTTP путь в URL, по которому будет доступен метод. В пути допускается указание параметров, например http-path=api/files/{fileId} 

probably incorrect.

Whether

http-path - HTTP путь в URL, по которому будет доступен метод. В пути допускается указание параметров, например http-path=api/files/:fileId

is correct way?

Add support different server for transports

Could you add the support of different servers for different transports?

Environment

ls -lah intefaces/
total 16K
drwxr-xr-x 2 user user 4.0K Jul  1 18:56 .
drwxr-xr-x 4 user user 4.0K Jul  1 18:53 ..
-rw-r--r-- 1 user user  166 Jul  1 18:56 serviceA.go
-rw-r--r-- 1 user user  181 Jul  1 18:55 serviceB.go

where serviceA- it's public service and serviceB is private service.

cat interfaces/serviceA.go
package interfaces

import "context"

// @tg http-server log trace metrics
type ServiceA interface {
	PublicMethod(ctx context.Context, payload string) (err error)
}

and

cat interfaces/serviceB.go
package interfaces

import "context"

// @tg http-server log trace metrics
type ServiceB interface {
	PrivateMethod(ctx context.Context, payload string) (err error)
}

Actual
After generation code would be

package transport
//...
 func New(log logreus.FieldLogger, svc1 interfaces.ServiceA, svc2 interfaces.ServiceB)(srv *Server) {...}

Proposal
Add support generation of servers for different services, like add http-separate annotation.

After generation code would be

package transport
//...
 func New(log logreus.FieldLogger, svc1 interfaces.ServiceA)(srv *Server) {...}
// and new separate server for ServiceB
 func NewSrvServiceB(log logreus.FieldLogger, svc interfaces.ServiceB)(srv *Server) {...}

Create a quick start guide

I try use your project from branch v2 and have some troubles. It will be very helpful if you write quick start guide. Set of commands and changes in project files which will lead to generation of a working service.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.