GithubHelp home page GithubHelp logo

trpc's Introduction

trpc

RPC 调试工具,用于调试远程RPC接口,暂只支持yar,Hprose和HTTP协议

安装

  • 下载 godep
$ go get github.com/tools/godep
  • 下载 trpc
$ git clone [email protected]:Aqiling/trpc.git
$ cd trpc
$ godep go build .
$ mv trpc /usr/local/bin/trpc

例子:

   # URL : http://www.test.com
   public function test($a, $b, $c = []){
       file_put_content("./log.log", json_encode($c));
       return $a + $b;
   }

执行:

$ trpc -u http://www.test.com -f test -a 1 -a 4 -a arrfile:localfile.json

返回:

result: 5
runtime:  98.39678ms

注意:

参数按照函数参数顺序传递,如果为数组提供2种传递方式:

  • 1:-a arr:name=trpc#age=20,通过"#"把key=>val连接起来, 组成["name"=>"trpc","age" => 20]。
  • 2:-a arrfile:./localfile.json,对于传递复杂的数组, 需要把数组json化后,放入"./localfile.json",再执行命令。

压力测试 [-b]

测试使用hey,一款用go重写的ab压力测试工具。

格式化返回结果 [-m]

接口返回的结果是数组,map,使用go直接输出,对开发者不友好。

加上[-m],可对结果美化:

 [
   'code' =>
      [
         'age' => '10',
         'name' => 'test',
      ],
   'name' => '1',
 ],

trpc's People

Contributors

jukylin avatar

Stargazers

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

Watchers

 avatar  avatar

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.