type
PopulationBudget
type PopulationBudget struct {
mu sync.Mutex
remaining int
}A shared recursive population materialization budget.
NewPopulationBudget creates a concurrency-safe budget. ConsumeDocument counts nested populated documents and returns ErrPopulationLimit above the bound. Official adapters initialize the default MaxPopulationMaterializedDocuments (4096) when omitted.
Methods
PopulationBudget.ConsumeDocument()ConsumeDocument reserves enough budget for document and every populated document already nested beneath it. The reservation happens before an adapter deep-clones the document into its parent response.