func trace(ctx context.Context, name string, fn func(Tx) error) *Trace {
	if tx, ok := FromContext(ctx); ok {
		err := fn(tx)
		return &Trace{
			err: err,
			done: func() error {
				return tx.EndSegment()
			},
		}
	}
	return &Trace{nil, func() error { return nil }}
}
func trace(ctx context.Context, name string, fn func(Tx) error) *Trace {
	if tx, ok := FromContext(ctx); ok {
		err := fn(tx)
		return &Trace{
			err: err,
			done: func() error {
				return tx.EndSegment()
			},
		}
	}
	return &Trace{nil, func() error { return nil }}
}
func trace ( ctx context . Context , name string , fn func ( Tx ) error ) * Trace { if tx , ok := FromContext ( ctx ) ; ok { err := fn ( tx ) return & Trace { err : err , done : func ( ) error { return tx . EndSegment ( ) } , } } return & Trace { nil , func ( ) error { return nil } } }
// trace is a helper function for TraceExternal and TraceGeneric, you probably don't want
// to use it directly.
trace is a helper function for TraceExternal and TraceGeneric you probably don t want to use it directly .