truss/gengokit
Leland Batey c57b063590 Migrate clientarggen to svcdef 2016-10-31 14:29:05 -07:00
..
astmodifier Fix server and client handler always being overwritten 2016-09-16 17:40:00 -07:00
clientarggen Migrate clientarggen to svcdef 2016-10-31 14:29:05 -07:00
config Initial weave of svcdef into gengokit 2016-10-31 09:46:30 -07:00
gentesthelper Add support for repeated query parameters 2016-09-30 11:54:06 -07:00
httptransport Migrate clientarggen to svcdef 2016-10-31 14:29:05 -07:00
template Initial weave of svcdef into gengokit 2016-10-31 09:46:30 -07:00
README.md Separate doc generation from definition structure 2016-09-12 11:37:15 -07:00
gengokit.go Migrate clientarggen to svcdef 2016-10-31 14:29:05 -07:00
gengokit_test.go Initial weave of svcdef into gengokit 2016-10-31 09:46:30 -07:00

README.md

gengokit

gengokit is a truss plugin that from a deftree and []truss.SimpleFile

  1. Generates Golang code for a gokit microservice that includes:
    • Logging
    • Metrics/Instrumentation
    • gRPC transport
    • http/json transport (including all encoding/decoding)
    • no-op handler methods for each service rpc, ready for business logic to be added
  2. Generates Golang code for a cli gokit microservice client that includes:
    • gRPC transport
    • http/json transport (including all encoding/decoding)
    • handler methods that marshal command line arguments into server requests
  3. Parses code previously generated by protoc-gen-truss-gokit and inserts/removes handler methods/rpcs that are defined/removed from the definition

Development

Build

$ go generate github.com/TuneLab/go-truss/... $ go install github.com/TuneLab/go-truss/...

Test

make test from the $GOPATH/src/github.com/TuneLab/go-truss/truss directory runs the integration tests

Structure

./template/service contain go text/template files that represent a gokit microservice

./astmodifier provides functions to modify source code already generated and/or user modified.

gengokit.go executes the template files using deftree's representation of the protoc AST. ./generator also uses ./astmodifier to rewrite code to insert/remove handler methods/rpcs that are defined/removed from a definition file without touching user written logic.

NOTE:

  • No Service rpc methods named "NewBasicService" allowed for generation reasons