tags

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package tags are categories and platform metadata used to classify the served files.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPlatform = errors.New("invalid platform")
	ErrTag      = errors.New("invalid tag")
)
View Source
var (
	ErrDB = errors.New("database value is nil")
	ErrT  = errors.New("lockable tags t is nil")
)

Functions

func Description

func Description(tag string) (string, error)

Description returns the short description of the tag.

func Humanize

func Humanize(platform, section Tag) string

Humanize returns the human readable name of the platform and section tags combined.

func Humanizes

func Humanizes(platform, section Tag) string

Humanizes returns the human readable name plurals of the platform and section tags combined.

func InvalidExec added in v0.14.0

func InvalidExec(exec boil.ContextExecutor) bool

InvalidExec returns true if the database context executor is invalid such as nil.

func IsCategory

func IsCategory(name string) bool

IsCategory returns true if the named tag is a category.

func IsPlatform

func IsPlatform(name string) bool

IsPlatform returns true if the named tag is a platform.

func IsTag

func IsTag(name string) bool

IsTag returns true if the named tag is a category or platform.

func IsText added in v0.8.0

func IsText(name string) bool

IsText returns true if the named tag is a raw or plain text category.

func NameByURI

func NameByURI(slug string) string

NameByURI returns the name of a tag belonging to the URI slug.

func OSTags

func OSTags() [5]string

OSTags returns the tags that flag an operating system.

func Platform

func Platform(platform, tag string) (string, error)

Platform returns the human readable platform and tag name.

Types

type Info

type Info map[Tag]string

Info is a short description of the tag.

func Infos

func Infos() Info

Infos returns short descriptions of the tags.

type Name

type Name map[Tag]string

Name is the tags displayed title.

type Sum

type Sum map[Tag]int

Sum the numbers of files with the tag.

type T

type T struct {
	List []TagData
	Mu   sync.RWMutex
}

T is a lockable collection of tags, to stop potential race conditions when writing to the map containing the tagdata list.

func (*T) Build

func (t *T) Build(ctx context.Context, exec boil.ContextExecutor) error

Build the tags and collect the statistical data sourced from the database.

func (*T) ByName

func (t *T) ByName(name string) (TagData, error)

ByName returns the data of the named tag. It requires the database to be connected to build the tags if they have not already been.

type Tag

type Tag int

Tag is the unique ID.

const (
	// FirstCategory is the first tag marked as a category.
	FirstCategory Tag = Announcement
	// FirstPlatform is the first tag marked as a platform.
	FirstPlatform Tag = ANSI
	// LastCategory is the final tag marked as a category.
	LastCategory Tag = Install
	// LastPlatform is the final tag marked as a platform.
	LastPlatform Tag = Windows
	// CategoryCount is the number of tags used as a category.
	CategoryCount = int(FirstCategory + LastCategory + 1)
	// PlatformCount is the number of tags used as a platform.
	PlatformCount = int(LastPlatform - FirstPlatform + 1)
)
const (
	Announcement Tag = iota
	ANSIEditor
	AppleII
	AtariST
	BBS
	Bust
	Drama
	Rule
	Tool
	Intro
	Demo
	ForSale
	Ftp
	GameHack
	Job
	Guide
	Interview
	Mag
	News
	Nfo
	NfoTool
	Pack
	Proof
	Restrict
	Install
	ANSI
	Audio
	DataB
	DOS
	Markup
	Image
	Java
	Linux
	Mac
	PCB
	PDF
	PHP
	Text
	TextAmiga
	Video
	Windows
)

func List

func List() []Tag

List all the tags.

func TagByURI

func TagByURI(slug string) Tag

TagByURI returns the tag belonging to the URI slug.

func (Tag) String

func (t Tag) String() string

type TagData

type TagData struct {
	URI   string // URI is a unique URL slug for the tag.
	Name  string // Name is the tags displayed title.
	Info  string // Info is a short description of the tag.
	Count int    // Count is the results of file count query for the tag.
}

TagData holds the tag information.

type URIS

type URIS map[Tag]string

URIS is a unique string for the tag.

func Determiner

func Determiner() URIS

Determiner is the article used before the tag name.

func Names

func Names() URIS

Names or titles of the URI tags. For consistency, the names and descriptions should be in US English and singular.

func URIs

func URIs() URIS

URIs returns the URI slugs for the tags.

Jump to

Keyboard shortcuts

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