github.com/nyan233/littlerpc@v0.4.6-0.20230316182519-0c8d5c48abaf/cmd/lrpcurl/proxy/LittleRpcReflection_proxy.go (about) 1 package proxy 2 3 /* 4 @Generator : pxtor 5 @CreateTime : 2023-02-19 20:28:34.1828352 +0800 CST m=+0.013563501 6 @Author : NoAuthor 7 @Comment : code is auto generate do not edit 8 */ 9 10 import ( 11 "context" 12 "github.com/nyan233/littlerpc/core/client" 13 "github.com/nyan233/littlerpc/core/server" 14 ) 15 16 var ( 17 _ binder = new(client.Client) 18 _ caller = new(client.Client) 19 _ LittleRpcReflectionProxy = new(littleRpcReflectionImpl) 20 ) 21 22 type binder interface { 23 BindFunc(source string, proxy interface{}) error 24 } 25 26 type caller interface { 27 Call(service string, opts []client.CallOption, args ...interface{}) (reps []interface{}, err error) 28 } 29 30 type LittleRpcReflectionProxy interface { 31 MethodTable(ctx context.Context, sourceName string, opts ...client.CallOption) (*server.MethodTable, error) 32 AllInstance(ctx context.Context, opts ...client.CallOption) (map[string]string, error) 33 AllCodec(ctx context.Context, opts ...client.CallOption) ([]string, error) 34 AllPacker(ctx context.Context, opts ...client.CallOption) ([]string, error) 35 MethodArgumentType(ctx context.Context, serviceName string, opts ...client.CallOption) ([]server.ArgumentType, error) 36 } 37 38 type littleRpcReflectionImpl struct { 39 caller 40 } 41 42 func NewLittleRpcReflection(b binder) LittleRpcReflectionProxy { 43 proxy := new(littleRpcReflectionImpl) 44 err := b.BindFunc("littlerpc/internal/reflection", proxy) 45 if err != nil { 46 panic(err) 47 } 48 c, ok := b.(caller) 49 if !ok { 50 panic("the argument is not implemented caller") 51 } 52 proxy.caller = c 53 return proxy 54 } 55 56 func (p littleRpcReflectionImpl) MethodTable(ctx context.Context, sourceName string, opts ...client.CallOption) (*server.MethodTable, error) { 57 reps, err := p.Call("littlerpc/internal/reflection.MethodTable", opts, ctx, sourceName) 58 r0, _ := reps[0].(*server.MethodTable) 59 return r0, err 60 } 61 62 func (p littleRpcReflectionImpl) AllInstance(ctx context.Context, opts ...client.CallOption) (map[string]string, error) { 63 reps, err := p.Call("littlerpc/internal/reflection.AllInstance", opts, ctx) 64 r0, _ := reps[0].(map[string]string) 65 return r0, err 66 } 67 68 func (p littleRpcReflectionImpl) AllCodec(ctx context.Context, opts ...client.CallOption) ([]string, error) { 69 reps, err := p.Call("littlerpc/internal/reflection.AllCodec", opts, ctx) 70 r0, _ := reps[0].([]string) 71 return r0, err 72 } 73 74 func (p littleRpcReflectionImpl) AllPacker(ctx context.Context, opts ...client.CallOption) ([]string, error) { 75 reps, err := p.Call("littlerpc/internal/reflection.AllPacker", opts, ctx) 76 r0, _ := reps[0].([]string) 77 return r0, err 78 } 79 80 func (p littleRpcReflectionImpl) MethodArgumentType(ctx context.Context, serviceName string, opts ...client.CallOption) ([]server.ArgumentType, error) { 81 reps, err := p.Call("littlerpc/internal/reflection.MethodArgumentType", opts, ctx, serviceName) 82 r0, _ := reps[0].([]server.ArgumentType) 83 return r0, err 84 }