util

package
v0.0.0-...-5a58481 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Config = &UtilConfig{}
)

Functions

func FetchFile

func FetchFile(file string) ([]byte, string, error)

first checks in cache for file. Will fetch from url if needed

func FetchImage

func FetchImage(file string, x int, y int) ([]byte, string, error)

Like FetchFile, but will resize images and redraw gifs

func LoadFont

func LoadFont(fontName string) *truetype.Font

func ReadFileAndUnmarshal

func ReadFileAndUnmarshal(path string, out interface{}) error

func SetUtilConfig

func SetUtilConfig(config *UtilConfig)

Types

type Date

type Date struct {
	time.Time
}

func (Date) MarshalJSON

func (d Date) MarshalJSON() ([]byte, error)

MarshalJSON to ensure consistent date formatting

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the Date type

type RGBA

type RGBA struct {
	color.RGBA
}

func (*RGBA) UnmarshalXMLAttr

func (c *RGBA) UnmarshalXMLAttr(attr xml.Attr) error

type Refresher

type Refresher struct {
	// contains filtered or unexported fields
}

func RefresherCreate

func RefresherCreate(interval time.Duration, onRefresh func()) *Refresher

func (*Refresher) Start

func (r *Refresher) Start()

func (*Refresher) Stop

func (r *Refresher) Stop()

type UtilConfig

type UtilConfig struct {
	CacheDir string
	FontDir  string
}

Jump to

Keyboard shortcuts

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