queries

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPageLimit = uint64(100)
View Source
const IncreasedPageLimit = uint64(1_000)

Variables

This section is empty.

Functions

func GetCountFetchedLastTwelveMonths added in v1.2.0

func GetCountFetchedLastTwelveMonths(db *sql.DB) int

func GetCountTotalTaxa added in v1.2.0

func GetCountTotalTaxa(db *sql.DB) int

Types

type Counts

type Counts struct {
	TaxaCount        int
	ObservationCount int
}

type Query

type Query struct {
	ORDER_BY      string
	ORDER_DIR     string
	SEARCH        string
	COUNTRY       string
	RANK          string
	TAXA          string
	PAGE          string
	SHOW_SYNONYMS bool
}

func NewQuery

func NewQuery(payload any) Query

Create a new query object with default values or set values from payload struct

func (Query) GetCounts added in v1.3.1

func (q Query) GetCounts(db *sql.DB) Counts

Get the counts of taxa and observations based on the query

func (Query) GetTableData added in v1.3.1

func (q Query) GetTableData(db *sql.DB, increaseLimit ...bool) *TableRows

Get the table data based on the query

type TableRow

type TableRow struct {
	TaxonID          string
	ScientificName   sql.NullString
	CountryCode      sql.NullString
	CountryCodeClean string
	CountryFlag      string
	LastFetch        sql.NullTime
	ObservationID    sql.NullString
	ObservationDate  sql.NullTime
	ObservedDiff     string

	IsSynonym   bool
	SynonymName sql.NullString
	SynonymID   sql.NullString

	TaxonKingdom string
	TaxonPhylum  string
	TaxonClass   string
	TaxonOrder   string
	TaxonFamily  string
	Taxa         string
}

type TableRows added in v1.3.1

type TableRows struct {
	Rows []TableRow
}

func (*TableRows) CreateCSV added in v1.3.1

func (rows *TableRows) CreateCSV() string

Create a CSV string from the table data, this is used for exporting data

Jump to

Keyboard shortcuts

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