Created
June 30, 2014 17:21
-
-
Save jsgoecke/8bdb55561ab65813148b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/DavidHuie/quartz/go/quartz" | |
"log" | |
) | |
type Adder struct{} | |
type Args struct { | |
A int | |
B int | |
} | |
type Response struct { | |
Sum int | |
} | |
func (t *Adder) Add(args Args, response *Response) error { | |
log.Println(args) | |
*response = Response{args.A + args.B} | |
return nil | |
} | |
func main() { | |
myAdder := &Adder{} | |
quartz.RegisterName("my_adder", myAdder) | |
quartz.Start() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'quartz' | |
client = Quartz::Client.new(file_path: 'test.go') | |
p client.structs | |
p client[:my_adder].struct_methods | |
p client[:my_adder].call('Add', 'A' => 2, 'B' => 5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby test.rb | |
[:my_adder] | |
["Add"] | |
2014/06/30 10:21:10 {2 5} | |
{"Sum"=>7} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment