Documentation
¶
Overview ¶
Package precondition is how a write names the version of the entity it was based on, and how that version is judged against the stored one. Every versioned entity's write requires one, so two people editing the same entity never silently overwrite each other: the second write is refused and its author sees what changed meanwhile.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrRequired = errors.New("precondition: the write names no version")
ErrRequired is a write that names no version where one is required. It carries no error kind: answering it is a matter of the protocol (HTTP answers 428 precondition_required), so each inbound adapter maps it.
Functions ¶
Types ¶
type Tags ¶ added in v0.7.0
type Tags struct {
// Any is `*`: it matches whatever the entity's current tag is, as long as
// the entity exists.
Any bool
// Strong are the strong tags the header lists, without their quotes.
Strong []string
}
Tags is the If-Match header of a request, read as RFC 9110 reads it: `*`, or a list of entity tags. Only strong tags are kept, since a weak one never matches under the strong comparison If-Match uses.
func ParseTags ¶ added in v0.7.0
ParseTags reads an If-Match header: `*`, or entity tags separated by commas, each strong (`"7"`, or bare, `7`) or weak (`W/"7"`, which matches nothing). A quoted tag may hold a comma, and empty list elements (`"6", , "7"`) are skipped, as RFC 9110 asks of a list's recipient. A header that is none of these, or lists no tag at all, is refused.