groups

package
v1.11.11 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package groups deals with group names and their initialisms.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCronDir = errors.New("cronjob directory does not exist")
	ErrHTMLDir = errors.New("the directory.html setting is empty")
	ErrTag     = errors.New("cronjob tag cannot be an empty string")
)

Functions

func Contains added in v1.10.0

func Contains(x string, sorted []string) bool

Contains returns true whenever sorted contains x. The slice value must be stored in increasing order.

func Count added in v1.10.2

func Count(db *sql.DB, name string) (int, error)

Count returns the number of file entries associated with a named group.

func Cronjob

func Cronjob(db *sql.DB, w, dest io.Writer, tag string, force bool) error

Cronjob is used for system automation to generate dynamic HTML pages.

func Exact added in v1.10.0

func Exact(db *sql.DB, name string) (int, error)

Exact returns the number of file entries that match an exact named filter. The casing is ignored, but comma separated multi-groups are not matched to their parents. The name "tristar" will match "Tristar" but will not match records using "Tristar, Red Sector Inc".

func Fix

func Fix(db *sql.DB, w io.Writer) error

Fix any malformed group names found in the database.

func Format added in v1.10.0

func Format(name string) string

Format returns a copy of name with custom formatting.

func Initialism

func Initialism(db *sql.DB, name string) (string, error)

Initialism returns a named group initialism or acronym.

func List added in v1.10.0

func List(db *sql.DB, w io.Writer) ([]string, int, error)

List returns all the distinct groups.

func Match added in v1.11.0

func Match(db *sql.DB, w io.Writer, maxCount int) error

Match scans over the groups and attempts to match possible misnamed duplicates. The results are printed to stdout in realtime. maxCount is intended for tests and will limit the number of groups to scan.

func Slug

func Slug(s string) string

Slug takes a string and makes it into a URL friendly slug.

func SwapAll added in v1.10.0

func SwapAll(group, str, swap string) string

SwapAll finds all occurrences of str within a group name and replaces it with swap.

func SwapNumeral added in v1.10.0

func SwapNumeral(group string, i int) string

SwapNumeral finds any occurrences of i within a group name and swaps it for a cardinal number.

func SwapOne added in v1.10.0

func SwapOne(group, str, swap string) string

SwapOne finds the first occurrence of str within a group name and replaces it with swap.

func SwapOrdinal added in v1.10.0

func SwapOrdinal(group string, i int) string

SwapOrdinal finds any occurrences of i within a group name and swaps it for a ordinal number.

func SwapPrefix added in v1.10.0

func SwapPrefix(group, prefix, swap string) string

SwapPrefix replaces the prefix value at the start of a group name and replaces it with swap. An empty string is returned if the prefix does not exist in the name.

func SwapSuffix added in v1.10.0

func SwapSuffix(group, suffix, swap string) string

SwapSuffix replaces the suffix value at the end of a group name and replaces it with swap. An empty string is returned if the suffix does not exist in the name.

func Tags added in v1.11.0

func Tags() []string

Tags are the group categories.

func TrimSP added in v1.10.0

func TrimSP(name string) (string, string, string)

TrimSP removes all spaces from a named group, BBS or FTP site. The first string returns the spaceless name. The second string returns a spaceless name appended with the plural "s". The third string is spaceless name appended with the plural "z".

func Update added in v1.10.0

func Update(db *sql.DB, newName, group string) (int64, error)

Update replaces all instances of the group name with the new group name.

func Variations

func Variations(db *sql.DB, name string) ([]string, error)

Variations creates format variations for a named filter.

Types

type Request

type Request request.Flags

Request flags for group functions.

func (Request) DataList

func (r Request) DataList(db *sql.DB, w, dest io.Writer) error

DataList prints an auto-complete list for HTML input elements.

func (Request) HTML

func (r Request) HTML(db *sql.DB, w, dest io.Writer) error

HTML prints a snippet listing links to each group, with an optional file count.

func (Request) Print

func (r Request) Print(db *sql.DB, w io.Writer) (int, error)

Print a list of organisations or groups filtered by a name and summarizes the results.

Directories

Path Synopsis
internal
acronym
Package acronym handles the initialisms and acronyms frequently used by the groups.
Package acronym handles the initialisms and acronyms frequently used by the groups.
filter
Package filter returns the groups based on a role or activity filter.
Package filter returns the groups based on a role or activity filter.
rename
Package rename handles the renaming and formatting of the group title.
Package rename handles the renaming and formatting of the group title.
request
Package request obtains and writes the data of the group to various formats.
Package request obtains and writes the data of the group to various formats.

Jump to

Keyboard shortcuts

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