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

     1  package main
     2  
     3  /*
     4     @Generator   : pxtor
     5     @CreateTime  : 2023-03-07 22:09:36.4284803 +0800 CST m=+0.007060501
     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  )
    14  
    15  var (
    16  	_ binder174a285998ba572c13bb9a3256a6b5f2 = new(client.Client)
    17  	_ caller174a285998ba572c13bb9a3256a6b5f2 = new(client.Client)
    18  	_ HelloTestProxy                         = new(helloTestImpl)
    19  )
    20  
    21  type binder174a285998ba572c13bb9a3256a6b5f2 interface {
    22  	BindFunc(source string, proxy interface{}) error
    23  }
    24  
    25  type caller174a285998ba572c13bb9a3256a6b5f2 interface {
    26  	Call(service string, opts []client.CallOption, args ...interface{}) (reps []interface{}, err error)
    27  }
    28  
    29  type HelloTestProxy interface {
    30  	GetCount(opts ...client.CallOption) (int64, *User, error)
    31  	Add(i int64, opts ...client.CallOption) error
    32  	CreateUser(ctx context.Context, user *User, opts ...client.CallOption) error
    33  	DeleteUser(ctx context.Context, uid int, opts ...client.CallOption) error
    34  	SelectUser(ctx context.Context, uid int, opts ...client.CallOption) (User, bool, error)
    35  	ModifyUser(ctx context.Context, uid int, user User, opts ...client.CallOption) (bool, error)
    36  	WaitSelectUser(ctx context.Context, uid int, opts ...client.CallOption) (*User, error)
    37  	WaitSelectUserHijack(ctx context.Context, uid int, opts ...client.CallOption) (*User, error)
    38  }
    39  
    40  type helloTestImpl struct {
    41  	caller174a285998ba572c13bb9a3256a6b5f2
    42  }
    43  
    44  func NewHelloTest(b binder174a285998ba572c13bb9a3256a6b5f2) HelloTestProxy {
    45  	proxy := new(helloTestImpl)
    46  	err := b.BindFunc("HelloTest", proxy)
    47  	if err != nil {
    48  		panic(err)
    49  	}
    50  	c, ok := b.(caller174a285998ba572c13bb9a3256a6b5f2)
    51  	if !ok {
    52  		panic("the argument is not implemented caller")
    53  	}
    54  	proxy.caller174a285998ba572c13bb9a3256a6b5f2 = c
    55  	return proxy
    56  }
    57  
    58  func (p helloTestImpl) GetCount(opts ...client.CallOption) (int64, *User, error) {
    59  	reps, err := p.Call("HelloTest.GetCount", opts)
    60  	r0, _ := reps[0].(int64)
    61  	r1, _ := reps[1].(*User)
    62  	return r0, r1, err
    63  }
    64  
    65  func (p helloTestImpl) Add(i int64, opts ...client.CallOption) error {
    66  	_, err := p.Call("HelloTest.Add", opts, i)
    67  	return err
    68  }
    69  
    70  func (p helloTestImpl) CreateUser(ctx context.Context, user *User, opts ...client.CallOption) error {
    71  	_, err := p.Call("HelloTest.CreateUser", opts, ctx, user)
    72  	return err
    73  }
    74  
    75  func (p helloTestImpl) DeleteUser(ctx context.Context, uid int, opts ...client.CallOption) error {
    76  	_, err := p.Call("HelloTest.DeleteUser", opts, ctx, uid)
    77  	return err
    78  }
    79  
    80  func (p helloTestImpl) SelectUser(ctx context.Context, uid int, opts ...client.CallOption) (User, bool, error) {
    81  	reps, err := p.Call("HelloTest.SelectUser", opts, ctx, uid)
    82  	r0, _ := reps[0].(User)
    83  	r1, _ := reps[1].(bool)
    84  	return r0, r1, err
    85  }
    86  
    87  func (p helloTestImpl) ModifyUser(ctx context.Context, uid int, user User, opts ...client.CallOption) (bool, error) {
    88  	reps, err := p.Call("HelloTest.ModifyUser", opts, ctx, uid, user)
    89  	r0, _ := reps[0].(bool)
    90  	return r0, err
    91  }
    92  
    93  func (p helloTestImpl) WaitSelectUser(ctx context.Context, uid int, opts ...client.CallOption) (*User, error) {
    94  	reps, err := p.Call("HelloTest.WaitSelectUser", opts, ctx, uid)
    95  	r0, _ := reps[0].(*User)
    96  	return r0, err
    97  }
    98  
    99  func (p helloTestImpl) WaitSelectUserHijack(ctx context.Context, uid int, opts ...client.CallOption) (*User, error) {
   100  	reps, err := p.Call("HelloTest.WaitSelectUserHijack", opts, ctx, uid)
   101  	r0, _ := reps[0].(*User)
   102  	return r0, err
   103  }