// withTimeout returns a context based on the specified timeout.
// If the context is local or if timeout is 0, the
// original context is returned as is.
482894
func withTimeout(ctx context.Context, timeout time.Duration, options *querypb.ExecuteOptions) (context.Context, context.CancelFunc) {
	if timeout == 0 || options.GetWorkload() == querypb.ExecuteOptions_DBA || tabletenv.IsLocalContext(ctx) {
		return ctx, func() {}
	}
	return context.WithTimeout(ctx, timeout)
}
741651
func WithTimeout(timeout string) ClientOptionFunc {
	return func(c *Client) error {
		if timeout == "" {
			c.sessionTimeout = DefaultSessionTimeout
			return nil
		}

		t, err := time.ParseDuration(timeout)
		if err != nil {
			return client.InvalidTimeoutError{Timeout: timeout}
		}
		c.sessionTimeout = t
		return nil
	}
}
79615
func (o *GetTaskDetailsParams) WithTimeout(timeout time.Duration) *GetTaskDetailsParams {
	o.SetTimeout(timeout)
	return o
}
230488
func WithTimeout(t time.Duration) Option {
	return func(o *opts) {
		o.timeout = t
	}
}
408136
func (o *GetTaskCommentsParams) WithTimeout(timeout time.Duration) *GetTaskCommentsParams {
	o.SetTimeout(timeout)
	return o
}
396131
func (o *PatchEndpointIDLabelsParams) WithTimeout(timeout time.Duration) *PatchEndpointIDLabelsParams {
	o.SetTimeout(timeout)
	return o
}
1307476
func (c *Ctx) WithTimeout(timeout time.Duration) context.CancelFunc {
	ctx, cf := context.WithTimeout(c.request.Context(), timeout)
	c.request = c.request.WithContext(ctx) // temporarily shallow copying to avoid problems with external libraries
	return cf
}
152230
func (o *UpdateJSONWebKeyParams) WithTimeout(timeout time.Duration) *UpdateJSONWebKeyParams {
	o.SetTimeout(timeout)
	return o
}
1306542
func (o *PutServiceIDParams) WithTimeout(timeout time.Duration) *PutServiceIDParams {
	o.SetTimeout(timeout)
	return o
}
679498
func (o *GetEndpointParams) WithTimeout(timeout time.Duration) *GetEndpointParams {
	o.SetTimeout(timeout)
	return o
}
1124949
func (o *CreateTaskParams) WithTimeout(timeout time.Duration) *CreateTaskParams {
	o.SetTimeout(timeout)
	return o
}
206605
func (o *AcceptLogoutRequestParams) WithTimeout(timeout time.Duration) *AcceptLogoutRequestParams {
	o.SetTimeout(timeout)
	return o
}
615994
func (o *DeleteJSONWebKeySetParams) WithTimeout(timeout time.Duration) *DeleteJSONWebKeySetParams {
	o.SetTimeout(timeout)
	return o
}
933522
func (o *GetHelloParams) WithTimeout(timeout time.Duration) *GetHelloParams {
	o.SetTimeout(timeout)
	return o
}
858590
func (o *CreateJSONWebKeySetParams) WithTimeout(timeout time.Duration) *CreateJSONWebKeySetParams {
	o.SetTimeout(timeout)
	return o
}
621198
func (o *IsInstanceReadyParams) WithTimeout(timeout time.Duration) *IsInstanceReadyParams {
	o.SetTimeout(timeout)
	return o
}
337419
func (o *FlushInactiveOAuth2TokensParams) WithTimeout(timeout time.Duration) *FlushInactiveOAuth2TokensParams {
	o.SetTimeout(timeout)
	return o
}