datarights

package
v0.102.4 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

Package datarights carries optional provider-declared source data terms. It does not evaluate terms, grant access, resolve inheritance, or assign a licence to query output. Providers own those policies and evidence validation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Declaration

type Declaration struct {
	Name string `json:"name,omitempty"`
	SPDX string `json:"spdx,omitempty"`
	URL  string `json:"url,omitempty"`
	Text string `json:"text,omitempty"`
}

Declaration describes source terms. An absent declaration is not permission.

type LinkNotice

type LinkNotice struct {
	Text string `json:"text"`
	URL  string `json:"url"`
}

LinkNotice is a free-source notice with a required canonical HTTPS link. Providers validate URL safety and evidence before exposing the metadata.

type Notice

type Notice struct {
	Text string `json:"text"`
	URL  string `json:"url,omitempty"`
}

Notice is descriptive credit or a source link supplied by the provider.

type Pin

type Pin struct {
	Role       string `json:"role"`
	Repository string `json:"repository"`
	Revision   string `json:"revision"`
	Path       string `json:"path"`
	SHA256     string `json:"sha256"`
	Bytes      int64  `json:"bytes"`
}

Pin identifies immutable evidence where a provider has verified it. Role is provider-defined (for example provider, declaration, input or terms).

type QueryMetadata

type QueryMetadata struct {
	SourceRights  []SourceRight `json:"sourceRights,omitempty"`
	UsedSourceIDs []string      `json:"usedSourceIds,omitempty"`
}

QueryMetadata is an optional inventory of source data terms, not output terms. SourceRights contains the authorized planned inventory captured before output. UsedSourceIDs identifies inputs actually read or considered, including empty and projected-away inputs. Providers must not infer it from output rows. Omission means unknown/not provided. Providers own ordering, identity, authorization, preflight, evidence budgets and page snapshot consistency.

func (QueryMetadata) Clone

func (m QueryMetadata) Clone() QueryMetadata

Clone returns a detached snapshot safe from subsequent caller mutations.

func (QueryMetadata) MarshalJSON

func (m QueryMetadata) MarshalJSON() ([]byte, error)

MarshalJSON preserves the distinction between omitted and known-empty inventories. This matches optional query-page arrays in the JS contract.

func (*QueryMetadata) UnmarshalJSON

func (m *QueryMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts omitted inventories and empty arrays, but rejects explicit null arrays, matching the JS query-page contract.

type Source

type Source struct {
	ServerID   string `json:"serverId"`
	DatabaseID string `json:"databaseId,omitempty"`
	Recordset  string `json:"recordset,omitempty"`
}

Source identifies the provider's exact source. IDs are opaque to DALgo.

type SourceRight

type SourceRight struct {
	SourceID         string      `json:"sourceId"`
	Source           Source      `json:"source"`
	Declaration      Declaration `json:"declaration"`
	DeclarationScope string      `json:"declarationScope"`
	DeclaredAt       Source      `json:"declaredAt"`
	EvidenceOrigin   string      `json:"evidenceOrigin"`
	Pins             []Pin       `json:"pins"`
	Attribution      *Notice     `json:"attribution,omitempty"`
	FreeSource       *LinkNotice `json:"freeSource,omitempty"`
	Transformations  []string    `json:"transformations"`
}

SourceRight describes effective source terms and their authored scope. Scope and EvidenceOrigin are provider-defined; conventional scopes are server, database and recordset. Pins may be empty for unpinned declarations. Neither SPDX nor EvidenceOrigin is a DALgo certification of rights.

func (SourceRight) MarshalJSON

func (r SourceRight) MarshalJSON() ([]byte, error)

MarshalJSON emits required evidence arrays as [] even for unpinned Go values. Optional top-level inventories are handled separately by QueryMetadata.

func (*SourceRight) UnmarshalJSON

func (r *SourceRight) UnmarshalJSON(data []byte) error

UnmarshalJSON rejects null or missing required evidence arrays. This is wire shape validation only; provider authority and legal/evidence checks are separate.

Jump to

Keyboard shortcuts

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