Documentation ¶
Index ¶
- Constants
- func Delete(c *redis.Client, key string)
- func FromInternalToMasjidAsrMethodEnum(a AsrJuristicMethod) pb.PrayerTimesConfiguration_AsrJuristicMethod
- func FromInternalToMasjidCalculationMethodEnum(c CalculationMethod) pb.PrayerTimesConfiguration_CalculationMethod
- func FromInternalToMasjidHighLatitudeEnum(h HighLatitudeRule) pb.PrayerTimesConfiguration_HighLatitudeRule
- func FromInternalToProtoEvent(s string) pb.Event_EventType
- func FromInternalToProtoGenderRestriction(g GenderRestriction) pb.Event_GenderRestriction
- func FromProtoToInternalEventType(et pb.Event_EventType) string
- func GenerateRandomNumber() string
- func Get(c *redis.Client, key string, dest interface{}) error
- func Set(c *redis.Client, key string, value interface{}, expiration time.Duration) error
- type Address
- type AdhanFile
- type AsrJuristicMethod
- type CalculationMethod
- type Event
- type GenderRestriction
- type HighLatitudeRule
- type Masjid
- type PhoneNumber
- type PrayerAdjustments
- type PrayerTimesConfiguration
- type StorageManager
- func (s *StorageManager) CreateAdhanFile(a *pb.AdhanFile) (*AdhanFile, error)
- func (s *StorageManager) CreateEvent(e *pb.Event) (*Event, error)
- func (s *StorageManager) CreateMasjid(mp *pb.Masjid) (*Masjid, error)
- func (s *StorageManager) CreateUser(up *pb.User, pwd string) (*User, error)
- func (s *StorageManager) DeleteAdhanFile(id string) error
- func (s *StorageManager) DeleteEvent(id string) error
- func (s *StorageManager) DeleteMasjid(id string) error
- func (s *StorageManager) DeleteUserWithEmail(email string, pwd string) error
- func (s *StorageManager) DeleteUserWithUsername(username string, pwd string) error
- func (s *StorageManager) GetAdhanFile(masjid_id string) (*AdhanFile, error)
- func (s *StorageManager) GetEvent(id string) (*Event, error)
- func (s *StorageManager) GetMasjid(id string) (*Masjid, error)
- func (s *StorageManager) GetUserWithEmail(email string, pwd string) (*User, error)
- func (s *StorageManager) GetUserWithUsername(username string, pwd string) (*User, error)
- func (s *StorageManager) LoginUser(email string, pwd string) (*pb.Tokens, error)
- func (s *StorageManager) SetCode(email string) (string, error)
- func (s *StorageManager) UpdateAdhanFile(a *pb.AdhanFile) (*AdhanFile, error)
- func (s *StorageManager) UpdateEvent(e *pb.Event) (*Event, error)
- func (s *StorageManager) UpdateMasjid(mp *pb.Masjid) (*Masjid, error)
- func (s *StorageManager) UpdateUser(up *pb.User, pwd string) (*User, error)
- func (s *StorageManager) VerifyUser(email string, code int64) (*pb.VerifyResponse, error)
- type User
Constants ¶
const ( MALE gender = "MALE" FEMALE gender = "FEMALE" )
Variables ¶
This section is empty.
Functions ¶
func FromInternalToMasjidAsrMethodEnum ¶
func FromInternalToMasjidAsrMethodEnum(a AsrJuristicMethod) pb.PrayerTimesConfiguration_AsrJuristicMethod
func FromInternalToMasjidCalculationMethodEnum ¶
func FromInternalToMasjidCalculationMethodEnum(c CalculationMethod) pb.PrayerTimesConfiguration_CalculationMethod
func FromInternalToMasjidHighLatitudeEnum ¶
func FromInternalToMasjidHighLatitudeEnum(h HighLatitudeRule) pb.PrayerTimesConfiguration_HighLatitudeRule
func FromInternalToProtoEvent ¶
func FromInternalToProtoEvent(s string) pb.Event_EventType
func FromInternalToProtoGenderRestriction ¶
func FromInternalToProtoGenderRestriction(g GenderRestriction) pb.Event_GenderRestriction
func FromProtoToInternalEventType ¶
func FromProtoToInternalEventType(et pb.Event_EventType) string
func GenerateRandomNumber ¶
func GenerateRandomNumber() string
Types ¶
type AdhanFile ¶
type AdhanFile struct { ID uuid.UUID `gorm:"primaryKey;type:char(36)"` MasjidId string `gorm:"type:varchar(320)"` File []byte CreatedAt time.Time UpdatedAt time.Time }
func NewAdhanFile ¶
NewAdhanFile creates a new AdhanFile struct given the AdhanFile proto.
type AsrJuristicMethod ¶
type AsrJuristicMethod int64
The Juristic method to use for calculating Asr prayer times.
const ( // Use the Shafi/Hanbali/Maliki method to calculate Asr timings. SHAFI_HANBALI_MALIKI AsrJuristicMethod = iota // Use the Hanafi method to calculate Asr timings. HANAFI )
func FromMasjidToInternalAsrMethodEnum ¶
func FromMasjidToInternalAsrMethodEnum(a pb.PrayerTimesConfiguration_AsrJuristicMethod) AsrJuristicMethod
type CalculationMethod ¶
type CalculationMethod int64
Defines the calculation method to use. If this field is set (excluding OTHER), then the Fajr and Isha angle fields are automatically set.
const ( OTHER CalculationMethod = iota // Muslim World League // Uses Fajr angle of 18 and an Isha angle of 17 MUSLIM_WORLD_LEAGUE // Egyptian General Authority of Survey // Uses Fajr angle of 19.5 and an Isha angle of 17.5 EGYPTIAN // University of Islamic Sciences, Karachi // Uses Fajr angle of 18 and an Isha angle of 18 KARACHI // Umm al-Qura University, Makkah // Uses a Fajr angle of 18.5 and an Isha angle of 90. Note: You should add a +30 minute custom // adjustment of Isha during Ramadan. UMM_AL_QURA // The Gulf Region // Uses Fajr and Isha angles of 18.2 degrees. DUBAI // Moonsighting Committee // Uses a Fajr angle of 18 and an Isha angle of 18. Also uses seasonal adjustment values. MOON_SIGHTING_COMMITTEE // Referred to as the ISNA method // This method is included for completeness, but is not recommended. // Uses a Fajr angle of 15 and an Isha angle of 15. NORTH_AMERICA // Kuwait // Uses a Fajr angle of 18 and an Isha angle of 17.5 KUWAIT // Qatar // Modified version of Umm al-Qura that uses a Fajr angle of 18. QATAR // Singapore // Uses a Fajr angle of 20 and an Isha angle of 18 SINGAPORE // UOIF // Uses a Fajr angle of 12 and an Isha angle of 12 UOIF )
func FromMasjidToInternalCalculationMethodEnum ¶
func FromMasjidToInternalCalculationMethodEnum(c pb.PrayerTimesConfiguration_CalculationMethod) CalculationMethod
type Event ¶
type Event struct { ID uuid.UUID `gorm:"primaryKey;type:char(36)"` UserId string MasjidId string Name string Description string StartTime time.Time EndTime time.Time GenderRestriction GenderRestriction `` /* 138-byte string literal not displayed */ EventTypes string IsPaid bool RequiresRsvp bool MaxParticipants int32 LivestreamLink string CreatedAt time.Time UpdatedAt time.Time }
type GenderRestriction ¶
type GenderRestriction int64
const ( NO_RESTRICTION GenderRestriction = iota MALE_ONLY FEMALE_ONLY )
func FromProtoToInternalGenderRestriction ¶
func FromProtoToInternalGenderRestriction(g pb.Event_GenderRestriction) GenderRestriction
type HighLatitudeRule ¶
type HighLatitudeRule int64
The high latitude rule for calculating Fajr and Isha prayers.
const ( NO_HIGH_LATITUDE_RULE HighLatitudeRule = iota // Fajr will never be earlier than the middle of the night, and Isha will never be later than // the middle of the night. MIDDLE_OF_THE_NIGHT // Fajr will never be earlier than the beginning of the last seventh of the night, and Isha will // never be later than the end of the first seventh of the night. SEVENTH_OF_THE_NIGHT // Similar to SEVENTH_OF_THE_NIGHT, but instead of 1/7th, the fraction of the night used // is fajrAngle / 60 and ishaAngle/60. TWILIGHT_ANGLE )
func FromMasjidToInternalHighLatitudeEnum ¶
func FromMasjidToInternalHighLatitudeEnum(h pb.PrayerTimesConfiguration_HighLatitudeRule) HighLatitudeRule
type Masjid ¶
type Masjid struct { ID uuid.UUID `gorm:"primaryKey;type:char(36)"` Name string `gorm:"type:varchar(320)"` IsVerified bool `gorm:"default:false"` Address Address `gorm:"embedded"` PhoneNumber PhoneNumber `gorm:"embedded"` PrayerConfig PrayerTimesConfiguration `gorm:"embedded"` CreatedAt time.Time UpdatedAt time.Time }
type PhoneNumber ¶
type PrayerAdjustments ¶
type PrayerAdjustments struct { // Adjustment offset for Fajr in minutes. Value can be negative. FajrAdjustment int32 `gorm:"default:0"` // Adjustment offset for Dhuhr in minutes. Value can be negative. DhuhrAdjustment int32 `gorm:"default:0"` // Adjustment offset for Asr in minutes. Value can be negative. AsrAdjustment int32 `gorm:"default:0"` // Adjustment offset for Maghrib in minutes. Value can be negative. MaghribAdjustment int32 `gorm:"default:0"` // Adjustment offset for Isha in minutes. Value can be negative. IshaAdjustment int32 `gorm:"default:0"` }
The manual adjustments to apply to the prayer timings. The value that each field is set to is the offset which will be added to the calculated time to obtain the final prayer time.
type PrayerTimesConfiguration ¶
type PrayerTimesConfiguration struct { // The calculation method to use. CalculationMethod CalculationMethod `` /* 391-byte string literal not displayed */ // The Fajr angle to use. This does not need to be set if the calculation method is set. // If both fields are set, then the calculation method field takes precedence. FajrAngle float64 `gorm:"default:0"` // The Isha angle to use. This does not need to be set if the calculation method is set. // If both fields are set, then the calculation method field takes precedence. IshaAngle float64 `gorm:"default:0"` // Minutes after Maghrib (if set, the time for Isha will be Maghrib plus the Isha interval). IshaInterval int32 `gorm:"default:0"` // The juristic method to use for calculating Asr timings. AsrMethod AsrJuristicMethod `sql:"type:ENUM('SHAFI_HANBALI_MALIKI', 'HANAFI')" gorm:"column:asr_method"` // The high latitude rule to use to calculate Fajr and Isha prayers. HighLatitudeRule HighLatitudeRule `` /* 203-byte string literal not displayed */ // The prayer adjusments (aka offsets) to apply to the calculated prayer times. Adjustments PrayerAdjustments `gorm:"embedded"` }
A message that holds prayer times configuration. This message contains all the fields necessary to calculate prayer times.
type StorageManager ¶
func (*StorageManager) CreateAdhanFile ¶
func (s *StorageManager) CreateAdhanFile(a *pb.AdhanFile) (*AdhanFile, error)
CreateAdhanFile creates a AdhanFile in the database for the given AdhanFile proto.
func (*StorageManager) CreateEvent ¶
func (s *StorageManager) CreateEvent(e *pb.Event) (*Event, error)
CreateEvent creates a Event in the database for the given Event proto.
func (*StorageManager) CreateMasjid ¶
func (s *StorageManager) CreateMasjid(mp *pb.Masjid) (*Masjid, error)
CreateMasjid creates a Masjid in the database for the given Masjid proto.
func (*StorageManager) CreateUser ¶
CreateUser creates a User in the database for the given User and password
func (*StorageManager) DeleteAdhanFile ¶
func (s *StorageManager) DeleteAdhanFile(id string) error
DeleteAdhanFile deletes a AdhanFile with the given id.
func (*StorageManager) DeleteEvent ¶
func (s *StorageManager) DeleteEvent(id string) error
DeleteEvent deletes a Event with the given id.
func (*StorageManager) DeleteMasjid ¶
func (s *StorageManager) DeleteMasjid(id string) error
DeleteMasjid deletes a Masjid with the given id.
func (*StorageManager) DeleteUserWithEmail ¶
func (s *StorageManager) DeleteUserWithEmail(email string, pwd string) error
DeleteUserWithEmail deletes a User with the given email and password if it exists
func (*StorageManager) DeleteUserWithUsername ¶
func (s *StorageManager) DeleteUserWithUsername(username string, pwd string) error
DeleteUserWithUsername deletes a User with the given username and password if it exists
func (*StorageManager) GetAdhanFile ¶
func (s *StorageManager) GetAdhanFile(masjid_id string) (*AdhanFile, error)
GetAdhanFile returns a AdhanFile with the given id.
func (*StorageManager) GetEvent ¶
func (s *StorageManager) GetEvent(id string) (*Event, error)
GetEvent returns a Event with the given id.
func (*StorageManager) GetMasjid ¶
func (s *StorageManager) GetMasjid(id string) (*Masjid, error)
GetMasjid returns a Masjid with the given id.
func (*StorageManager) GetUserWithEmail ¶
func (s *StorageManager) GetUserWithEmail(email string, pwd string) (*User, error)
GetUserWithEmail returns a User with the given email and password if it exists
func (*StorageManager) GetUserWithUsername ¶
func (s *StorageManager) GetUserWithUsername(username string, pwd string) (*User, error)
GetUserWithUsername returns a User with the given username and password if it exists
func (*StorageManager) LoginUser ¶
GetUserWithEmail returns a User with the given email and password if it exists
func (*StorageManager) UpdateAdhanFile ¶
func (s *StorageManager) UpdateAdhanFile(a *pb.AdhanFile) (*AdhanFile, error)
UpdateAdhanFile updates a AdhanFile in the database for the given AdhanFile proto.
func (*StorageManager) UpdateEvent ¶
func (s *StorageManager) UpdateEvent(e *pb.Event) (*Event, error)
UpdateEvent updates a Event in the database for the given Event proto.
func (*StorageManager) UpdateMasjid ¶
func (s *StorageManager) UpdateMasjid(mp *pb.Masjid) (*Masjid, error)
UpdateMasjid updates a Masjid in the database for the given Masjid proto.
func (*StorageManager) UpdateUser ¶
UpdateUser updates a User in the database for the given User and password if it exists
func (*StorageManager) VerifyUser ¶
func (s *StorageManager) VerifyUser(email string, code int64) (*pb.VerifyResponse, error)
type User ¶
type User struct { ID uuid.UUID `gorm:"primaryKey;type:char(36)"` Email string `gorm:"type:varchar(320)"` Username string `gorm:"type:varchar(255)"` HashedPassword string `gorm:"type:varchar(60)"` IsVerified bool `gorm:"default:false"` FirstName string `gorm:"type:varchar(255)"` LastName string `gorm:"type:varchar(255)"` PhoneNumber string `gorm:"type:varchar(255)"` Gender gender `gorm:"type:varchar(6);check:gender IN ('MALE', 'FEMALE')"` CreatedAt time.Time UpdatedAt time.Time }
User represents a registered user with email/password authentication TODO: make username and email unique. It currently causes postgres to throw a unique constraint violation.