// Code generated by gtrace. DO NOT EDIT.

package gtrace

import (
	"context"

	"github.com/ydb-platform/ydb-go-genproto/protos/Ydb_TableStats"
	"github.com/ydb-platform/ydb-go-sdk/v3/trace"
)

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

// QueryOption specified Query compose option
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
type QueryComposeOption func(o *queryComposeOptions)

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

// Compose returns a new Query which has functional fields composed both from lhs and rhs.
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func Compose(lhs *trace.Query, rhs *trace.Query, opts ...QueryComposeOption) *trace.Query {
	if lhs == nil {
		return rhs
	}
	var ret trace.Query
	options := queryComposeOptions{}
	for _, opt := range opts {
		if opt != nil {
			opt(&options)
		}
	}
	{
		h1 := lhs.OnNew
		h2 := rhs.OnNew
		ret.OnNew = func(q trace.QueryNewStartInfo) func(trace.QueryNewDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryNewDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(info trace.QueryNewDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(info)
				}
				if r1 != nil {
					r1(info)
				}
			}
		}
	}
	{
		h1 := lhs.OnClose
		h2 := rhs.OnClose
		ret.OnClose = func(q trace.QueryCloseStartInfo) func(trace.QueryCloseDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryCloseDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(info trace.QueryCloseDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(info)
				}
				if r1 != nil {
					r1(info)
				}
			}
		}
	}
	{
		h1 := lhs.OnPoolNew
		h2 := rhs.OnPoolNew
		ret.OnPoolNew = func(q trace.QueryPoolNewStartInfo) func(trace.QueryPoolNewDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryPoolNewDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QueryPoolNewDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnPoolClose
		h2 := rhs.OnPoolClose
		ret.OnPoolClose = func(q trace.QueryPoolCloseStartInfo) func(trace.QueryPoolCloseDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryPoolCloseDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QueryPoolCloseDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnPoolTry
		h2 := rhs.OnPoolTry
		ret.OnPoolTry = func(q trace.QueryPoolTryStartInfo) func(trace.QueryPoolTryDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryPoolTryDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QueryPoolTryDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnPoolWith
		h2 := rhs.OnPoolWith
		ret.OnPoolWith = func(q trace.QueryPoolWithStartInfo) func(trace.QueryPoolWithDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryPoolWithDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QueryPoolWithDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnPoolPut
		h2 := rhs.OnPoolPut
		ret.OnPoolPut = func(q trace.QueryPoolPutStartInfo) func(trace.QueryPoolPutDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryPoolPutDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QueryPoolPutDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnPoolGet
		h2 := rhs.OnPoolGet
		ret.OnPoolGet = func(q trace.QueryPoolGetStartInfo) func(trace.QueryPoolGetDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryPoolGetDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QueryPoolGetDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnPoolChange
		h2 := rhs.OnPoolChange
		ret.OnPoolChange = func(q trace.QueryPoolChange) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			if h1 != nil {
				h1(q)
			}
			if h2 != nil {
				h2(q)
			}
		}
	}
	{
		h1 := lhs.OnDo
		h2 := rhs.OnDo
		ret.OnDo = func(q trace.QueryDoStartInfo) func(trace.QueryDoDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryDoDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QueryDoDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnDoTx
		h2 := rhs.OnDoTx
		ret.OnDoTx = func(q trace.QueryDoTxStartInfo) func(trace.QueryDoTxDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryDoTxDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QueryDoTxDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnExec
		h2 := rhs.OnExec
		ret.OnExec = func(q trace.QueryExecStartInfo) func(trace.QueryExecDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryExecDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QueryExecDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnQuery
		h2 := rhs.OnQuery
		ret.OnQuery = func(q trace.QueryQueryStartInfo) func(trace.QueryQueryDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryQueryDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QueryQueryDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnQueryResultSet
		h2 := rhs.OnQueryResultSet
		ret.OnQueryResultSet = func(q trace.QueryQueryResultSetStartInfo) func(trace.QueryQueryResultSetDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryQueryResultSetDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QueryQueryResultSetDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnQueryRow
		h2 := rhs.OnQueryRow
		ret.OnQueryRow = func(q trace.QueryQueryRowStartInfo) func(trace.QueryQueryRowDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryQueryRowDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QueryQueryRowDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnSessionCreate
		h2 := rhs.OnSessionCreate
		ret.OnSessionCreate = func(q trace.QuerySessionCreateStartInfo) func(trace.QuerySessionCreateDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QuerySessionCreateDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(info trace.QuerySessionCreateDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(info)
				}
				if r1 != nil {
					r1(info)
				}
			}
		}
	}
	{
		h1 := lhs.OnSessionAttach
		h2 := rhs.OnSessionAttach
		ret.OnSessionAttach = func(q trace.QuerySessionAttachStartInfo) func(trace.QuerySessionAttachDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QuerySessionAttachDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(info trace.QuerySessionAttachDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(info)
				}
				if r1 != nil {
					r1(info)
				}
			}
		}
	}
	{
		h1 := lhs.OnSessionDelete
		h2 := rhs.OnSessionDelete
		ret.OnSessionDelete = func(q trace.QuerySessionDeleteStartInfo) func(trace.QuerySessionDeleteDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QuerySessionDeleteDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(info trace.QuerySessionDeleteDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(info)
				}
				if r1 != nil {
					r1(info)
				}
			}
		}
	}
	{
		h1 := lhs.OnSessionExec
		h2 := rhs.OnSessionExec
		ret.OnSessionExec = func(q trace.QuerySessionExecStartInfo) func(trace.QuerySessionExecDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QuerySessionExecDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(info trace.QuerySessionExecDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(info)
				}
				if r1 != nil {
					r1(info)
				}
			}
		}
	}
	{
		h1 := lhs.OnSessionQuery
		h2 := rhs.OnSessionQuery
		ret.OnSessionQuery = func(q trace.QuerySessionQueryStartInfo) func(trace.QuerySessionQueryDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QuerySessionQueryDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(info trace.QuerySessionQueryDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(info)
				}
				if r1 != nil {
					r1(info)
				}
			}
		}
	}
	{
		h1 := lhs.OnSessionQueryResultSet
		h2 := rhs.OnSessionQueryResultSet
		ret.OnSessionQueryResultSet = func(q trace.QuerySessionQueryResultSetStartInfo) func(trace.QuerySessionQueryResultSetDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QuerySessionQueryResultSetDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QuerySessionQueryResultSetDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnSessionQueryRow
		h2 := rhs.OnSessionQueryRow
		ret.OnSessionQueryRow = func(q trace.QuerySessionQueryRowStartInfo) func(trace.QuerySessionQueryRowDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QuerySessionQueryRowDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QuerySessionQueryRowDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnSessionBegin
		h2 := rhs.OnSessionBegin
		ret.OnSessionBegin = func(q trace.QuerySessionBeginStartInfo) func(trace.QuerySessionBeginDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QuerySessionBeginDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(info trace.QuerySessionBeginDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(info)
				}
				if r1 != nil {
					r1(info)
				}
			}
		}
	}
	{
		h1 := lhs.OnSessionBeginTransaction
		h2 := rhs.OnSessionBeginTransaction
		ret.OnSessionBeginTransaction = func(q trace.QuerySessionBeginTransactionStartInfo) func(trace.QuerySessionBeginTransactionDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QuerySessionBeginTransactionDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QuerySessionBeginTransactionDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnTxCommit
		h2 := rhs.OnTxCommit
		ret.OnTxCommit = func(q trace.QueryTxCommitStartInfo) func(trace.QueryTxCommitDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryTxCommitDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(info trace.QueryTxCommitDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(info)
				}
				if r1 != nil {
					r1(info)
				}
			}
		}
	}
	{
		h1 := lhs.OnTxRollback
		h2 := rhs.OnTxRollback
		ret.OnTxRollback = func(q trace.QueryTxRollbackStartInfo) func(trace.QueryTxRollbackDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryTxRollbackDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(info trace.QueryTxRollbackDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(info)
				}
				if r1 != nil {
					r1(info)
				}
			}
		}
	}
	{
		h1 := lhs.OnTxExec
		h2 := rhs.OnTxExec
		ret.OnTxExec = func(q trace.QueryTxExecStartInfo) func(trace.QueryTxExecDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryTxExecDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(info trace.QueryTxExecDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(info)
				}
				if r1 != nil {
					r1(info)
				}
			}
		}
	}
	{
		h1 := lhs.OnTxQuery
		h2 := rhs.OnTxQuery
		ret.OnTxQuery = func(q trace.QueryTxQueryStartInfo) func(trace.QueryTxQueryDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryTxQueryDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(info trace.QueryTxQueryDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(info)
				}
				if r1 != nil {
					r1(info)
				}
			}
		}
	}
	{
		h1 := lhs.OnTxQueryResultSet
		h2 := rhs.OnTxQueryResultSet
		ret.OnTxQueryResultSet = func(q trace.QueryTxQueryResultSetStartInfo) func(trace.QueryTxQueryResultSetDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryTxQueryResultSetDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QueryTxQueryResultSetDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnTxQueryRow
		h2 := rhs.OnTxQueryRow
		ret.OnTxQueryRow = func(q trace.QueryTxQueryRowStartInfo) func(trace.QueryTxQueryRowDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryTxQueryRowDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(q trace.QueryTxQueryRowDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(q)
				}
				if r1 != nil {
					r1(q)
				}
			}
		}
	}
	{
		h1 := lhs.OnResultNew
		h2 := rhs.OnResultNew
		ret.OnResultNew = func(q trace.QueryResultNewStartInfo) func(trace.QueryResultNewDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryResultNewDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(info trace.QueryResultNewDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(info)
				}
				if r1 != nil {
					r1(info)
				}
			}
		}
	}
	{
		h1 := lhs.OnResultNextPart
		h2 := rhs.OnResultNextPart
		ret.OnResultNextPart = func(q trace.QueryResultNextPartStartInfo) func(trace.QueryResultNextPartDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryResultNextPartDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(info trace.QueryResultNextPartDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(info)
				}
				if r1 != nil {
					r1(info)
				}
			}
		}
	}
	{
		h1 := lhs.OnResultNextResultSet
		h2 := rhs.OnResultNextResultSet
		ret.OnResultNextResultSet = func(q trace.QueryResultNextResultSetStartInfo) func(trace.QueryResultNextResultSetDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryResultNextResultSetDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(info trace.QueryResultNextResultSetDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(info)
				}
				if r1 != nil {
					r1(info)
				}
			}
		}
	}
	{
		h1 := lhs.OnResultClose
		h2 := rhs.OnResultClose
		ret.OnResultClose = func(q trace.QueryResultCloseStartInfo) func(trace.QueryResultCloseDoneInfo) {
			if options.panicCallback != nil {
				defer func() {
					if e := recover(); e != nil {
						options.panicCallback(e)
					}
				}()
			}
			var r, r1 func(trace.QueryResultCloseDoneInfo)
			if h1 != nil {
				r = h1(q)
			}
			if h2 != nil {
				r1 = h2(q)
			}
			return func(info trace.QueryResultCloseDoneInfo) {
				if options.panicCallback != nil {
					defer func() {
						if e := recover(); e != nil {
							options.panicCallback(e)
						}
					}()
				}
				if r != nil {
					r(info)
				}
				if r1 != nil {
					r1(info)
				}
			}
		}
	}
	return &ret
}
func onNew(t *trace.Query, q trace.QueryNewStartInfo) func(info trace.QueryNewDoneInfo) {
	fn := t.OnNew
	if fn == nil {
		return func(trace.QueryNewDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryNewDoneInfo) {
			return
		}
	}
	return res
}
func onClose(t *trace.Query, q trace.QueryCloseStartInfo) func(info trace.QueryCloseDoneInfo) {
	fn := t.OnClose
	if fn == nil {
		return func(trace.QueryCloseDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryCloseDoneInfo) {
			return
		}
	}
	return res
}
func onPoolNew(t *trace.Query, q trace.QueryPoolNewStartInfo) func(trace.QueryPoolNewDoneInfo) {
	fn := t.OnPoolNew
	if fn == nil {
		return func(trace.QueryPoolNewDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryPoolNewDoneInfo) {
			return
		}
	}
	return res
}
func onPoolClose(t *trace.Query, q trace.QueryPoolCloseStartInfo) func(trace.QueryPoolCloseDoneInfo) {
	fn := t.OnPoolClose
	if fn == nil {
		return func(trace.QueryPoolCloseDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryPoolCloseDoneInfo) {
			return
		}
	}
	return res
}
func onPoolTry(t *trace.Query, q trace.QueryPoolTryStartInfo) func(trace.QueryPoolTryDoneInfo) {
	fn := t.OnPoolTry
	if fn == nil {
		return func(trace.QueryPoolTryDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryPoolTryDoneInfo) {
			return
		}
	}
	return res
}
func onPoolWith(t *trace.Query, q trace.QueryPoolWithStartInfo) func(trace.QueryPoolWithDoneInfo) {
	fn := t.OnPoolWith
	if fn == nil {
		return func(trace.QueryPoolWithDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryPoolWithDoneInfo) {
			return
		}
	}
	return res
}
func onPoolPut(t *trace.Query, q trace.QueryPoolPutStartInfo) func(trace.QueryPoolPutDoneInfo) {
	fn := t.OnPoolPut
	if fn == nil {
		return func(trace.QueryPoolPutDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryPoolPutDoneInfo) {
			return
		}
	}
	return res
}
func onPoolGet(t *trace.Query, q trace.QueryPoolGetStartInfo) func(trace.QueryPoolGetDoneInfo) {
	fn := t.OnPoolGet
	if fn == nil {
		return func(trace.QueryPoolGetDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryPoolGetDoneInfo) {
			return
		}
	}
	return res
}
func onPoolChange(t *trace.Query, q trace.QueryPoolChange) {
	fn := t.OnPoolChange
	if fn == nil {
		return
	}
	fn(q)
}
func onDo(t *trace.Query, q trace.QueryDoStartInfo) func(trace.QueryDoDoneInfo) {
	fn := t.OnDo
	if fn == nil {
		return func(trace.QueryDoDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryDoDoneInfo) {
			return
		}
	}
	return res
}
func onDoTx(t *trace.Query, q trace.QueryDoTxStartInfo) func(trace.QueryDoTxDoneInfo) {
	fn := t.OnDoTx
	if fn == nil {
		return func(trace.QueryDoTxDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryDoTxDoneInfo) {
			return
		}
	}
	return res
}
func onExec(t *trace.Query, q trace.QueryExecStartInfo) func(trace.QueryExecDoneInfo) {
	fn := t.OnExec
	if fn == nil {
		return func(trace.QueryExecDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryExecDoneInfo) {
			return
		}
	}
	return res
}
func onQuery(t *trace.Query, q trace.QueryQueryStartInfo) func(trace.QueryQueryDoneInfo) {
	fn := t.OnQuery
	if fn == nil {
		return func(trace.QueryQueryDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryQueryDoneInfo) {
			return
		}
	}
	return res
}
func onQueryResultSet(t *trace.Query, q trace.QueryQueryResultSetStartInfo) func(trace.QueryQueryResultSetDoneInfo) {
	fn := t.OnQueryResultSet
	if fn == nil {
		return func(trace.QueryQueryResultSetDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryQueryResultSetDoneInfo) {
			return
		}
	}
	return res
}
func onQueryRow(t *trace.Query, q trace.QueryQueryRowStartInfo) func(trace.QueryQueryRowDoneInfo) {
	fn := t.OnQueryRow
	if fn == nil {
		return func(trace.QueryQueryRowDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryQueryRowDoneInfo) {
			return
		}
	}
	return res
}
func onSessionCreate(t *trace.Query, q trace.QuerySessionCreateStartInfo) func(info trace.QuerySessionCreateDoneInfo) {
	fn := t.OnSessionCreate
	if fn == nil {
		return func(trace.QuerySessionCreateDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QuerySessionCreateDoneInfo) {
			return
		}
	}
	return res
}
func onSessionAttach(t *trace.Query, q trace.QuerySessionAttachStartInfo) func(info trace.QuerySessionAttachDoneInfo) {
	fn := t.OnSessionAttach
	if fn == nil {
		return func(trace.QuerySessionAttachDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QuerySessionAttachDoneInfo) {
			return
		}
	}
	return res
}
func onSessionDelete(t *trace.Query, q trace.QuerySessionDeleteStartInfo) func(info trace.QuerySessionDeleteDoneInfo) {
	fn := t.OnSessionDelete
	if fn == nil {
		return func(trace.QuerySessionDeleteDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QuerySessionDeleteDoneInfo) {
			return
		}
	}
	return res
}
func onSessionExec(t *trace.Query, q trace.QuerySessionExecStartInfo) func(info trace.QuerySessionExecDoneInfo) {
	fn := t.OnSessionExec
	if fn == nil {
		return func(trace.QuerySessionExecDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QuerySessionExecDoneInfo) {
			return
		}
	}
	return res
}
func onSessionQuery(t *trace.Query, q trace.QuerySessionQueryStartInfo) func(info trace.QuerySessionQueryDoneInfo) {
	fn := t.OnSessionQuery
	if fn == nil {
		return func(trace.QuerySessionQueryDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QuerySessionQueryDoneInfo) {
			return
		}
	}
	return res
}
func onSessionQueryResultSet(t *trace.Query, q trace.QuerySessionQueryResultSetStartInfo) func(trace.QuerySessionQueryResultSetDoneInfo) {
	fn := t.OnSessionQueryResultSet
	if fn == nil {
		return func(trace.QuerySessionQueryResultSetDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QuerySessionQueryResultSetDoneInfo) {
			return
		}
	}
	return res
}
func onSessionQueryRow(t *trace.Query, q trace.QuerySessionQueryRowStartInfo) func(trace.QuerySessionQueryRowDoneInfo) {
	fn := t.OnSessionQueryRow
	if fn == nil {
		return func(trace.QuerySessionQueryRowDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QuerySessionQueryRowDoneInfo) {
			return
		}
	}
	return res
}
func onSessionBegin(t *trace.Query, q trace.QuerySessionBeginStartInfo) func(info trace.QuerySessionBeginDoneInfo) {
	fn := t.OnSessionBegin
	if fn == nil {
		return func(trace.QuerySessionBeginDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QuerySessionBeginDoneInfo) {
			return
		}
	}
	return res
}
func onSessionBeginTransaction(t *trace.Query, q trace.QuerySessionBeginTransactionStartInfo) func(trace.QuerySessionBeginTransactionDoneInfo) {
	fn := t.OnSessionBeginTransaction
	if fn == nil {
		return func(trace.QuerySessionBeginTransactionDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QuerySessionBeginTransactionDoneInfo) {
			return
		}
	}
	return res
}
func onTxCommit(t *trace.Query, q trace.QueryTxCommitStartInfo) func(info trace.QueryTxCommitDoneInfo) {
	fn := t.OnTxCommit
	if fn == nil {
		return func(trace.QueryTxCommitDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryTxCommitDoneInfo) {
			return
		}
	}
	return res
}
func onTxRollback(t *trace.Query, q trace.QueryTxRollbackStartInfo) func(info trace.QueryTxRollbackDoneInfo) {
	fn := t.OnTxRollback
	if fn == nil {
		return func(trace.QueryTxRollbackDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryTxRollbackDoneInfo) {
			return
		}
	}
	return res
}
func onTxExec(t *trace.Query, q trace.QueryTxExecStartInfo) func(info trace.QueryTxExecDoneInfo) {
	fn := t.OnTxExec
	if fn == nil {
		return func(trace.QueryTxExecDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryTxExecDoneInfo) {
			return
		}
	}
	return res
}
func onTxQuery(t *trace.Query, q trace.QueryTxQueryStartInfo) func(info trace.QueryTxQueryDoneInfo) {
	fn := t.OnTxQuery
	if fn == nil {
		return func(trace.QueryTxQueryDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryTxQueryDoneInfo) {
			return
		}
	}
	return res
}
func onTxQueryResultSet(t *trace.Query, q trace.QueryTxQueryResultSetStartInfo) func(trace.QueryTxQueryResultSetDoneInfo) {
	fn := t.OnTxQueryResultSet
	if fn == nil {
		return func(trace.QueryTxQueryResultSetDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryTxQueryResultSetDoneInfo) {
			return
		}
	}
	return res
}
func onTxQueryRow(t *trace.Query, q trace.QueryTxQueryRowStartInfo) func(trace.QueryTxQueryRowDoneInfo) {
	fn := t.OnTxQueryRow
	if fn == nil {
		return func(trace.QueryTxQueryRowDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryTxQueryRowDoneInfo) {
			return
		}
	}
	return res
}
func onResultNew(t *trace.Query, q trace.QueryResultNewStartInfo) func(info trace.QueryResultNewDoneInfo) {
	fn := t.OnResultNew
	if fn == nil {
		return func(trace.QueryResultNewDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryResultNewDoneInfo) {
			return
		}
	}
	return res
}
func onResultNextPart(t *trace.Query, q trace.QueryResultNextPartStartInfo) func(info trace.QueryResultNextPartDoneInfo) {
	fn := t.OnResultNextPart
	if fn == nil {
		return func(trace.QueryResultNextPartDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryResultNextPartDoneInfo) {
			return
		}
	}
	return res
}
func onResultNextResultSet(t *trace.Query, q trace.QueryResultNextResultSetStartInfo) func(info trace.QueryResultNextResultSetDoneInfo) {
	fn := t.OnResultNextResultSet
	if fn == nil {
		return func(trace.QueryResultNextResultSetDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryResultNextResultSetDoneInfo) {
			return
		}
	}
	return res
}
func onResultClose(t *trace.Query, q trace.QueryResultCloseStartInfo) func(info trace.QueryResultCloseDoneInfo) {
	fn := t.OnResultClose
	if fn == nil {
		return func(trace.QueryResultCloseDoneInfo) {
			return
		}
	}
	res := fn(q)
	if res == nil {
		return func(trace.QueryResultCloseDoneInfo) {
			return
		}
	}
	return res
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnNew(t *trace.Query, c *context.Context, c1 trace.Call) func() {
	var p trace.QueryNewStartInfo
	p.Context = c
	p.Call = c1
	res := onNew(t, p)
	return func() {
		var p trace.QueryNewDoneInfo
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnClose(t *trace.Query, c *context.Context, c1 trace.Call) func(error) {
	var p trace.QueryCloseStartInfo
	p.Context = c
	p.Call = c1
	res := onClose(t, p)
	return func(e error) {
		var p trace.QueryCloseDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnPoolNew(t *trace.Query, c *context.Context, c1 trace.Call) func(limit int) {
	var p trace.QueryPoolNewStartInfo
	p.Context = c
	p.Call = c1
	res := onPoolNew(t, p)
	return func(limit int) {
		var p trace.QueryPoolNewDoneInfo
		p.Limit = limit
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnPoolClose(t *trace.Query, c *context.Context, c1 trace.Call) func(error) {
	var p trace.QueryPoolCloseStartInfo
	p.Context = c
	p.Call = c1
	res := onPoolClose(t, p)
	return func(e error) {
		var p trace.QueryPoolCloseDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnPoolTry(t *trace.Query, c *context.Context, c1 trace.Call) func(error) {
	var p trace.QueryPoolTryStartInfo
	p.Context = c
	p.Call = c1
	res := onPoolTry(t, p)
	return func(e error) {
		var p trace.QueryPoolTryDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnPoolWith(t *trace.Query, c *context.Context, c1 trace.Call) func(attempts int, _ error) {
	var p trace.QueryPoolWithStartInfo
	p.Context = c
	p.Call = c1
	res := onPoolWith(t, p)
	return func(attempts int, e error) {
		var p trace.QueryPoolWithDoneInfo
		p.Attempts = attempts
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnPoolPut(t *trace.Query, c *context.Context, c1 trace.Call, session trace.SessionInfo) func(error) {
	var p trace.QueryPoolPutStartInfo
	p.Context = c
	p.Call = c1
	p.Session = session
	res := onPoolPut(t, p)
	return func(e error) {
		var p trace.QueryPoolPutDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnPoolGet(t *trace.Query, c *context.Context, c1 trace.Call) func(session trace.SessionInfo, attempts int, _ *trace.NodeHintInfo, _ error) {
	var p trace.QueryPoolGetStartInfo
	p.Context = c
	p.Call = c1
	res := onPoolGet(t, p)
	return func(session trace.SessionInfo, attempts int, n *trace.NodeHintInfo, e error) {
		var p trace.QueryPoolGetDoneInfo
		p.Session = session
		p.Attempts = attempts
		p.NodeHintInfo = n
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnPoolChange(t *trace.Query, limit int, idle int, createInProgress int, concurrency int, size int) {
	var p trace.QueryPoolChange
	p.Limit = limit
	p.Idle = idle
	p.CreateInProgress = createInProgress
	p.Concurrency = concurrency
	p.Size = size
	onPoolChange(t, p)
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnDo(t *trace.Query, c *context.Context, c1 trace.Call, label string) func(attempts int, _ error) {
	var p trace.QueryDoStartInfo
	p.Context = c
	p.Call = c1
	p.Label = label
	res := onDo(t, p)
	return func(attempts int, e error) {
		var p trace.QueryDoDoneInfo
		p.Attempts = attempts
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnDoTx(t *trace.Query, c *context.Context, c1 trace.Call, label string) func(attempts int, _ error) {
	var p trace.QueryDoTxStartInfo
	p.Context = c
	p.Call = c1
	p.Label = label
	res := onDoTx(t, p)
	return func(attempts int, e error) {
		var p trace.QueryDoTxDoneInfo
		p.Attempts = attempts
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnExec(t *trace.Query, c *context.Context, c1 trace.Call, query string, label string) func(error) {
	var p trace.QueryExecStartInfo
	p.Context = c
	p.Call = c1
	p.Query = query
	p.Label = label
	res := onExec(t, p)
	return func(e error) {
		var p trace.QueryExecDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnQuery(t *trace.Query, c *context.Context, c1 trace.Call, query string, label string) func(error) {
	var p trace.QueryQueryStartInfo
	p.Context = c
	p.Call = c1
	p.Query = query
	p.Label = label
	res := onQuery(t, p)
	return func(e error) {
		var p trace.QueryQueryDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnQueryResultSet(t *trace.Query, c *context.Context, c1 trace.Call, query string, label string) func(_ error, rowsCount int) {
	var p trace.QueryQueryResultSetStartInfo
	p.Context = c
	p.Call = c1
	p.Query = query
	p.Label = label
	res := onQueryResultSet(t, p)
	return func(e error, rowsCount int) {
		var p trace.QueryQueryResultSetDoneInfo
		p.Error = e
		p.RowsCount = rowsCount
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnQueryRow(t *trace.Query, c *context.Context, c1 trace.Call, query string, label string) func(error) {
	var p trace.QueryQueryRowStartInfo
	p.Context = c
	p.Call = c1
	p.Query = query
	p.Label = label
	res := onQueryRow(t, p)
	return func(e error) {
		var p trace.QueryQueryRowDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnSessionCreate(t *trace.Query, c *context.Context, c1 trace.Call) func(session trace.SessionInfo, _ error) {
	var p trace.QuerySessionCreateStartInfo
	p.Context = c
	p.Call = c1
	res := onSessionCreate(t, p)
	return func(session trace.SessionInfo, e error) {
		var p trace.QuerySessionCreateDoneInfo
		p.Session = session
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnSessionAttach(t *trace.Query, c *context.Context, c1 trace.Call, session trace.SessionInfo) func(error) {
	var p trace.QuerySessionAttachStartInfo
	p.Context = c
	p.Call = c1
	p.Session = session
	res := onSessionAttach(t, p)
	return func(e error) {
		var p trace.QuerySessionAttachDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnSessionDelete(t *trace.Query, c *context.Context, c1 trace.Call, session trace.SessionInfo) func(error) {
	var p trace.QuerySessionDeleteStartInfo
	p.Context = c
	p.Call = c1
	p.Session = session
	res := onSessionDelete(t, p)
	return func(e error) {
		var p trace.QuerySessionDeleteDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnSessionExec(t *trace.Query, c *context.Context, c1 trace.Call, session trace.SessionInfo, query string, label string) func(error) {
	var p trace.QuerySessionExecStartInfo
	p.Context = c
	p.Call = c1
	p.Session = session
	p.Query = query
	p.Label = label
	res := onSessionExec(t, p)
	return func(e error) {
		var p trace.QuerySessionExecDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnSessionQuery(t *trace.Query, c *context.Context, c1 trace.Call, session trace.SessionInfo, query string, label string) func(error) {
	var p trace.QuerySessionQueryStartInfo
	p.Context = c
	p.Call = c1
	p.Session = session
	p.Query = query
	p.Label = label
	res := onSessionQuery(t, p)
	return func(e error) {
		var p trace.QuerySessionQueryDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnSessionQueryResultSet(t *trace.Query, c *context.Context, c1 trace.Call, session trace.SessionInfo, query string) func(error) {
	var p trace.QuerySessionQueryResultSetStartInfo
	p.Context = c
	p.Call = c1
	p.Session = session
	p.Query = query
	res := onSessionQueryResultSet(t, p)
	return func(e error) {
		var p trace.QuerySessionQueryResultSetDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnSessionQueryRow(t *trace.Query, c *context.Context, c1 trace.Call, session trace.SessionInfo, query string) func(error) {
	var p trace.QuerySessionQueryRowStartInfo
	p.Context = c
	p.Call = c1
	p.Session = session
	p.Query = query
	res := onSessionQueryRow(t, p)
	return func(e error) {
		var p trace.QuerySessionQueryRowDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnSessionBegin(t *trace.Query, c *context.Context, c1 trace.Call, session trace.SessionInfo) func(_ error, tx trace.TxInfo) {
	var p trace.QuerySessionBeginStartInfo
	p.Context = c
	p.Call = c1
	p.Session = session
	res := onSessionBegin(t, p)
	return func(e error, tx trace.TxInfo) {
		var p trace.QuerySessionBeginDoneInfo
		p.Error = e
		p.Tx = tx
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnSessionBeginTransaction(t *trace.Query, c *context.Context, c1 trace.Call, session trace.SessionInfo) func(_ error, txID string) {
	var p trace.QuerySessionBeginTransactionStartInfo
	p.Context = c
	p.Call = c1
	p.Session = session
	res := onSessionBeginTransaction(t, p)
	return func(e error, txID string) {
		var p trace.QuerySessionBeginTransactionDoneInfo
		p.Error = e
		p.TxID = txID
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnTxCommit(t *trace.Query, c *context.Context, c1 trace.Call, session trace.SessionInfo, tx trace.TxInfo) func(error) {
	var p trace.QueryTxCommitStartInfo
	p.Context = c
	p.Call = c1
	p.Session = session
	p.Tx = tx
	res := onTxCommit(t, p)
	return func(e error) {
		var p trace.QueryTxCommitDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnTxRollback(t *trace.Query, c *context.Context, c1 trace.Call, session trace.SessionInfo, tx trace.TxInfo) func(error) {
	var p trace.QueryTxRollbackStartInfo
	p.Context = c
	p.Call = c1
	p.Session = session
	p.Tx = tx
	res := onTxRollback(t, p)
	return func(e error) {
		var p trace.QueryTxRollbackDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnTxExec(t *trace.Query, c *context.Context, c1 trace.Call, session trace.SessionInfo, tx trace.TxInfo, query string, label string, withCommit bool) func(error) {
	var p trace.QueryTxExecStartInfo
	p.Context = c
	p.Call = c1
	p.Session = session
	p.Tx = tx
	p.Query = query
	p.Label = label
	p.WithCommit = withCommit
	res := onTxExec(t, p)
	return func(e error) {
		var p trace.QueryTxExecDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnTxQuery(t *trace.Query, c *context.Context, c1 trace.Call, session trace.SessionInfo, tx trace.TxInfo, query string, label string, withCommit bool) func(error) {
	var p trace.QueryTxQueryStartInfo
	p.Context = c
	p.Call = c1
	p.Session = session
	p.Tx = tx
	p.Query = query
	p.Label = label
	p.WithCommit = withCommit
	res := onTxQuery(t, p)
	return func(e error) {
		var p trace.QueryTxQueryDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnTxQueryResultSet(t *trace.Query, c *context.Context, c1 trace.Call, tx trace.TxInfo, session trace.SessionInfo, query string, label string, withCommit bool) func(error) {
	var p trace.QueryTxQueryResultSetStartInfo
	p.Context = c
	p.Call = c1
	p.Tx = tx
	p.Session = session
	p.Query = query
	p.Label = label
	p.WithCommit = withCommit
	res := onTxQueryResultSet(t, p)
	return func(e error) {
		var p trace.QueryTxQueryResultSetDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnTxQueryRow(t *trace.Query, c *context.Context, c1 trace.Call, tx trace.TxInfo, session trace.SessionInfo, query string, label string, withCommit bool) func(error) {
	var p trace.QueryTxQueryRowStartInfo
	p.Context = c
	p.Call = c1
	p.Tx = tx
	p.Session = session
	p.Query = query
	p.Label = label
	p.WithCommit = withCommit
	res := onTxQueryRow(t, p)
	return func(e error) {
		var p trace.QueryTxQueryRowDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnResultNew(t *trace.Query, c *context.Context, c1 trace.Call) func(error) {
	var p trace.QueryResultNewStartInfo
	p.Context = c
	p.Call = c1
	res := onResultNew(t, p)
	return func(e error) {
		var p trace.QueryResultNewDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnResultNextPart(t *trace.Query, c *context.Context, c1 trace.Call) func(stats *Ydb_TableStats.QueryStats, _ error) {
	var p trace.QueryResultNextPartStartInfo
	p.Context = c
	p.Call = c1
	res := onResultNextPart(t, p)
	return func(stats *Ydb_TableStats.QueryStats, e error) {
		var p trace.QueryResultNextPartDoneInfo
		p.Stats = stats
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnResultNextResultSet(t *trace.Query, c *context.Context, c1 trace.Call) func(error) {
	var p trace.QueryResultNextResultSetStartInfo
	p.Context = c
	p.Call = c1
	res := onResultNextResultSet(t, p)
	return func(e error) {
		var p trace.QueryResultNextResultSetDoneInfo
		p.Error = e
		res(p)
	}
}
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func QueryOnResultClose(t *trace.Query, c *context.Context, c1 trace.Call) func(error) {
	var p trace.QueryResultCloseStartInfo
	p.Context = c
	p.Call = c1
	res := onResultClose(t, p)
	return func(e error) {
		var p trace.QueryResultCloseDoneInfo
		p.Error = e
		res(p)
	}
}
