policy

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package policy is the catalog of standards documents and the dated milestones the product acts on (ADR-0022). It is data, embedded from catalog.json and validated when it loads: a document has a status, a date, an address and the place it was transcribed from, and nothing that deprecates, disallows or requires anything rests on a draft.

The checks that judge a scan against a standard's clauses stay code in internal/eval; this package holds only facts about documents.

Index

Constants

View Source
const (
	StatusFinal      = "final"
	StatusDraft      = "draft"
	StatusWithdrawn  = "withdrawn"
	StatusSuperseded = "superseded"
)

Document statuses.

View Source
const (
	EffectDeprecated  = "deprecated"
	EffectDisallowed  = "disallowed"
	EffectRequired    = "required"
	EffectRecommended = "recommended"
)

Milestone effects.

View Source
const (
	RelationAfter = "after"
	RelationBy    = "by"
)

Milestone relations to their date: "after" the end of the day, or "by" the end of the day.

View Source
const (
	ScopeGeneral      = "general"
	ScopeUSFederal    = "us-federal"
	ScopeUSFederalHVA = "us-federal-hva"
)

Scopes say whom a milestone binds.

Variables

This section is empty.

Functions

func Raw

func Raw() []byte

Raw is the embedded catalog's bytes, served as they are.

Types

type Catalog

type Catalog struct {
	Version    string      `json:"version"`
	About      string      `json:"about"`
	Documents  []Document  `json:"documents"`
	Milestones []Milestone `json:"milestones"`
	Profiles   []Profile   `json:"profiles"`
}

Catalog is the whole catalog.

func Default

func Default() *Catalog

Default is the embedded catalog. It panics if the embedded file is invalid, which a test rules out.

func Parse

func Parse(b []byte) (*Catalog, error)

Parse reads and validates a catalog.

func (*Catalog) Document

func (c *Catalog) Document(id string) (Document, bool)

Document returns the document with this id.

func (*Catalog) Milestone

func (c *Catalog) Milestone(id string) (Milestone, bool)

Milestone returns the milestone with this id.

func (*Catalog) MustMilestone

func (c *Catalog) MustMilestone(id string) Milestone

MustMilestone returns the milestone with this id or panics: for the evaluation's fixed references, which a test checks resolve.

func (*Catalog) Validate

func (c *Catalog) Validate() error

Validate checks every rule ADR-0022 names and returns all the problems it finds.

type Document

type Document struct {
	ID         string `json:"id"`
	Publisher  string `json:"publisher"`
	Identifier string `json:"identifier"`
	Title      string `json:"title"`
	Status     string `json:"status"`
	// Published is the publication date as YYYY-MM-DD, YYYY-MM, or empty when not recorded.
	Published  string   `json:"published"`
	URL        string   `json:"url"`
	Families   []string `json:"families"`
	Notes      string   `json:"notes,omitempty"`
	Provenance string   `json:"provenance"`
}

Document is one published (or draft) standard or guidance document.

type Milestone

type Milestone struct {
	ID           string   `json:"id"`
	Document     string   `json:"document"`
	Clause       string   `json:"clause"`
	Text         string   `json:"text"`
	Effect       string   `json:"effect"`
	Relation     string   `json:"relation"`
	Date         string   `json:"date"`
	Families     []string `json:"families"`
	StrengthBits int      `json:"strengthBits,omitempty"`
	Scope        string   `json:"scope"`
	Provenance   string   `json:"provenance"`
}

Milestone is one dated statement of a document.

func (Milestone) Cutoff

func (m Milestone) Cutoff() time.Time

Cutoff is the last instant the milestone's date covers: 23:59:59 UTC of that day. "Deprecated after 2030" means after the cut-off of 31 December 2030; "required by 2 January 2030" means by its cut-off.

func (Milestone) Day

func (m Milestone) Day() time.Time

Day is the milestone's date at 00:00 UTC.

type Profile

type Profile struct {
	ID         string   `json:"id"`
	Title      string   `json:"title"`
	About      string   `json:"about"`
	Milestones []string `json:"milestones"`
}

Profile is a named set of milestones an organisation follows.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL