Skip to content

Instantly share code, notes, and snippets.

@jsgoecke
Created June 30, 2014 17:21
Show Gist options
  • Save jsgoecke/8bdb55561ab65813148b to your computer and use it in GitHub Desktop.
Save jsgoecke/8bdb55561ab65813148b to your computer and use it in GitHub Desktop.
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()
}
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)
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