// Code generated by gtrace. DO NOT EDIT.

package trace

import (
	"context"
)

// driverComposeOptions is a holder of options
type driverComposeOptions struct {
	panicCallback func(e interface{})
}

// DriverOption specified Driver compose option
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
type DriverComposeOption func(o *driverComposeOptions)

// WithDriverPanicCallback specified behavior on panic
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func WithDriverPanicCallback(cb func(e interface{})) DriverComposeOption {
	return func(o *driverComposeOptions) {
		o.panicCallback = cb
	}
}

// Compose returns a new Driver which has functional fields composed both from t and x.
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func (t *Driver) Compose(x *Driver, opts ...DriverComposeOption) *Driver {
	if t == nil {
		return x
	}
	var ret Driver
	options := driverComposeOptions{}
	for _, opt := range opts {
		if opt != nil {
			opt(&options)
		}
	}
	{
		h1 := t.OnInit
		h2 := x.OnInit
		ret.OnInit = func(d DriverInitStartInfo) func(DriverInitDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverInitDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverInitDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnWith
		h2 := x.OnWith
		ret.OnWith = func(d DriverWithStartInfo) func(DriverWithDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverWithDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverWithDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnClose
		h2 := x.OnClose
		ret.OnClose = func(d DriverCloseStartInfo) func(DriverCloseDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverCloseDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverCloseDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnPoolNew
		h2 := x.OnPoolNew
		ret.OnPoolNew = func(d DriverConnPoolNewStartInfo) func(DriverConnPoolNewDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverConnPoolNewDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverConnPoolNewDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnPoolRelease
		h2 := x.OnPoolRelease
		ret.OnPoolRelease = func(d DriverConnPoolReleaseStartInfo) func(DriverConnPoolReleaseDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverConnPoolReleaseDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverConnPoolReleaseDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnResolve
		h2 := x.OnResolve
		ret.OnResolve = func(d DriverResolveStartInfo) func(DriverResolveDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverResolveDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverResolveDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnConnStateChange
		h2 := x.OnConnStateChange
		ret.OnConnStateChange = func(d DriverConnStateChangeStartInfo) func(DriverConnStateChangeDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverConnStateChangeDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverConnStateChangeDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnConnInvoke
		h2 := x.OnConnInvoke
		ret.OnConnInvoke = func(d DriverConnInvokeStartInfo) func(DriverConnInvokeDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverConnInvokeDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverConnInvokeDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnConnNewStream
		h2 := x.OnConnNewStream
		ret.OnConnNewStream = func(d DriverConnNewStreamStartInfo) func(DriverConnNewStreamDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverConnNewStreamDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverConnNewStreamDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnConnStreamRecvMsg
		h2 := x.OnConnStreamRecvMsg
		ret.OnConnStreamRecvMsg = func(d DriverConnStreamRecvMsgStartInfo) func(DriverConnStreamRecvMsgDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverConnStreamRecvMsgDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverConnStreamRecvMsgDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnConnStreamSendMsg
		h2 := x.OnConnStreamSendMsg
		ret.OnConnStreamSendMsg = func(d DriverConnStreamSendMsgStartInfo) func(DriverConnStreamSendMsgDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverConnStreamSendMsgDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverConnStreamSendMsgDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnConnStreamCloseSend
		h2 := x.OnConnStreamCloseSend
		ret.OnConnStreamCloseSend = func(d DriverConnStreamCloseSendStartInfo) func(DriverConnStreamCloseSendDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverConnStreamCloseSendDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverConnStreamCloseSendDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnConnStreamFinish
		h2 := x.OnConnStreamFinish
		ret.OnConnStreamFinish = func(info DriverConnStreamFinishInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			if h1 != nil {
				h1(info)
			}
			if h2 != nil {
				h2(info)
			}
		}
	}
	{
		h1 := t.OnConnDial
		h2 := x.OnConnDial
		ret.OnConnDial = func(d DriverConnDialStartInfo) func(DriverConnDialDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverConnDialDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverConnDialDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnConnBan
		h2 := x.OnConnBan
		ret.OnConnBan = func(d DriverConnBanStartInfo) func(DriverConnBanDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverConnBanDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverConnBanDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnConnAllow
		h2 := x.OnConnAllow
		ret.OnConnAllow = func(d DriverConnAllowStartInfo) func(DriverConnAllowDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverConnAllowDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverConnAllowDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnConnPark
		h2 := x.OnConnPark
		ret.OnConnPark = func(d DriverConnParkStartInfo) func(DriverConnParkDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverConnParkDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverConnParkDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnConnClose
		h2 := x.OnConnClose
		ret.OnConnClose = func(d DriverConnCloseStartInfo) func(DriverConnCloseDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverConnCloseDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverConnCloseDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnRepeaterWakeUp
		h2 := x.OnRepeaterWakeUp
		ret.OnRepeaterWakeUp = func(d DriverRepeaterWakeUpStartInfo) func(DriverRepeaterWakeUpDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverRepeaterWakeUpDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverRepeaterWakeUpDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnBalancerInit
		h2 := x.OnBalancerInit
		ret.OnBalancerInit = func(d DriverBalancerInitStartInfo) func(DriverBalancerInitDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverBalancerInitDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverBalancerInitDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnBalancerClose
		h2 := x.OnBalancerClose
		ret.OnBalancerClose = func(d DriverBalancerCloseStartInfo) func(DriverBalancerCloseDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverBalancerCloseDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverBalancerCloseDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnBalancerChooseEndpoint
		h2 := x.OnBalancerChooseEndpoint
		ret.OnBalancerChooseEndpoint = func(d DriverBalancerChooseEndpointStartInfo) func(DriverBalancerChooseEndpointDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverBalancerChooseEndpointDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverBalancerChooseEndpointDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnBalancerClusterDiscoveryAttempt
		h2 := x.OnBalancerClusterDiscoveryAttempt
		ret.OnBalancerClusterDiscoveryAttempt = func(d DriverBalancerClusterDiscoveryAttemptStartInfo) func(DriverBalancerClusterDiscoveryAttemptDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverBalancerClusterDiscoveryAttemptDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverBalancerClusterDiscoveryAttemptDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnBalancerUpdate
		h2 := x.OnBalancerUpdate
		ret.OnBalancerUpdate = func(d DriverBalancerUpdateStartInfo) func(DriverBalancerUpdateDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverBalancerUpdateDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverBalancerUpdateDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	{
		h1 := t.OnGetCredentials
		h2 := x.OnGetCredentials
		ret.OnGetCredentials = func(d DriverGetCredentialsStartInfo) func(DriverGetCredentialsDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(DriverGetCredentialsDoneInfo)
			if h1 != nil {
				r = h1(d)
			}
			if h2 != nil {
				r1 = h2(d)
			}
			return func(d DriverGetCredentialsDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(d)
				}
				if r1 != nil {
					r1(d)
				}
			}
		}
	}
	return &ret
}
func (t *Driver) onInit(d DriverInitStartInfo) func(DriverInitDoneInfo) {
	fn := t.OnInit
	if fn == nil {
		return func(DriverInitDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverInitDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onWith(d DriverWithStartInfo) func(DriverWithDoneInfo) {
	fn := t.OnWith
	if fn == nil {
		return func(DriverWithDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverWithDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onClose(d DriverCloseStartInfo) func(DriverCloseDoneInfo) {
	fn := t.OnClose
	if fn == nil {
		return func(DriverCloseDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverCloseDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onPoolNew(d DriverConnPoolNewStartInfo) func(DriverConnPoolNewDoneInfo) {
	fn := t.OnPoolNew
	if fn == nil {
		return func(DriverConnPoolNewDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverConnPoolNewDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onPoolRelease(d DriverConnPoolReleaseStartInfo) func(DriverConnPoolReleaseDoneInfo) {
	fn := t.OnPoolRelease
	if fn == nil {
		return func(DriverConnPoolReleaseDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverConnPoolReleaseDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onResolve(d DriverResolveStartInfo) func(DriverResolveDoneInfo) {
	fn := t.OnResolve
	if fn == nil {
		return func(DriverResolveDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverResolveDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onConnStateChange(d DriverConnStateChangeStartInfo) func(DriverConnStateChangeDoneInfo) {
	fn := t.OnConnStateChange
	if fn == nil {
		return func(DriverConnStateChangeDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverConnStateChangeDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onConnInvoke(d DriverConnInvokeStartInfo) func(DriverConnInvokeDoneInfo) {
	fn := t.OnConnInvoke
	if fn == nil {
		return func(DriverConnInvokeDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverConnInvokeDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onConnNewStream(d DriverConnNewStreamStartInfo) func(DriverConnNewStreamDoneInfo) {
	fn := t.OnConnNewStream
	if fn == nil {
		return func(DriverConnNewStreamDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverConnNewStreamDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onConnStreamRecvMsg(d DriverConnStreamRecvMsgStartInfo) func(DriverConnStreamRecvMsgDoneInfo) {
	fn := t.OnConnStreamRecvMsg
	if fn == nil {
		return func(DriverConnStreamRecvMsgDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverConnStreamRecvMsgDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onConnStreamSendMsg(d DriverConnStreamSendMsgStartInfo) func(DriverConnStreamSendMsgDoneInfo) {
	fn := t.OnConnStreamSendMsg
	if fn == nil {
		return func(DriverConnStreamSendMsgDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverConnStreamSendMsgDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onConnStreamCloseSend(d DriverConnStreamCloseSendStartInfo) func(DriverConnStreamCloseSendDoneInfo) {
	fn := t.OnConnStreamCloseSend
	if fn == nil {
		return func(DriverConnStreamCloseSendDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverConnStreamCloseSendDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onConnStreamFinish(info DriverConnStreamFinishInfo) {
	fn := t.OnConnStreamFinish
	if fn == nil {
		return
	}
	fn(info)
}
func (t *Driver) onConnDial(d DriverConnDialStartInfo) func(DriverConnDialDoneInfo) {
	fn := t.OnConnDial
	if fn == nil {
		return func(DriverConnDialDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverConnDialDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onConnBan(d DriverConnBanStartInfo) func(DriverConnBanDoneInfo) {
	fn := t.OnConnBan
	if fn == nil {
		return func(DriverConnBanDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverConnBanDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onConnAllow(d DriverConnAllowStartInfo) func(DriverConnAllowDoneInfo) {
	fn := t.OnConnAllow
	if fn == nil {
		return func(DriverConnAllowDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverConnAllowDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onConnPark(d DriverConnParkStartInfo) func(DriverConnParkDoneInfo) {
	fn := t.OnConnPark
	if fn == nil {
		return func(DriverConnParkDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverConnParkDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onConnClose(d DriverConnCloseStartInfo) func(DriverConnCloseDoneInfo) {
	fn := t.OnConnClose
	if fn == nil {
		return func(DriverConnCloseDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverConnCloseDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onRepeaterWakeUp(d DriverRepeaterWakeUpStartInfo) func(DriverRepeaterWakeUpDoneInfo) {
	fn := t.OnRepeaterWakeUp
	if fn == nil {
		return func(DriverRepeaterWakeUpDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverRepeaterWakeUpDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onBalancerInit(d DriverBalancerInitStartInfo) func(DriverBalancerInitDoneInfo) {
	fn := t.OnBalancerInit
	if fn == nil {
		return func(DriverBalancerInitDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverBalancerInitDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onBalancerClose(d DriverBalancerCloseStartInfo) func(DriverBalancerCloseDoneInfo) {
	fn := t.OnBalancerClose
	if fn == nil {
		return func(DriverBalancerCloseDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverBalancerCloseDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onBalancerChooseEndpoint(d DriverBalancerChooseEndpointStartInfo) func(DriverBalancerChooseEndpointDoneInfo) {
	fn := t.OnBalancerChooseEndpoint
	if fn == nil {
		return func(DriverBalancerChooseEndpointDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverBalancerChooseEndpointDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onBalancerClusterDiscoveryAttempt(d DriverBalancerClusterDiscoveryAttemptStartInfo) func(DriverBalancerClusterDiscoveryAttemptDoneInfo) {
	fn := t.OnBalancerClusterDiscoveryAttempt
	if fn == nil {
		return func(DriverBalancerClusterDiscoveryAttemptDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverBalancerClusterDiscoveryAttemptDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onBalancerUpdate(d DriverBalancerUpdateStartInfo) func(DriverBalancerUpdateDoneInfo) {
	fn := t.OnBalancerUpdate
	if fn == nil {
		return func(DriverBalancerUpdateDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverBalancerUpdateDoneInfo) {
			return
		}
	}
	return res
}
func (t *Driver) onGetCredentials(d DriverGetCredentialsStartInfo) func(DriverGetCredentialsDoneInfo) {
	fn := t.OnGetCredentials
	if fn == nil {
		return func(DriverGetCredentialsDoneInfo) {
			return
		}
	}
	res := fn(d)
	if res == nil {
		return func(DriverGetCredentialsDoneInfo) {
			return
		}
	}
	return res
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnInit(t *Driver, c *context.Context, call call, endpoint string, database string, secure bool) func(error) {
	var p DriverInitStartInfo
	p.Context = c
	p.Call = call
	p.Endpoint = endpoint
	p.Database = database
	p.Secure = secure
	res := t.onInit(p)
	return func(e error) {
		var p DriverInitDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnWith(t *Driver, c *context.Context, call call, endpoint string, database string, secure bool) func(error) {
	var p DriverWithStartInfo
	p.Context = c
	p.Call = call
	p.Endpoint = endpoint
	p.Database = database
	p.Secure = secure
	res := t.onWith(p)
	return func(e error) {
		var p DriverWithDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnClose(t *Driver, c *context.Context, call call) func(error) {
	var p DriverCloseStartInfo
	p.Context = c
	p.Call = call
	res := t.onClose(p)
	return func(e error) {
		var p DriverCloseDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnPoolNew(t *Driver, c *context.Context, call call) func() {
	var p DriverConnPoolNewStartInfo
	p.Context = c
	p.Call = call
	res := t.onPoolNew(p)
	return func() {
		var p DriverConnPoolNewDoneInfo
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnPoolRelease(t *Driver, c *context.Context, call call) func(error) {
	var p DriverConnPoolReleaseStartInfo
	p.Context = c
	p.Call = call
	res := t.onPoolRelease(p)
	return func(e error) {
		var p DriverConnPoolReleaseDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnResolve(t *Driver, call call, target string, resolved []string) func(error) {
	var p DriverResolveStartInfo
	p.Call = call
	p.Target = target
	p.Resolved = resolved
	res := t.onResolve(p)
	return func(e error) {
		var p DriverResolveDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnConnStateChange(t *Driver, c *context.Context, call call, endpoint EndpointInfo, state ConnState) func(state ConnState) {
	var p DriverConnStateChangeStartInfo
	p.Context = c
	p.Call = call
	p.Endpoint = endpoint
	p.State = state
	res := t.onConnStateChange(p)
	return func(state ConnState) {
		var p DriverConnStateChangeDoneInfo
		p.State = state
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnConnInvoke(t *Driver, c *context.Context, call call, endpoint EndpointInfo, m Method) func(_ error, issues []Issue, opID string, state ConnState, metadata map[string][]string) {
	var p DriverConnInvokeStartInfo
	p.Context = c
	p.Call = call
	p.Endpoint = endpoint
	p.Method = m
	res := t.onConnInvoke(p)
	return func(e error, issues []Issue, opID string, state ConnState, metadata map[string][]string) {
		var p DriverConnInvokeDoneInfo
		p.Error = e
		p.Issues = issues
		p.OpID = opID
		p.State = state
		p.Metadata = metadata
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnConnNewStream(t *Driver, c *context.Context, call call, endpoint EndpointInfo, m Method) func(_ error, state ConnState) {
	var p DriverConnNewStreamStartInfo
	p.Context = c
	p.Call = call
	p.Endpoint = endpoint
	p.Method = m
	res := t.onConnNewStream(p)
	return func(e error, state ConnState) {
		var p DriverConnNewStreamDoneInfo
		p.Error = e
		p.State = state
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnConnStreamRecvMsg(t *Driver, c *context.Context, call call) func(error) {
	var p DriverConnStreamRecvMsgStartInfo
	p.Context = c
	p.Call = call
	res := t.onConnStreamRecvMsg(p)
	return func(e error) {
		var p DriverConnStreamRecvMsgDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnConnStreamSendMsg(t *Driver, c *context.Context, call call) func(error) {
	var p DriverConnStreamSendMsgStartInfo
	p.Context = c
	p.Call = call
	res := t.onConnStreamSendMsg(p)
	return func(e error) {
		var p DriverConnStreamSendMsgDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnConnStreamCloseSend(t *Driver, c *context.Context, call call) func(error) {
	var p DriverConnStreamCloseSendStartInfo
	p.Context = c
	p.Call = call
	res := t.onConnStreamCloseSend(p)
	return func(e error) {
		var p DriverConnStreamCloseSendDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnConnStreamFinish(t *Driver, c context.Context, call call, e error) {
	var p DriverConnStreamFinishInfo
	p.Context = c
	p.Call = call
	p.Error = e
	t.onConnStreamFinish(p)
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnConnDial(t *Driver, c *context.Context, call call, endpoint EndpointInfo) func(error) {
	var p DriverConnDialStartInfo
	p.Context = c
	p.Call = call
	p.Endpoint = endpoint
	res := t.onConnDial(p)
	return func(e error) {
		var p DriverConnDialDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnConnBan(t *Driver, c *context.Context, call call, endpoint EndpointInfo, state ConnState, cause error) func(state ConnState) {
	var p DriverConnBanStartInfo
	p.Context = c
	p.Call = call
	p.Endpoint = endpoint
	p.State = state
	p.Cause = cause
	res := t.onConnBan(p)
	return func(state ConnState) {
		var p DriverConnBanDoneInfo
		p.State = state
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnConnAllow(t *Driver, c *context.Context, call call, endpoint EndpointInfo, state ConnState) func(state ConnState) {
	var p DriverConnAllowStartInfo
	p.Context = c
	p.Call = call
	p.Endpoint = endpoint
	p.State = state
	res := t.onConnAllow(p)
	return func(state ConnState) {
		var p DriverConnAllowDoneInfo
		p.State = state
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnConnPark(t *Driver, c *context.Context, call call, endpoint EndpointInfo) func(error) {
	var p DriverConnParkStartInfo
	p.Context = c
	p.Call = call
	p.Endpoint = endpoint
	res := t.onConnPark(p)
	return func(e error) {
		var p DriverConnParkDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnConnClose(t *Driver, c *context.Context, call call, endpoint EndpointInfo) func(error) {
	var p DriverConnCloseStartInfo
	p.Context = c
	p.Call = call
	p.Endpoint = endpoint
	res := t.onConnClose(p)
	return func(e error) {
		var p DriverConnCloseDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnRepeaterWakeUp(t *Driver, c *context.Context, call call, name string, event string) func(error) {
	var p DriverRepeaterWakeUpStartInfo
	p.Context = c
	p.Call = call
	p.Name = name
	p.Event = event
	res := t.onRepeaterWakeUp(p)
	return func(e error) {
		var p DriverRepeaterWakeUpDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnBalancerInit(t *Driver, c *context.Context, call call, name string) func(error) {
	var p DriverBalancerInitStartInfo
	p.Context = c
	p.Call = call
	p.Name = name
	res := t.onBalancerInit(p)
	return func(e error) {
		var p DriverBalancerInitDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnBalancerClose(t *Driver, c *context.Context, call call) func(error) {
	var p DriverBalancerCloseStartInfo
	p.Context = c
	p.Call = call
	res := t.onBalancerClose(p)
	return func(e error) {
		var p DriverBalancerCloseDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnBalancerChooseEndpoint(t *Driver, c *context.Context, call call) func(endpoint EndpointInfo, _ error) {
	var p DriverBalancerChooseEndpointStartInfo
	p.Context = c
	p.Call = call
	res := t.onBalancerChooseEndpoint(p)
	return func(endpoint EndpointInfo, e error) {
		var p DriverBalancerChooseEndpointDoneInfo
		p.Endpoint = endpoint
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnBalancerClusterDiscoveryAttempt(t *Driver, c *context.Context, call call, address string, database string) func(error) {
	var p DriverBalancerClusterDiscoveryAttemptStartInfo
	p.Context = c
	p.Call = call
	p.Address = address
	p.Database = database
	res := t.onBalancerClusterDiscoveryAttempt(p)
	return func(e error) {
		var p DriverBalancerClusterDiscoveryAttemptDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnBalancerUpdate(t *Driver, c *context.Context, call call, needLocalDC bool, database string) func(endpoints []EndpointInfo, added []EndpointInfo, dropped []EndpointInfo, localDC string) {
	var p DriverBalancerUpdateStartInfo
	p.Context = c
	p.Call = call
	p.NeedLocalDC = needLocalDC
	p.Database = database
	res := t.onBalancerUpdate(p)
	return func(endpoints []EndpointInfo, added []EndpointInfo, dropped []EndpointInfo, localDC string) {
		var p DriverBalancerUpdateDoneInfo
		p.Endpoints = endpoints
		p.Added = added
		p.Dropped = dropped
		p.LocalDC = localDC
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func DriverOnGetCredentials(t *Driver, c *context.Context, call call) func(token string, _ error) {
	var p DriverGetCredentialsStartInfo
	p.Context = c
	p.Call = call
	res := t.onGetCredentials(p)
	return func(token string, e error) {
		var p DriverGetCredentialsDoneInfo
		p.Token = token
		p.Error = e
		res(p)
	}
}
