html3

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package htm3 is a sub-package of the model package that should only be used by the html3 handler. It contains the database queries for the HTML3 templates used to display the file lists in a table format.

Index

Constants

View Source
const (
	// From is the name of the table containing records of files.
	From = "files"
	// ClauseNoSoftDel is the clause to exclude soft deleted records.
	ClauseNoSoftDel = "deletedat IS NULL"
)

Variables

View Source
var (
	ErrDB    = errors.New("database value is nil")
	ErrModel = errors.New("error, no file model")
)

Functions

func ArtExpr

func ArtExpr() qm.QueryMod

ArtExpr returns a query modifier for the digital or pixel art category.

func Created

func Created(f *models.File) string

Created returns the Createdat time to use a dd-mmm-yyyy format.

func DocumentExpr

func DocumentExpr() qm.QueryMod

DocumentExpr returns a query modifier for the document category.

func Icon

func Icon(f *models.File) string

Icon returns the extensionless name of a .gif image file to use as an icon for the filename. The icons are found in `public/image/html3/`.

func LeadStr

func LeadStr(width int, s string) string

LeadStr takes a string and returns the leading whitespace padding, characters wide.

func Published

func Published(f *models.File) string

Published takes optional DateIssuedYear, DateIssuedMonth and DateIssuedDay values and formats them into dd-mmm-yyyy string format. Depending on the context, any missing time values will be left blank or replaced with ?? question marks.

func PublishedFW

func PublishedFW(width int, f *models.File) string

PublishedFW formats the publication year, month and day to a fixed-width length w value.

func SelectHTML3

func SelectHTML3() qm.QueryMod

SelectHTML3 selects only the columns required by the HTML3 template.

func SoftwareExpr

func SoftwareExpr() qm.QueryMod

SoftwareExpr returns a query modifier for the software category.

Types

type Arts

type Arts struct {
	Bytes int `boil:"size_total"`  // the total bytes of all the files
	Count int `boil:"count_total"` // the total number of files
}

Arts statistics for releases that are digital or pixel art.

func (*Arts) Stat

func (a *Arts) Stat(ctx context.Context, db *sql.DB) error

Stat sets the total bytes and total count.

type Documents

type Documents struct {
	Bytes int `boil:"size_total"`  // the total bytes of all the files
	Count int `boil:"count_total"` // the total number of files
}

Documents statistics for releases that are documents.

func (*Documents) Stat

func (d *Documents) Stat(ctx context.Context, db *sql.DB) error

Stat sets the total bytes and total count.

type Order

type Order int

Order the query using a table column.

const (
	NameAsc Order = iota // NameAsc order the ascending query using the filename.
	NameDes              // NameDes order the descending query using the filename.
	PublAsc              // PublAsc order the ascending query using the date published.
	PublDes              // PublDes order the descending query using the date published.
	PostAsc              // PostAsc order the ascending query using the date posted.
	PostDes              // PostDes order the descending query using the date posted.
	SizeAsc              // SizeAsc order the ascending query using the file size.
	SizeDes              // SizeDes order the descending query using the file size.
	DescAsc              // DescAsc order the ascending query using the record title.
	DescDes              // DescDes order the descending query using the record title.
)

func (Order) Art

func (o Order) Art(ctx context.Context, db *sql.DB, offset, limit int) (models.FileSlice, error)

Art returns all the files that could be considered as digital or pixel art.

func (Order) ByCategory

func (o Order) ByCategory(
	ctx context.Context, db *sql.DB, offset, limit int, name string) (
	models.FileSlice, error,
)

ByCategory returns all the files that match the named category.

func (Order) ByGroup

func (o Order) ByGroup(ctx context.Context, db *sql.DB, name string) (models.FileSlice, error)

ByGroup returns all the files that match an exact named group.

func (Order) ByPlatform

func (o Order) ByPlatform(
	ctx context.Context, db *sql.DB, offset, limit int, name string) (
	models.FileSlice, error,
)

ByPlatform returns all the files that match the named platform.

func (Order) Document

func (o Order) Document(ctx context.Context, db *sql.DB, offset, limit int) (models.FileSlice, error)

Document returns all the files that are considered to be documents.

func (Order) Everything

func (o Order) Everything(ctx context.Context, db *sql.DB, offset, limit int) (models.FileSlice, error)

Everything returns all of the file records.

func (Order) Software

func (o Order) Software(ctx context.Context, db *sql.DB, offset, limit int) (models.FileSlice, error)

Software returns all the files that are considered to be software.

func (Order) String

func (o Order) String() string

type Softwares

type Softwares struct {
	Bytes int `boil:"size_total"`  // the total bytes of all the files
	Count int `boil:"count_total"` // the total number of files
}

Softwares contain statistics for releases that are software.

func (*Softwares) Stat

func (s *Softwares) Stat(ctx context.Context, db *sql.DB) error

Stat sets the total bytes and total count.

Jump to

Keyboard shortcuts

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