go.uber.org/yarpc@v1.72.1/encoding/thrift/thriftrw-plugin-yarpc/internal/tests/extends/fooclient/client.go (about)

     1  // Code generated by thriftrw-plugin-yarpc
     2  // @generated
     3  
     4  package fooclient
     5  
     6  import (
     7  	yarpc "go.uber.org/yarpc"
     8  	transport "go.uber.org/yarpc/api/transport"
     9  	thrift "go.uber.org/yarpc/encoding/thrift"
    10  	nameclient "go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc/internal/tests/extends/nameclient"
    11  	reflect "reflect"
    12  )
    13  
    14  // Interface is a client for the Foo service.
    15  type Interface interface {
    16  	nameclient.Interface
    17  }
    18  
    19  // New builds a new client for the Foo service.
    20  //
    21  //	client := fooclient.New(dispatcher.ClientConfig("foo"))
    22  func New(c transport.ClientConfig, opts ...thrift.ClientOption) Interface {
    23  	return client{
    24  		c: thrift.New(thrift.Config{
    25  			Service:      "Foo",
    26  			ClientConfig: c,
    27  		}, opts...),
    28  		nwc: thrift.NewNoWire(thrift.Config{
    29  			Service:      "Foo",
    30  			ClientConfig: c,
    31  		}, opts...),
    32  
    33  		Interface: nameclient.New(
    34  			c,
    35  			append(
    36  				opts,
    37  				thrift.Named("Foo"),
    38  			)...,
    39  		),
    40  	}
    41  }
    42  
    43  func init() {
    44  	yarpc.RegisterClientBuilder(
    45  		func(c transport.ClientConfig, f reflect.StructField) Interface {
    46  			return New(c, thrift.ClientBuilderOptions(c, f)...)
    47  		},
    48  	)
    49  }
    50  
    51  type client struct {
    52  	nameclient.Interface
    53  
    54  	c   thrift.Client
    55  	nwc thrift.NoWireClient
    56  }