database

package
v0.0.0-...-80e8cda Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const SitemapSize = 1000

Variables

This section is empty.

Functions

func AddEmailSubscriber

func AddEmailSubscriber(conn *sql.DB, email, token string) error

func AddFXRate

func AddFXRate(conn *sql.DB, fx FXRate) error

func CloseDbConn

func CloseDbConn(conn *sql.DB)

CloseDbConn closes db conn

func ConfirmEmailSubscriber

func ConfirmEmailSubscriber(conn *sql.DB, token string) error

func CountEmailSubscribers

func CountEmailSubscribers(conn *sql.DB) (int, error)

func CreateTmpSitemapTable

func CreateTmpSitemapTable(conn *sql.DB) error

func DeleteImageByID

func DeleteImageByID(conn *sql.DB, id string) error

func DuplicateImage

func DuplicateImage(conn *sql.DB, oldID, newID string) error

func GetDbConn

func GetDbConn(databaseUser string, databasePassword string, databaseHost string, databasePort string, databaseName string, sslMode string) (*sql.DB, error)

GetDbConn tries to establish a connection to postgres and return the connection handler

func GetJobClickoutsLast30Days

func GetJobClickoutsLast30Days(conn *sql.DB) (int, error)

func GetJobPageViewsLast30Days

func GetJobPageViewsLast30Days(conn *sql.DB) (int, error)

func GetRandomLocationsForCountry

func GetRandomLocationsForCountry(conn *sql.DB, country string, howMany int, excludeLoc string) ([]string, error)

func GetSitemapEntryCount

func GetSitemapEntryCount(conn *sql.DB) (int, error)

func GetSitemapLastMod

func GetSitemapLastMod(conn *sql.DB) (time.Time, error)

func GetWebsitePageViewsLast30Days

func GetWebsitePageViewsLast30Days(conn *sql.DB) (int, error)

func InitiatePaymentEventForDeveloperDirectoryAccess

func InitiatePaymentEventForDeveloperDirectoryAccess(conn *sql.DB, sessionID string, amount int64, description string, recruiterID string, email string, planDuration int64) error

func InitiatePaymentEventForJobAd

func InitiatePaymentEventForJobAd(conn *sql.DB, sessionID string, amount int64, description string, email string, jobID int, planType string, planDuration int64) error

func IsDevDirectoryPaymentEvent

func IsDevDirectoryPaymentEvent(conn *sql.DB, sessionID string) (bool, error)

func IsJobAdPaymentEvent

func IsJobAdPaymentEvent(conn *sql.DB, sessionID string) (bool, error)

func RemoveEmailSubscriber

func RemoveEmailSubscriber(conn *sql.DB, token string) error

func SaveCloudflareBrowserStat

func SaveCloudflareBrowserStat(conn *sql.DB, s CloudflareBrowserStat) error

func SaveCloudflareCountryStat

func SaveCloudflareCountryStat(conn *sql.DB, s CloudflareCountryStat) error

func SaveCloudflareStat

func SaveCloudflareStat(conn *sql.DB, s CloudflareStat) error

func SaveCloudflareStatusCodeStat

func SaveCloudflareStatusCodeStat(conn *sql.DB, s CloudflareStatusCodeStat) error

func SaveMedia

func SaveMedia(conn *sql.DB, media Media) (string, error)

func SaveSEOLandingPage

func SaveSEOLandingPage(conn *sql.DB, seoLandingPage SEOLandingPage) error

func SaveSEOLocation

func SaveSEOLocation(conn *sql.DB, name, country, currency string) string

func SaveSEOSkillFromCompany

func SaveSEOSkillFromCompany(conn *sql.DB)

func SaveSitemapEntry

func SaveSitemapEntry(conn *sql.DB, entry SitemapEntry) error

func SaveSuccessfulPaymentForDevDirectory

func SaveSuccessfulPaymentForDevDirectory(conn *sql.DB, sessionID string) (int, error)

func SaveSuccessfulPaymentForJobAd

func SaveSuccessfulPaymentForJobAd(conn *sql.DB, sessionID string) (int, error)

func SwapSitemapTable

func SwapSitemapTable(conn *sql.DB) error

func UpdateLastWeekClickouts

func UpdateLastWeekClickouts(conn *sql.DB) error

func UpdateMedia

func UpdateMedia(conn *sql.DB, media Media, mediaID string) error

Types

type CloudflareBrowserStat

type CloudflareBrowserStat struct {
	Date            time.Time
	PageViews       uint64
	UABrowserFamily string
}

type CloudflareCountryStat

type CloudflareCountryStat struct {
	Date        time.Time
	CountryCode string
	Requests    uint64
	Threats     uint64
}

