Documentation
¶
Overview ¶
Package iso8601 parses and formats the PnDTnHnMnS/PTnHnMnS subset of ISO 8601 durations used by Azure Service Bus's LockDuration/ DefaultMessageTimeToLive XML properties, and by ARM's equivalent JSON properties on Microsoft.ServiceBus queue/topic/subscription resources. Extracted from services/azureservicebus (M5) when services/azurearm (M9) became a second caller needing the exact same logic -- mirroring pkgs/odatatable's earlier extraction for the same reason (AZURE.md section 9's M6 milestone).
Index ¶
Constants ¶
const Zero = "PT0S"
Zero is the shortest valid ISO 8601 representation of "no duration", used by Format for a non-positive input.
Variables ¶
var ErrInvalidDuration = errors.New("iso8601: invalid duration")
ErrInvalidDuration is returned by Parse for a string that doesn't match the supported PnDTnHnMnS/PTnHnMnS subset.
Functions ¶
func Parse ¶
Parse parses the PnDTnHnMnS/PTnHnMnS subset of ISO 8601 durations used by Service Bus's LockDuration and DefaultMessageTimeToLive properties (MaxDeliveryCount, unlike those two, is a plain integer, not a duration, and does not go through this parser). Fractional seconds are supported. A value that would overflow time.Duration's int64-nanosecond range is clamped to the maximum representable time.Duration (~292 years) rather than erroring -- real Service Bus's own "infinite" sentinel for these fields, "P10675199DT2H48M5.4775807S", is itself just .NET's TimeSpan.MaxValue (which is exactly math.MaxInt64 100-nanosecond ticks, i.e. very close to Go's own int64-nanosecond time.Duration ceiling) spelled out in ISO 8601, so this clamp is a deliberate, documented approximation of that sentinel rather than a real precision loss for any duration Service Bus itself would ever produce.
Types ¶
This section is empty.