Documentation ¶
Index ¶
- type Categories
- type Search
- type Stat
- type Storage
- func (s *Storage) Close()
- func (s *Storage) CreateTables()
- func (s *Storage) GetCategories() (*stats.Categories, error)
- func (s *Storage) GetColumnCount(column, query string, values []interface{}) ([]stats.Stat, error)
- func (s *Storage) GetCount(query string, values []interface{}) (int, error)
- func (s *Storage) StoreSearch(search ukpolice.Search) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Categories ¶
type Search ¶
type Search struct { ID string `json:"id,omitempty" db:"id,omitempty"` Force string `json:"force,omitempty" db:"force,omitempty"` MonthYear string `json:"month_year,omitempty" db:"month_year,omitempty"` Time time.Time `json:"time,omitempty" db:"time,omitempty"` AgeRange string `json:"age_range,omitempty" db:"age_range,omitempty"` Ethnicity string `json:"ethnicity,omitempty" db:"ethnicity,omitempty"` Outcome struct { SearchHappened bool `json:"search_happened,omitempty" db:"search_happened,omitempty"` Desc string `json:"desc,omitempty" db:"outcome,omitempty"` } `json:"outcome,omitempty"` Gender string `json:"gender,omitempty" db:"gender,omitempty"` OutcomeLinkedToObject bool `json:"outcome_linked_to_object,omitempty" db:"outcome_linked_to_object,omitempty"` ObjectOfSearch string `json:"object_of_search,omitempty" db:"object_of_search,omitempty"` Legislation string `json:"legislation,omitempty" db:"legislation"` }
Search defines the Search form of a stop and search record
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage holds a postgres connection.
func (*Storage) CreateTables ¶
func (s *Storage) CreateTables()
CreateTables will drop any existing tables and create new. Panics on fail.
func (*Storage) GetCategories ¶
func (s *Storage) GetCategories() (*stats.Categories, error)
GetCategories fetches DISTINCT rows for each category
func (*Storage) GetColumnCount ¶
GetColumnCount returns a slice of stats representing the result of SELECT column, COUNT(column) ... WHERE ... GROUP BY column
Click to show internal directories.
Click to hide internal directories.