consentage

package
v0.1.33 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 10 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 consentage is the age of digital consent by country (R52; R134 spec): the table of spec's part consent-age/, at the tag api pins, and the category of a learner it gives — consent-age/README.md, section 6. api keeps the category, the day it was given and applied, the age of the country on that day, and never the age in years (privacy 3.3 spec).

Index

Constants

View Source
const (
	Under13         = "under_13"
	From13ToConsent = "from_13_to_consent"
	FromConsentTo18 = "from_consent_to_18"
	Adult           = "adult"
)

The categories of a learner by age (privacy 3.1 spec).

Variables

This section is empty.

Functions

func FromYAML

func FromYAML(data []byte, v any) error

FromYAML reads a value of the part's YAML into v by its JSON names, as the generated types of spec take them.

func ParentConsents

func ParentConsents(category string) bool

ParentConsents says whether a learner of the category consents by a parent: below the age of digital consent of their country.

Types

type Table

type Table struct {
	// contains filtered or unexported fields
}

Table is the table of the age of digital consent, read and checked.

func Load

func Load() (*Table, error)

Load is the table of spec's Go module at the tag api pins, spec.ConsentAge: spec's own check accepted it before its release, so it is read, not checked again (consent-age/README.md, section 5).

func New

func New(table consentagev1.ConsentAge) (*Table, error)

New is the table of a value read already, with no list of countries.

func Read

func Read(fsys fs.FS) (*Table, error)

Read is the table of the part in fsys: consent-age.yaml, and the codes of countries of its schema.

func Spec

func Spec() *Table

Spec is the table of the tag api pins. It is embedded in the binary and read by the tests of this package, so that it cannot fail to read: a release that broke it is refused before it is made.

func (*Table) AgeOn

func (t *Table) AgeOn(country string, day time.Time) int

AgeOn is the age of digital consent of the country on the day: the age of its latest entry that applies by then, or the age outside the table.

func (*Table) AskAgain

func (t *Table) AskAgain(category string, applied int, country string, today time.Time) bool

AskAgain says whether a profile of the category, given by applied, needs its age given again on today: a learner who consents themselves, in a country whose age rose above applied. A lower age waits for the yearly check.

func (*Table) Category

func (t *Table) Category(ageYears int, country string, day time.Time) (category string, applied int)

Category is the category of a learner of ageYears in the country on the day, and applied, the age of the country on it.

func (*Table) Country

func (t *Table) Country(code string) bool

Country says whether code is one of the codes the schema lists: a learner's country is one of them, and anything else is refused.

Jump to

Keyboard shortcuts

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