lib

package module
v0.0.0-...-e8bfa4e Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: JSON Imports: 29 Imported by: 0

README

Lib

Documentation

Index

Constants

View Source
const (
	Fileperm = 0644
	Dirperm  = 0755
)

Variables

View Source
var (
	IP = getIP()

	DataDir   = filepath.Join(root, "data")
	ImgDir    = filepath.Join(root, "images")
	TnDir     = filepath.Join(root, ".thumbnails")
	StaticDir = filepath.Join(root, "static")
	TemplDir  = filepath.Join(root, "templates")
)

Functions

func AppendFile

func AppendFile(name string, line string)

func AppendIni

func AppendIni[T any](file string, section T)

func Attr

func Attr(root *html.Node, attr string) string

func ByteSize

func ByteSize(bytes int) string

func Check

func Check(err error)

func ClearErrors

func ClearErrors()

func Download

func Download(url, path string) error

func Exists

func Exists(path string) bool

func FindById

func FindById(root *html.Node, id string) *html.Node

func FmtNum

func FmtNum(i int) string

func GetJson

func GetJson(url string, res any) error

func GitUpdate

func GitUpdate()

func HttpErr

func HttpErr(w http.ResponseWriter, err error)

func IsPicture

func IsPicture(path string) bool

func IterChildren

func IterChildren(root *html.Node, cb func(*html.Node))

func LoadList

func LoadList(path string) []string

func Log

func Log(err error)

func MakeThumbnail

func MakeThumbnail(src, dest string) error

func Mod

func Mod(i, length int) int

func MoveToFolder

func MoveToFolder(file, folder string) error

func NodeText

func NodeText(root *html.Node) string

func OpenUrl

func OpenUrl(url string)

func Parallel

func Parallel[T any](elements []T, callback func(el T) error) error

func ParallelMap

func ParallelMap[T any, R any](elements []T, mapper func(el T) (R, error)) ([]R, error)

func ParseHtml

func ParseHtml(path string) *html.Node

func ParseIni

func ParseIni[T any](path string) ([]T, error)

func RenderTemplate

func RenderTemplate(w http.ResponseWriter, temp string, data any)

func ReplaceFile

func ReplaceFile(src string, data []byte)

func Reverse

func Reverse[S ~[]E, E any](s S)

func ServeDir

func ServeDir(dir string)

func StartServer

func StartServer(port int)

func TrashFile

func TrashFile(path string)

Types

type Error

type Error struct {
	Time time.Time
	Err  string
}

func GetErrors

func GetErrors() []Error

type SQL

type SQL struct {
	Tables []string
	// contains filtered or unexported fields
}

func ParseSql

func ParseSql(sql string) *SQL

func (*SQL) Query

func (q *SQL) Query(name string) string

type Set

type Set struct {
	Path string
	Map  map[string]struct{}
}

func LoadSet

func LoadSet(path string) *Set

func (*Set) Add

func (s *Set) Add(line string)

func (*Set) Has

func (s *Set) Has(line string) bool

func (*Set) Len

func (s *Set) Len() int

Jump to

Keyboard shortcuts

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