database

package
v0.0.0-...-0a7c643 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connection

func Connection() *sqlx.DB

Types

type Statement

type Statement string
const (
	// InsertOutfit inserts outfits. Requires a fully populated &Outfit
	InsertOutfit Statement = "" /* 202-byte string literal not displayed */

	// UpdateOutfit Requires a fully populated &Outfit. Will overwrite the outfit with the provided ID
	UpdateOutfit Statement = "" /* 207-byte string literal not displayed */

	// GetOutfit Requires an ID string. Returns one outfit
	GetOutfit Statement = "SELECT * FROM outfits WHERE id = :id"

	// GetOutfitFromTag Requires a Tag. Returns one outfit
	GetOutfitFromTag Statement = "SELECT * FROM outfits WHERE tag = :tag AND deleted = 0" // TODO: Way to add a LIMIT X?

	// GetRandomOutfit Requires nothing. Returns one outfit
	GetRandomOutfit Statement = "SELECT 1 FROM outfits WHERE deleted = 0 ORDER BY RANDOM()"

	// GetRandomOutfitFromSubmitter Requires a user ID. Returns one outfit
	GetRandomOutfitFromSubmitter Statement = "SELECT 1 FROM outfits WHERE submitter = :submitter AND deleted = 0 ORDER BY RANDOM()"

	// GetTopFive requires nothing. Returns 5 user IDs and the number of outfits
	GetTopFive Statement = "SELECT submitter, count(*) AS num FROM outfits WHERE deleted = false GROUP BY submitter ORDER BY num DESC LIMIT 5"
)

Jump to

Keyboard shortcuts

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