app

package
v0.0.0-...-60c1827 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SQL_ERR_NO_ROWS  = `sql: no rows in result set`
	DATE_LAYOUT      = `2006-01-02`
	DATE_TIME_LAYOUT = `2006-01-02 15:04:05 MST`
	START_YEAR       = 2003
	START_MONTH      = time.November

	// SQL queries {{{
	Q_HITS = `` /* 450-byte string literal not displayed */

	Q_BINGOS = `` /* 196-byte string literal not displayed */

	Q_ADJACENT_COUNTIES = `` /* 245-byte string literal not displayed */

	Q_LAST_50_HIT_IDS = `select id from hits order by entdate desc, id desc limit 50`

	Q_LAST_50_DENOM_SERIES = `
		select
			b.%s,
			count(1)
		from
			bills b,
			hits h
		where
			b.id=h.bill_id and h.id in
				(` + Q_LAST_50_HIT_IDS + `)
		group by
			b.%s
		order by
			b.%s
	`

	Q_LAST_50_STATES = `
		select cm.state, count(1)
		from hits h, counties_master cm
		where h.id in (` + Q_LAST_50_HIT_IDS + `) and cm.id = h.county_id and country = 'US'
		group by cm.state
		union
		  select state, count(1)
		  from hits
		  where id in (` + Q_LAST_50_HIT_IDS + `) and country = 'Canada'
		  group by state
		  union
		    select country, count(1)
		    from hits
		    where id in (` + Q_LAST_50_HIT_IDS + `) and country not in ('US', 'Canada')
		    group by country
		order by count desc, state asc
	`

	Q_LAST_50_COUNTIES = `
		select cm.state, cm.county, count(1)
		from hits h, counties_master cm
		where h.id in (` + Q_LAST_50_HIT_IDS + `) and cm.id = h.county_id and country = 'US'
		group by cm.state, cm.county
		union
		  select state, city, count(1)
		  from hits
		  where id in (` + Q_LAST_50_HIT_IDS + `) and country = 'Canada'
		  group by state, city
		  union
		    select country, city, count(1)
		    from hits
		    where id in (` + Q_LAST_50_HIT_IDS + `) and country not in ('US', 'Canada')
		    group by country, city
		order by count desc, state asc, county asc
	`

	Q_HITS_CALENDAR = `
		select
			substr(entdate::text, 6) as date,
			count(1)
		from
			hits
		group by
			date
	`

	SERIAL_RE_BASE = `[A-L][0-9\-]{8}[A-NP-Y\*]$`
)

Variables

View Source
var (
	// AppVersion revel app version (ldflags)
	AppVersion string

	// BuildTime revel app build-time (ldflags)
	BuildTime string

	// my vars
	SeriesByLetter map[string]string
)
View Source
var (
	RE_dbUnsafe           *re.Regexp
	RE_singleQuote        *re.Regexp
	RE_whitespace         *re.Regexp
	RE_leadingWhitespace  *re.Regexp
	RE_trailingWhitespace *re.Regexp
	RE_serial             *re.Regexp
	RE_serial_10          *re.Regexp
	RE_serial_11          *re.Regexp
	RE_series             *re.Regexp
	RE_trailingCommas     *re.Regexp
	RE_date               *re.Regexp
	RE_nonNumeric         *re.Regexp
)
View Source
var DB *sql.DB
View Source
var Environment string
View Source
var HeaderFilter = func(c *revel.Controller, fc []revel.Filter) {
	c.Response.Out.Header().Add("X-Frame-Options", "SAMEORIGIN")
	c.Response.Out.Header().Add("X-XSS-Protection", "1; mode=block")
	c.Response.Out.Header().Add("X-Content-Type-Options", "nosniff")
	c.Response.Out.Header().Add("Referrer-Policy", "strict-origin-when-cross-origin")

	fc[0](c, fc[1:])
}

HeaderFilter adds common security headers There is a full implementation of a CSRF filter in https://github.com/revel/modules/tree/master/csrf

Functions

func InitDB

func InitDB()

func InitRE

func InitRE()

func InitSeries

func InitSeries()

Types

type Bill

type Bill struct {
	Id           int
	Serial       string
	Series       string
	Denomination int
	Rptkey       string
	Residence    string
	Message      string
}

type BingoDetail

type BingoDetail struct {
	Id     int
	State  string
	County string
	Hits   bool
}

type BingoSummary

type BingoSummary struct {
	Id    int
	Label string
	Count int
	Max   int
}

type DateSelData

type DateSelData struct {
	Year   int
	Month  string
	Day    string
	Years  []int
	Months [12]string
	Days   []string
}

type DayOfMonth

type DayOfMonth struct {
	Label  string
	Months [12]int
	Total  string
}

type DualRegionBrkEnt

type DualRegionBrkEnt struct {
	Rank    int
	RankStr string
	State   string
	County  string
	Count   int
}

type Hit

type Hit struct {
	Id        int
	BillId    int
	Index     int
	Denom     int
	Serial    string
	Series    string
	RptKey    string
	EntDate   string
	Residence string
	Country   string
	State     string
	County    string
	City      string
	ZIP       string
	Count     int
}

type HitInfo

type HitInfo struct {
	FirstOnDate      string
	FirstInCounty    string
	CountyBingoNames []string
	AdjacentCounties []string
	HARFillers       []string
	GenericMessage   string
}

type HitsBrkEnt

type HitsBrkEnt struct {
	Region string
	Count  int
}

type Region

type Region struct {
	Id     int
	Region string
}

type TZRec

type TZRec struct {
	TZDescr  string
	TZString string
}

type USCounty

type USCounty struct {
	Id     int
	State  string
	County string
}

type UserPrefs

type UserPrefs struct {
	TZString     string
	WGProfileKey string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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