本文整理匯總了Golang中github.com/gsrpc/gslang/ast.Method.Name方法的典型用法代碼示例。如果您正苦於以下問題:Golang Method.Name方法的具體用法?Golang Method.Name怎麽用?Golang Method.Name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/gsrpc/gslang/ast.Method
的用法示例。
在下文中一共展示了Method.Name方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: methodRPC
func (codegen *_CodeGen) methodRPC(method *ast.Method) string {
var buff bytes.Buffer
if codegen.notVoid(method.Return) {
buff.WriteString(fmt.Sprintf("com.gsrpc.Future<%s> %s(", codegen.objTypeName(method.Return), methodName(method.Name())))
} else {
if gslang.IsAsync(method) {
buff.WriteString(fmt.Sprintf("void %s(", methodName(method.Name())))
} else {
buff.WriteString(fmt.Sprintf("com.gsrpc.Future<Void> %s(", methodName(method.Name())))
}
}
for _, v := range method.Params {
buff.WriteString(fmt.Sprintf("%s arg%d, ", codegen.typeName(v.Type), v.ID))
}
if !gslang.IsAsync(method) {
buff.WriteString("final int timeout)")
} else {
buff.WriteString(")")
}
return strings.Replace(buff.String(), ", )", ")", -1)
}
示例2: methodcall
func (codegen *_CodeGen) methodcall(method *ast.Method) string {
var buff bytes.Buffer
if !codegen.notVoid(method.Return) {
buff.WriteString(fmt.Sprintf("this.service.%s(", methodName(method.Name())))
} else {
buff.WriteString(fmt.Sprintf("%s ret = this.service.%s(", codegen.typeName(method.Return), methodName(method.Name())))
}
for i := range method.Params {
buff.WriteString(fmt.Sprintf("arg%d, ", i))
}
buff.WriteString(");")
return strings.Replace(buff.String(), ", );", ");", -1)
}
示例3: methodDecl
func (codegen *_CodeGen) methodDecl(method *ast.Method) string {
var stream bytes.Buffer
stream.WriteString(fmt.Sprintf("- (%s)", codegen.typeName(method.Return)))
if len(method.Params) > 0 {
stream.WriteString(fmt.Sprintf(" %s:(%s)arg0", method.Name(), codegen.typeName(method.Params[0].Type)))
for i := 1; i < len(method.Params); i++ {
stream.WriteString(fmt.Sprintf(" withArg%d:(%s)arg%d", i, codegen.typeName(method.Params[i].Type), i))
}
} else {
stream.WriteString(fmt.Sprintf(" %s", method.Name()))
}
return stream.String()
}
示例4: rpcMethodDecl
func (codegen *_CodeGen) rpcMethodDecl(method *ast.Method) string {
var stream bytes.Buffer
if gslang.IsAsync(method) {
stream.WriteString("- (NSError*)")
} else {
stream.WriteString("- (id<GSPromise>)")
}
if len(method.Params) > 0 {
stream.WriteString(fmt.Sprintf(" %s:(%s) arg0 ", method.Name(), codegen.typeName(method.Params[0].Type)))
for i := 1; i < len(method.Params); i++ {
stream.WriteString(fmt.Sprintf(" withArg%d:(%s) arg%d ", i, codegen.typeName(method.Params[i].Type), i))
}
} else {
stream.WriteString(fmt.Sprintf(" %s", method.Name()))
}
return stream.String()
}
示例5: methodCall
func (codegen *_CodeGen) methodCall(method *ast.Method) string {
var stream bytes.Buffer
if codegen.notVoid(method.Return) {
stream.WriteString(fmt.Sprintf("%s ret = ", codegen.typeName(method.Return)))
}
if len(method.Params) > 0 {
stream.WriteString(fmt.Sprintf("[ _service %s: arg0 ", method.Name()))
for i := 1; i < len(method.Params); i++ {
stream.WriteString(fmt.Sprintf(" withArg%d:arg%d ", i, i))
}
} else {
stream.WriteString(fmt.Sprintf(" [ _service %s", method.Name()))
}
stream.WriteString("];")
return stream.String()
}