github.com/nyan233/littlerpc@v0.4.6-0.20230316182519-0c8d5c48abaf/cmd/pxtor/test/Test_proxy.go (about)

     1  package test
     2  
     3  /*
     4     @Generator   : pxtor
     5     @CreateTime  : 2023-03-07 21:18:00.1704618 +0800 CST m=+0.039838201
     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/container"
    14  )
    15  
    16  var (
    17  	_ binder174a2588b15e5a68bcb18c800d03825b = new(client.Client)
    18  	_ caller174a2588b15e5a68bcb18c800d03825b = new(client.Client)
    19  	_ TestProxy                              = new(testImpl)
    20  )
    21  
    22  type binder174a2588b15e5a68bcb18c800d03825b interface {
    23  	BindFunc(source string, proxy interface{}) error
    24  }
    25  
    26  type caller174a2588b15e5a68bcb18c800d03825b interface {
    27  	Call(service string, opts []client.CallOption, args ...interface{}) (reps []interface{}, err error)
    28  }
    29  
    30  type TestProxy interface {
    31  	Foo(s1 string, opts ...client.CallOption) (int, error)
    32  	Bar(s1 string, opts ...client.CallOption) (int, error)
    33  	NoReturnValue(i int, opts ...client.CallOption) error
    34  	ErrHandler(s1 string, opts ...client.CallOption) error
    35  	ErrHandler2(s1 string, opts ...client.CallOption) error
    36  	ImportTest(l1 container.ByteSlice, opts ...client.CallOption) error
    37  	ImportTest2(ctx context.Context, l1 container.ByteSlice, l2 *container.ByteSlice, opts ...client.CallOption) error
    38  	Proxy2(s1 string, s2 int, opts ...client.CallOption) (*Test, int64, error)
    39  	MapCallTest(m1 map[string]map[string]byte, m2 map[string]map[string]byte, opts ...client.CallOption) (*Test, map[string]byte, error)
    40  	CallSlice(s1 []*Test, s2 []map[string]int, opts ...client.CallOption) (bool, error)
    41  }
    42  
    43  type testImpl struct {
    44  	caller174a2588b15e5a68bcb18c800d03825b
    45  }
    46  
    47  func NewTest(b binder174a2588b15e5a68bcb18c800d03825b) TestProxy {
    48  	proxy := new(testImpl)
    49  	err := b.BindFunc("Test", proxy)
    50  	if err != nil {
    51  		panic(err)
    52  	}
    53  	c, ok := b.(caller174a2588b15e5a68bcb18c800d03825b)
    54  	if !ok {
    55  		panic("the argument is not implemented caller")
    56  	}
    57  	proxy.caller174a2588b15e5a68bcb18c800d03825b = c
    58  	return proxy
    59  }
    60  
    61  func (p testImpl) Foo(s1 string, opts ...client.CallOption) (int, error) {
    62  	reps, err := p.Call("Test.Foo", opts, s1)
    63  	r0, _ := reps[0].(int)
    64  	return r0, err
    65  }
    66  
    67  func (p testImpl) Bar(s1 string, opts ...client.CallOption) (int, error) {
    68  	reps, err := p.Call("Test.Bar", opts, s1)
    69  	r0, _ := reps[0].(int)
    70  	return r0, err
    71  }
    72  
    73  func (p testImpl) NoReturnValue(i int, opts ...client.CallOption) error {
    74  	_, err := p.Call("Test.NoReturnValue", opts, i)
    75  	return err
    76  }
    77  
    78  func (p testImpl) ErrHandler(s1 string, opts ...client.CallOption) error {
    79  	_, err := p.Call("Test.ErrHandler", opts, s1)
    80  	return err
    81  }
    82  
    83  func (p testImpl) ErrHandler2(s1 string, opts ...client.CallOption) error {
    84  	_, err := p.Call("Test.ErrHandler2", opts, s1)
    85  	return err
    86  }
    87  
    88  func (p testImpl) ImportTest(l1 container.ByteSlice, opts ...client.CallOption) error {
    89  	_, err := p.Call("Test.ImportTest", opts, l1)
    90  	return err
    91  }
    92  
    93  func (p testImpl) ImportTest2(ctx context.Context, l1 container.ByteSlice, l2 *container.ByteSlice, opts ...client.CallOption) error {
    94  	_, err := p.Call("Test.ImportTest2", opts, ctx, l1, l2)
    95  	return err
    96  }
    97  
    98  func (p testImpl) Proxy2(s1 string, s2 int, opts ...client.CallOption) (*Test, int64, error) {
    99  	reps, err := p.Call("Test.Proxy2", opts, s1, s2)
   100  	r0, _ := reps[0].(*Test)
   101  	r1, _ := reps[1].(int64)
   102  	return r0, r1, err
   103  }
   104  
   105  func (p testImpl) MapCallTest(m1 map[string]map[string]byte, m2 map[string]map[string]byte, opts ...client.CallOption) (*Test, map[string]byte, error) {
   106  	reps, err := p.Call("Test.MapCallTest", opts, m1, m2)
   107  	r0, _ := reps[0].(*Test)
   108  	r1, _ := reps[1].(map[string]byte)
   109  	return r0, r1, err
   110  }
   111  
   112  func (p testImpl) CallSlice(s1 []*Test, s2 []map[string]int, opts ...client.CallOption) (bool, error) {
   113  	reps, err := p.Call("Test.CallSlice", opts, s1, s2)
   114  	r0, _ := reps[0].(bool)
   115  	return r0, err
   116  }