Documentation
¶
Overview ¶
Package html3 renders the html3 sub-route of the website. This generates pages for the website for browsing of the file database using HTML3 styled tables.
Index ¶
- Constants
- Variables
- func All(c echo.Context, db *sql.DB, sl *slog.Logger) error
- func Art(c echo.Context, db *sql.DB, sl *slog.Logger) error
- func Categories(c echo.Context, sl *slog.Logger) error
- func Category(c echo.Context, db *sql.DB, sl *slog.Logger) error
- func Clauses(query string) html3.Order
- func Description(section, platform, brand, title null.String) string
- func Documents(c echo.Context, db *sql.DB, sl *slog.Logger) error
- func Error(c echo.Context, err error) error
- func FileHref(sl *slog.Logger, id int64) string
- func FileLinkPad(width int, name null.String) string
- func Filename(width int, name null.String) string
- func GlobTo(name string) string
- func Group(c echo.Context, db *sql.DB, sl *slog.Logger) error
- func Groups(c echo.Context, db *sql.DB, sl *slog.Logger) error
- func ID(c echo.Context) string
- func Index(c echo.Context, db *sql.DB, sl *slog.Logger) error
- func LeadFS(width int, size null.Int64) string
- func LeadFSInt(width, size int) string
- func LeadInt(width, i int) string
- func Leading(count int) string
- func List(c echo.Context, db *sql.DB, sl *slog.Logger, tt RecordsBy) error
- func ListInfo(tt RecordsBy, current, id string) (string, string)
- func Pagi(page int, maxPage int) (int, int, int)
- func Platform(c echo.Context, db *sql.DB, sl *slog.Logger) error
- func Platforms(c echo.Context, sl *slog.Logger) error
- func Query(c echo.Context, db *sql.DB, tt RecordsBy, offset int) (int, int, int64, models.FileSlice, error)
- func QueryAsArt(ctx context.Context, exec boil.ContextExecutor, clause string, offset int) (int, int, int64, models.FileSlice, error)
- func QueryAsDocument(ctx context.Context, exec boil.ContextExecutor, clause string, offset int) (int, int, int64, models.FileSlice, error)
- func QueryAsSoftware(ctx context.Context, exec boil.ContextExecutor, clause string, offset int) (int, int, int64, models.FileSlice, error)
- func QueryByGroup(ctx context.Context, exec boil.ContextExecutor, c echo.Context) (int, int, int64, models.FileSlice, error)
- func QueryByPlatform(ctx context.Context, exec boil.ContextExecutor, c echo.Context, offset int) (int, int, int64, models.FileSlice, error)
- func QueryBySection(ctx context.Context, exec boil.ContextExecutor, c echo.Context, offset int) (int, int, int64, models.FileSlice, error)
- func QueryEverything(ctx context.Context, exec boil.ContextExecutor, clause string, offset int) (int, int, int64, models.FileSlice, error)
- func Routes(e *echo.Echo, db *sql.DB, sl *slog.Logger) *echo.Group
- func Software(c echo.Context, db *sql.DB, sl *slog.Logger) error
- func Sorter(query string) map[string]string
- func Sortings() map[Sort]string
- func TemplateFuncMap(db *sql.DB, sl *slog.Logger) template.FuncMap
- func Templates(db *sql.DB, sl *slog.Logger, fs embed.FS) map[string]*template.Template
- type File
- type Navigate
- type RecordsBy
- type Sort
- type Templ
Constants ¶
const ( NameAsc = "C=N&O=A" // Name ascending order. NameDes = "C=N&O=D" // Name descending order. PublAsc = "C=D&O=A" // Date published ascending order. PublDes = "C=D&O=D" // Date published descending order. PostAsc = "C=P&O=A" // Posted ascending order. PostDes = "C=P&O=D" // Posted descending order. SizeAsc = "C=S&O=A" // Size ascending order. SizeDes = "C=S&O=D" // Size descending order. DescAsc = "C=I&O=A" // Description ascending order. DescDes = "C=I&O=D" // Description descending order. Name Sort = "Name" // Sort records by the filename. Publish Sort = "Publish" // Sort records by the published year, month and day. Posted Sort = "Posted" // Sort records by the record creation dated. Size Sort = "Size" // Sort records by the file size in byte units. Desc Sort = "Description" // Sort the records by the title. )
Sort and order the records by the column name.
const Prefix = "/html3"
Prefix is the root path of the HTML3 router group.
Variables ¶
Functions ¶
func Art ¶ added in v1.8.0
Art lists the file records described as art are digital + pixel art files.
func Categories ¶ added in v1.8.0
Categories lists the names, descriptions and sums of the category (section) tags.
func Category ¶ added in v1.8.0
Category lists the file records associated with the category tag that is provided by the ID param in the URL.
func Description ¶
func Description(section, platform, brand, title null.String) string
Description returns a HTML3 friendly file description.
func Documents ¶ added in v1.8.0
Documents lists the file records described as document + text art files.
func FileLinkPad ¶
FileLinkPad adds whitespace padding after the hyperlinked filename.
func Group ¶ added in v1.8.0
Group lists the file records associated with the group that is provided by the ID param in the URL.
func ID ¶
func ID(c echo.Context) string
ID returns the ID from the URL path. This is only used for the category and platform routes.
func LeadInt ¶
LeadInt takes an int and returns it as a string, w characters wide with whitespace padding.
func Pagi ¶
Pagi returns up to three page numbers for pagination links. The absolute numbers will always be in sequence except for returned values of zero, which should be skipped.
func Platform ¶ added in v1.8.0
Platform lists the file records associated with the platform tag that is provided by the ID param in the URL.
func Platforms ¶ added in v1.8.0
Platforms lists the names, descriptions and sums of the platform tags.
func Query ¶
func Query(c echo.Context, db *sql.DB, tt RecordsBy, offset int) (int, int, int64, models.FileSlice, error)
Query returns a slice of records based on the RecordsBy grouping. The three integers returned are the limit, the total count of records and the file sizes summed.
func QueryAsArt ¶
func QueryAsArt(ctx context.Context, exec boil.ContextExecutor, clause string, offset int) ( int, int, int64, models.FileSlice, error, )
QueryAsArt returns a slice of all the records filtered by "Digital + pixel art".
func QueryAsDocument ¶
func QueryAsDocument(ctx context.Context, exec boil.ContextExecutor, clause string, offset int) ( int, int, int64, models.FileSlice, error, )
QueryAsDocument returns a slice of all the records filtered by "Document + text art".
func QueryAsSoftware ¶
func QueryAsSoftware(ctx context.Context, exec boil.ContextExecutor, clause string, offset int) ( int, int, int64, models.FileSlice, error, )
QueryAsSoftware returns a slice of all the records filtered by "Software".
func QueryByGroup ¶
func QueryByGroup(ctx context.Context, exec boil.ContextExecutor, c echo.Context) ( int, int, int64, models.FileSlice, error, )
QueryByGroup returns a slice of all the records filtered by the group id, "by Group". The group records do not use pagination limits or offsets.
func QueryByPlatform ¶
func QueryByPlatform(ctx context.Context, exec boil.ContextExecutor, c echo.Context, offset int) ( int, int, int64, models.FileSlice, error, )
QueryByPlatform returns a slice of all the records filtered by the platform id, "by Platform and media".
func QueryBySection ¶
func QueryBySection(ctx context.Context, exec boil.ContextExecutor, c echo.Context, offset int) ( int, int, int64, models.FileSlice, error, )
QueryBySection returns a slice of all the records filtered by the section id, "by Category".
func QueryEverything ¶
func QueryEverything(ctx context.Context, exec boil.ContextExecutor, clause string, offset int) ( int, int, int64, models.FileSlice, error, )
QueryEverything returns a slice of all the records, "Everything".
func Routes ¶
Routes for the /html3 sub-route group. Any errors are logged and rendered to the client using HTTP codes and the custom /html3, group error template.
func Sorter ¶
Sorter creates the query string for the sortable columns. Replacing the O key value with the opposite value, either A or D.
func TemplateFuncMap ¶
TemplateFuncMap are a collection of mapped functions that can be used in a template.
Types ¶
type File ¶
type File struct { Filename string // Filename of the file. Title string // Title of the file. GroupBy string // Group name that's is credited with the file. Section string // Section is a tag categorization. Platform string // Platform or operating system of the file. Size int64 // Size of the file in bytes. }
File record details.
func (File) Description ¶
Description returns a HTML3 friendly file description.
func (File) FileLinkPad ¶
FileLinkPad adds whitespace padding after the hyperlinked filename.
type RecordsBy ¶
type RecordsBy int
RecordsBy are the record groupings.
const ( Everything RecordsBy = iota // Everything displays all records from the file table. BySection // BySection groups records by the section file table column. ByPlatform // BySection groups records by the platform file table column. ByGroup // ByGroup groups the records by the distinct, group_brand_for file table column. AsArt // AsArt group records as art. AsDocument // AsDocument group records as documents. AsSoftware // AsSoftware group records as software. )