Documentation
¶
Overview ¶
Package enableversions plans and checks a collection or global that starts keeping versions while it may already store documents. Each store adapter executes the plan; this package owns the choices and what they mean.
Index ¶
- func Convert(resource schema.Collection, document store.Document, ...) store.Document
- func Describe(resource schema.Collection) string
- func NotEmptyError(resource schema.Collection, documents int64) error
- func StoredDocumentsError(resource schema.Collection, documents int64) error
- func Validate(resource schema.Collection, existing migration.ExistingDocuments) error
- type Choices
- type Report
- type Step
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Convert ¶
func Convert(resource schema.Collection, document store.Document, existing migration.ExistingDocuments) store.Document
Convert returns document as a resource that keeps versions stores it after existing applies: published with a live head, or an unpublished draft. Its revision starts at 1 unless the document already has one.
func Describe ¶
func Describe(resource schema.Collection) string
Describe names a resource for messages, such as collection "posts".
func NotEmptyError ¶
func NotEmptyError(resource schema.Collection, documents int64) error
NotEmptyError rejects a require-empty choice for a resource that stores documents.
func StoredDocumentsError ¶
func StoredDocumentsError(resource schema.Collection, documents int64) error
StoredDocumentsError rejects development schema sync that would enable versions on a resource that stores documents.
func Validate ¶
func Validate(resource schema.Collection, existing migration.ExistingDocuments) error
Validate checks that existing is a choice resource can take.
Types ¶
type Choices ¶
type Choices map[schema.StableID]migration.ExistingDocuments
Choices maps each resource that starts keeping versions, by its after stable ID, to what becomes of the documents it already stores.
type Report ¶
type Report struct {
Resource schema.Collection
Documents int64
}
Report is how many documents, trashed ones included, a resource that starts keeping versions already stores.
type Step ¶
type Step struct {
Resource schema.Collection
Existing migration.ExistingDocuments
}
Step is one resource that starts keeping versions, with what becomes of the documents it already stores.
func Plan ¶
func Plan(before, after schema.Snapshot, renames map[schema.StableID]schema.StableID, choices Choices) ([]Step, error)
Plan returns a step for each resource that starts keeping versions between before and after, in migration.VersionsEnabled order. Every such resource needs a choice, and only those resources may have one.
func (Step) Payload ¶
func (step Step) Payload() migration.EnableVersionsPayload
Payload is the step's immutable artifact record.