evans

command module
v0.0.0-...-194d0c4 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2018 License: MIT Imports: 3 Imported by: 0

README

  ______
 |  ____|
 | |__    __   __   __ _   _ __    ___
 |  __|   \ \ / /  / _. | | '_ \  / __|
 | |____   \ V /  | (_| | | | | | \__ \
 |______|   \_/    \__,_| |_| |_| |___/

 more expressive universal gRPC client

CircleCI

Motivation

Evans was created to use easier than other existing gRPC clients.
If you want to keep your product quality, you must use CI with gRPC testing, should not do use manually testing.
Evans will complete your other usecases just like:

  • manually gRPC API inspection
  • to automate some tasks by scripting

above usecases is corresponding to Evans's two modes, REPL mode, and command-line mode.

REPL mode

Evans
REPL mode is the solution for first usecase.
You can use it without thinking like package name, service name, RPC name, command usage, and so on because REPL mode has powerful completion!

proto file which read in demonstration and its implementation are available at ktr0731/evans-demo.

command-line mode

Evans

command-line mode is stateless mode just like grpc-ecosystem/polyglot.
command-line mode issue one request per one command as its name suggests.
So it is based on UNIX philosophy.

For example, read inputs from stdin, the command will be a filter command.
On the other hand, the command result will be outputted to stdout by JSON formatted.
So, you can format it by any commands like jq. Also, if you want to use the same command (e.g. use same JSON inputs), you can use --file (-f) option.

By the way, command-line mode is not able to omit --package, --service and --call option, unlike REPL mode.
However, if .evans.toml is exist in Git project root, you can denote default values.

[default]
protoFile = ["api/api.proto"]
package = "api"
service = "UserService"

Then, the command will be more clear.

Installation

highly recommended methods are GitHub Releases or Homebrew because these can be software update automatically by the built-in feature in Evans.

from GitHub Releases

please see GitHub Releases.

macOS

$ brew tap ktr0731/evans
$ brew install evans

go get

v1.10 or later required.

$ go get github.com/ktr0731/evans

Usage

Evans consists of some commands in REPL.

Enter to REPL (this file is here)

$ evans adapter/gateway/testdata/helloworld.proto

To show the summary of packages, services or messages of proto files REPL read:

> show package
+------------+
|  PACKAGE   |
+------------+
| helloworld |
+------------+

> show service
+---------+----------+--------------+---------------+
| SERVICE |   RPC    | REQUESTTYPE  | RESPONSETYPE  |
+---------+----------+--------------+---------------+
| Greeter | SayHello | HelloRequest | HelloResponse |
+---------+----------+--------------+---------------+

> show message
+---------------+
|    MESSAGE    |
+---------------+
| HelloRequest  |
| HelloResponse |
+---------------+

To show more description of a message:

> desc HelloRequest
+---------+-------------+
|  FIELD  |    TYPE     |
+---------+-------------+
| name    | TYPE_STRING |
| message | TYPE_STRING |
+---------+-------------+

Set headers for each request:

> header foo=bar

To show headers:

> show header
+------------+-------+
|    KEY     |  VAL  |
+------------+-------+
| user-agent | evans |
| foo        | bar   |
+------------+-------+

Call a RPC:

> call SayHello
name (TYPE_STRING) = ktr
message (TYPE_STRING) => hello!

Evans constructs a gRPC request interactively and sends the request to a gRPC server.
Finally, Evans prints the JSON formatted result.

Supported IDL (interface definition language)

See Also

Evans (DJ YOSHITAKA)
Evans
iTunes

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
adapter
tests
e2e
helper/server/helloworld
Package helloworld is a generated protocol buffer package.
Package helloworld is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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