config

package
v0.0.0-...-92892ad Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CheevoByID = map[string]*Cheevo{}
	CheevoList []*Cheevo
	CheevoTree map[string][]*Cheevo
)
View Source
var (
	CountryByID = map[string]*Country{}
	CountryTree map[string][]*Country
)
View Source
var (
	// Standard holes.
	HoleByID = map[string]*Hole{}
	HoleList []*Hole

	// Experimental holes.
	ExpHoleByID = map[string]*Hole{}
	ExpHoleList []*Hole

	// All holes.
	AllHoleByID = map[string]*Hole{}
	AllHoleList []*Hole

	// Ten most recent holes, used for /rankings/recent-holes.
	RecentHoles []*Hole
)
View Source
var (
	// Standard languages.
	LangByID = map[string]*Lang{}
	LangList []*Lang

	// Experimental languages.
	ExpLangByID = map[string]*Lang{}
	ExpLangList []*Lang

	// All languages.
	AllLangByID = map[string]*Lang{}
	AllLangList []*Lang
)
View Source
var PathSlug = regexp.MustCompile("{[a-z]+}")
View Source
var Settings map[string][]*Setting

Functions

func ID

func ID(name string) string

ID is a lowercase simplified version of the name used in URLs and the DB. Some characters (like "#") are changed to be safe in URLs.

Types

type Cheevo

type Cheevo struct {
	Dates       []toml.LocalDate `json:"-"`
	Description template.HTML    `json:"description"`
	Emoji       string           `json:"emoji"`
	ID          string           `json:"id"`
	Name        string           `json:"name"`
	Target      int              `json:"-"`
	Times       []time.Time      `json:"-"`
}

func (*Cheevo) Scan

func (c *Cheevo) Scan(id any) error

type Country

type Country struct{ ID, Flag, Name string }

type Hole

type Hole struct {
	CaseFold                    bool             `json:"-" toml:"case-fold"`
	Categories                  []string         `json:"-"`
	Category                    string           `json:"category"`
	CategoryColor, CategoryIcon string           `json:"-"`
	Data                        template.JS      `json:"-"`
	Experiment                  int              `json:"-"`
	ID                          string           `json:"id"`
	ItemDelimiter               string           `json:"-" toml:"item-delimiter"`
	MultisetDelimiter           string           `json:"-" toml:"multiset-delimiter"`
	Links                       []Link           `json:"links"`
	Name                        string           `json:"name"`
	Preamble                    template.HTML    `json:"preamble"`
	Prev, Next                  *Hole            `json:"-"`
	Released                    toml.LocalDate   `json:"released"`
	Releases                    []toml.LocalDate `json:"-"`
	Synopsis                    string           `json:"synopsis"`
	Variants                    []*Hole          `json:"-"`
}

func (*Hole) Scan

func (h *Hole) Scan(id any) error

func (*Hole) Value

func (h *Hole) Value() (driver.Value, error)

type Lang

type Lang struct {
	Example    string `json:"example"`
	Experiment int    `json:"experiment,omitempty"`
	ID         string `json:"id"`
	Name       string `json:"name"`
	Size       string `json:"size"`
	Version    string `json:"version"`
	Website    string `json:"website"`
}

func (*Lang) Scan

func (l *Lang) Scan(id any) error
type Link struct {
	Name string `json:"name"`
	URL  string `json:"url"`
	V    []int  `json:"-"`
}

type LinkGroup

type LinkGroup struct {
	Links      []*NavLink
	Name, Slug string
}
type NavLink struct{ Emoji, Name, Slug, Path string }
func (l NavLink) PopulatePath(r *http.Request) string
type Navigaton struct {
	Path      string
	Groups    []*LinkGroup
	OnePerRow bool
}
func (n *Navigaton) ReverseGroups() []*LinkGroup

type NullCountry

type NullCountry struct {
	Country *Country
	Valid   bool
}

func (*NullCountry) Scan

func (n *NullCountry) Scan(id any) error

type NullHole

type NullHole struct {
	Hole  *Hole
	Valid bool
}

func (*NullHole) Scan

func (n *NullHole) Scan(id any) error

type NullLang

type NullLang struct {
	Lang  *Lang
	Valid bool
}

func (*NullLang) Scan

func (n *NullLang) Scan(id any) error

type Option

type Option struct{ ID, Name string }

type Setting

type Setting struct {
	Checkbox          bool
	Default, ID, Name string
	Options           []*Option
}

func (*Setting) ValueOrDefault

func (s *Setting) ValueOrDefault(value string) string

Jump to

Keyboard shortcuts

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