model

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Convention

type Convention struct {
	Name  string `json:"name"`
	Rules []Rule `json:"rules"`
}

func NewConvention

func NewConvention(name string, rules []Rule) *Convention

noinspection GoUnusedExportedFunction

func (*Convention) Evaluate

func (c *Convention) Evaluate() error

func (*Convention) Print

func (c *Convention) Print() error

type Identifier

type Identifier struct {
	Scheme     string `json:"scheme"`
	Identifier string `json:"identifier"`
}

type License

type License struct {
	SupersededBy *string      `json:"superseded_by"`
	Identifiers  []Identifier `json:"identifiers"`
	Text         []Text       `json:"text"`
	OtherNames   *[]OtherName `json:"other_names"`
	Id           string       `json:"id"`
	Links        []Link       `json:"links"`
	Name         string       `json:"name"`
	Keywords     []string     `json:"keywords"`
}

func (License) Print

func (license License) Print() error

func (License) PrintDetails

func (license License) PrintDetails() error

type Licenses

type Licenses []License

This type alias allows us to create a sort of "dao" atop the set of data. see Go in Action Chapter 2 for somewhat similar approach.

func (Licenses) FindById

func (l Licenses) FindById(id string) *License

enable searching for a specific license

func (Licenses) FindByKeyword

func (l Licenses) FindByKeyword(keyword string) *Licenses

enable querying by keyword (e.g. "popular")

func (Licenses) Search

func (l Licenses) Search(term string) *Licenses

enable a loose free-form textual search

type Link struct {
	Note *string `json:"note"`
	Url  string  `json:"url"`
}

type OtherName

type OtherName struct {
	// pointer works for missing parameters, verify this works for null values.
	Note *string `json:"note"`
	Name string  `json:"name"`
}

type Rule

type Rule struct {
	Level StrictnessLevel
	Type  RuleType
	Value string
}

func NewRule

func NewRule(level StrictnessLevel, ruleType RuleType, value string) *Rule

noinspection GoUnusedExportedFunction

func (*Rule) MarshalJSON

func (r *Rule) MarshalJSON() ([]byte, error)

func (*Rule) UnmarshalJSON

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

type RuleType

type RuleType int
const (
	Unspecified RuleType = iota
	Directory
	File
	Pattern
)

type StrictnessLevel

type StrictnessLevel int
const (
	Prohibited StrictnessLevel = iota
	Optional
	Preferred
	Required
)

type Text

type Text struct {
	Title     string `json:"title"`
	Url       string `json:"url"`
	MediaType string `json:"media_type"`
}

Jump to

Keyboard shortcuts

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