INNER CODE UNIT · Go
NewFactory
go-kratos/gateway · client/factory.go:73
func NewFactory(r registry.Discovery, opts ...Option) Factory {
o := &options{
pickerBuilder: p2c.NewBuilder(),
}
for _, opt := range opts {
opt(o)
}
return func(builderCtx *BuildContext, endpoint *config.Endpoint) (Client, error) {
picker := o.pickerBuilder.Build()
ctx, cancel := context.WithCancel(context.Background())
applier := &nodeApplier{
cancel: cancel,
endpoint: endpoint,
registry: r,
picker: picker,
buildContext: builderCtx,
}
if err := applier.apply(ctx); err != nil {