type CloudflareStat

type CloudflareStat struct {
	Date        time.Time
	Bytes       uint64
	CachedBytes uint64
	PageViews   uint64
	Requests    uint64
	Threats     uint64
	Uniques     uint64
}

type CloudflareStatusCodeStat

type CloudflareStatusCodeStat struct {
	Date       time.Time
	StatusCode int
	Requests   uint64
}

type DevDirectoryPurchaseEvent

type DevDirectoryPurchaseEvent struct {
	StripeSessionID string
	CreatedAt       time.Time
	CompletedAt     time.Time
	ExpiredAt       time.Time
	Email           string
	Amount          int64
	Currency        string
	Description     string
	RecruiterID     string
	Duration        int64
}

func GetDevDirectoryPurchaseEventBySessionID

func GetDevDirectoryPurchaseEventBySessionID(conn *sql.DB, sessionID string) (DevDirectoryPurchaseEvent, error)

type EmailSubscriber

type EmailSubscriber struct {
	Email       string
	Token       string
	CreatedAt   time.Time
	ConfirmedAt *time.Time
}

func GetEmailSubscribers

func GetEmailSubscribers(conn *sql.DB) ([]EmailSubscriber, error)

type FXRate

type FXRate struct {
	Base      string
	Target    string
	Value     float64
	UpdatedAt time.Time
}

type Location

type Location struct {
	Name       string  `json:"name,omitempty"`
	Country    string  `json:"country,omitempty"`
	Region     string  `json:"region,omitempty"`
	Population int64   `json:"population,omitempty"`
	Lat        float64 `json:"lat,omitempty"`
	Long       float64 `json:"long,omitempty"`
	Currency   string  `json:"currency,omitempty"`
	Emoji      string  `json:"emoji,omitempty"`
}

func GetLocation

func GetLocation(conn *sql.DB, location string) (Location, error)

func LocationsByPrefix

func LocationsByPrefix(conn *sql.DB, prefix string) ([]Location, error)

type Media

type Media struct {
	Bytes     []byte
	MediaType string
}

func GetMediaByID

func GetMediaByID(conn *sql.DB, mediaID string) (Media, error)

type PurchaseEvent

type PurchaseEvent struct {
	StripeSessionID string
	CreatedAt       time.Time
	CompletedAt     time.Time
	Amount          int
	Currency        string
	Description     string
	Email           string
	JobID           int
	PlanType        string
	PlanDuration    int
}

func GetJobAdPurchaseEventBySessionID

func GetJobAdPurchaseEventBySessionID(conn *sql.DB, sessionID string) (PurchaseEvent, error)

func GetPurchaseEvents

func GetPurchaseEvents(conn *sql.DB, jobID int) ([]PurchaseEvent, error)

type SEOLandingPage

type SEOLandingPage struct {
	URI      string
	Location string
	Skill    string
}

type SEOLocation

type SEOLocation struct {
	Name       string
	Population int
}

func GetSEOLocations

func GetSEOLocations(conn *sql.DB) ([]SEOLocation, error)

type SEOSkill

type SEOSkill struct {
	Name string `json:"name,omitempty"`
}

func GetSEOskills

func GetSEOskills(conn *sql.DB) ([]SEOSkill, error)

func SkillsByPrefix

func SkillsByPrefix(conn *sql.DB, prefix string) ([]SEOSkill, error)

type SalaryDataPoint

type SalaryDataPoint struct {
	Min int64 `json:"min"`
	Max int64 `json:"max"`
}

func GetSalaryDataForLocationAndCurrency

func GetSalaryDataForLocationAndCurrency(conn *sql.DB, location, currency string) ([]SalaryDataPoint, error)

type SalaryTrendDataPoint

type SalaryTrendDataPoint struct {
	Date string `json:"date"`
	P10  int64  `json:"p10"`
	P25  int64  `json:"p25"`
	P50  int64  `json:"p50"`
	P75  int64  `json:"p75"`
	P90  int64  `json:"p90"`
}

func GetSalaryTrendsForLocationAndCurrency

func GetSalaryTrendsForLocationAndCurrency(conn *sql.DB, location, currency string) ([]SalaryTrendDataPoint, error)

type SitemapEntry

type SitemapEntry struct {
	Loc        string
	ChangeFreq string
	LastMod    time.Time
}

func GetSitemapIndex

func GetSitemapIndex(conn *sql.DB, siteHost string) ([]SitemapEntry, error)

func GetSitemapNo

func GetSitemapNo(conn *sql.DB, n int) ([]SitemapEntry, error)

Jump to

Keyboard shortcuts

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