Last active
October 7, 2015 00:54
-
-
Save maxtaco/3fb52a0da9421477d497 to your computer and use it in GitHub Desktop.
New RPC/Go interface idea.
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
@namespace("foo.1") | |
protocol bar { | |
A myfunc(b B, c C); | |
} |
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
type MyfuncArg struct { | |
B B; | |
C C; | |
} | |
func BarProtocol(i BarInterface) rpc.Protocol { | |
return rpc.Protocol{ | |
Name: "keybase.1.bar", | |
Methods: map[string]rpc.ServeHookDescription{ | |
"myfunc" : rpc.ServeHookDescription{ | |
ArgType : reflect.TypeOf(MyfuncArg), | |
Func : func(arg interface{}) (ret interface{}, err error) { | |
return i.Myfunc(arg); | |
}, | |
}, | |
}, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment