praytime

package module
v0.0.0-...-73aebdf Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(x int) uint

Abs returns absolute value of x

func HourMinutesToMinutes

func HourMinutesToMinutes(t string) (int, error)

HourMinutesToMinutes converts a normalized time string hh:mmp to minutes since midnight

func NormalizeTime

func NormalizeTime(t string, p Prayer) []string

NormalizeTime returns hh:mma or hh:mmp. Prayer is the context in which to interpret the times.

Types

type CrawlResult

type CrawlResult struct {
	Result PrayerEventSet `json:"result"`
	Error  string         `json:"error"`
	Source string         `json:"source"`
}

type Prayer

type Prayer int

Prayer is enum of 5 prayers

const (
	Fajr Prayer = iota
	Zuhr
	Asr
	Maghrib
	Isha
)

Prayer types

type PrayerEventSet

type PrayerEventSet struct {
	Name                 string         `json:"name" firestore:"name"`
	URL                  string         `json:"url,omitempty" firestore:"url,omitempty"`
	Address              string         `json:"address,omitempty" firestore:"address,omitempty"`
	Geo                  *latlng.LatLng `json:"geo" firestore:"geo"`
	Geohash              string         `json:"geohash" firestore:"geohash"`
	UUID4                string         `json:"uuid4" firestore:"uuid4"`
	CrawlTime            time.Time      `json:"crawlTime" firestore:"crawlTime"`
	TimeZoneID           string         `json:"timeZoneId" firestore:"timeZoneId"`
	PlaceID              string         `json:"placeId" firestore:"placeId"`
	FajrIqama            string         `json:"fajrIqama,omitempty" firestore:"fajrIqama,omitempty"`
	FajrIqamaModified    time.Time      `json:"fajrIqamaModified,omitempty" firestore:"fajrIqamaModified,omitempty"`
	ZuhrIqama            string         `json:"zuhrIqama,omitempty" firestore:"zuhrIqama,omitempty"`
	ZuhrIqamaModified    time.Time      `json:"zuhrIqamaModified,omitempty" firestore:"zuhrIqamaModified,omitempty"`
	AsrIqama             string         `json:"asrIqama,omitempty" firestore:"asrIqama,omitempty"`
	AsrIqamaModified     time.Time      `json:"asrIqamaModified,omitempty" firestore:"asrIqamaModified,omitempty"`
	MaghribIqama         string         `json:"maghribIqama,omitempty" firestore:"maghribIqama,omitempty"`
	MaghribIqamaModified time.Time      `json:"maghribIqamaModified,omitempty" firestore:"maghribIqamaModified,omitempty"`
	IshaIqama            string         `json:"ishaIqama,omitempty" firestore:"ishaIqama,omitempty"`
	IshaIqamaModified    time.Time      `json:"ishaIqamaModified,omitempty" firestore:"ishaIqamaModified,omitempty"`
	Juma1                string         `json:"juma1,omitempty" firestore:"juma1,omitempty"`
	Juma1Modified        time.Time      `json:"juma1Modified,omitempty" firestore:"juma1Modified,omitempty"`
	Juma2                string         `json:"juma2,omitempty" firestore:"juma2,omitempty"`
	Juma2Modified        time.Time      `json:"juma2Modified,omitempty" firestore:"juma2Modified,omitempty"`
	Juma3                string         `json:"juma3,omitempty" firestore:"juma3,omitempty"`
	Juma3Modified        time.Time      `json:"juma3Modified,omitempty" firestore:"juma3Modified,omitempty"`
}

PrayerEventSet - a daily set of prayer times in a single location

func (*PrayerEventSet) CompareToPrevious

func (p *PrayerEventSet) CompareToPrevious(prev *PrayerEventSet, force bool) (*PrayerEventSet, []string, error)

CompareToPrevious flags changed times and updates Modified timestamps

func (*PrayerEventSet) NormalizeTimes

func (p *PrayerEventSet) NormalizeTimes() *PrayerEventSet

NormalizeTimes normalizes prayer times into HH:MMm

type User

type User struct {
	ID        string          `json:"id" firestore:"id"`
	FCMTokens map[string]bool `json:"fcmTokens" firestore:"fcmTokens"`
}

User - Represents user table

Jump to

Keyboard shortcuts

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