NewCostTracker creates a new CostTracker with a given estimator and a set of functional CostTrackerOption values.
(estimator ActualCostEstimator, opts ...CostTrackerOption)
| 197 | |
| 198 | // NewCostTracker creates a new CostTracker with a given estimator and a set of functional CostTrackerOption values. |
| 199 | func NewCostTracker(estimator ActualCostEstimator, opts ...CostTrackerOption) (*CostTracker, error) { |
| 200 | tracker := &CostTracker{ |
| 201 | Estimator: estimator, |
| 202 | overloadTrackers: map[string]FunctionTracker{}, |
| 203 | presenceTestHasCost: true, |
| 204 | } |
| 205 | for _, opt := range opts { |
| 206 | err := opt(tracker) |
| 207 | if err != nil { |
| 208 | return nil, err |
| 209 | } |
| 210 | } |
| 211 | return tracker, nil |
| 212 | } |
| 213 | |
| 214 | // OverloadCostTracker binds an overload ID to a runtime FunctionTracker implementation. |
| 215 | // |
no outgoing calls