Documentation
¶
Index ¶
- Constants
- Variables
- func Edit(args []string)
- func Patch(args []string)
- func Run(args []string)
- func SendConfirmationEmail(email, code string) error
- type Accessor
- type Cache
- type CacheValue
- type Calendar
- func (c *Calendar) ActivateEvent(eventID string) error
- func (c *Calendar) CancelEvent(eventID string) error
- func (c *Calendar) CreateEvent(newEvent CalendarEvent) error
- func (c *Calendar) GetEvent(eventID string) (CalendarEvent, error)
- func (c *Calendar) InviteToEvent(eventID, email, name string) error
- func (c *Calendar) ListEvents(numEvents int) ([]CalendarEvent, error)
- func (c *Calendar) ListEventsBetween(start, end time.Time, numEvents int) ([]CalendarEvent, error)
- type CalendarConfig
- type CalendarEvent
- type CalendarSource
- type Config
- type CounterMetric
- type FaunaClient
- func (c *FaunaClient) AddFriday(date time.Time) error
- func (c *FaunaClient) ConfirmRSVP(friendEmail, code string) error
- func (c *FaunaClient) CreateRSVP(friendEmail, code string, pendingDates []time.Time) error
- func (c *FaunaClient) CreateTables() error
- func (c *FaunaClient) GetAllFridays() ([]time.Time, error)
- func (c *FaunaClient) GetFriendName(friendEmail string) (string, error)
- func (c *FaunaClient) GetUpcomingFridays(daysAhead int) ([]time.Time, error)
- func (c *FaunaClient) GetUpcomingFridaysAfter(after time.Time, daysAhead int) ([]time.Time, error)
- func (c *FaunaClient) IsFriendAllowed(friendEmail string) (bool, error)
- type GaugeMetric
- type GoogleCalendar
- func (c *GoogleCalendar) ActivateEvent(eventID string) error
- func (c *GoogleCalendar) CancelEvent(eventID string) error
- func (c *GoogleCalendar) CreateEvent(newEvent CalendarEvent) error
- func (c *GoogleCalendar) GetEvent(eventID string) (CalendarEvent, error)
- func (c *GoogleCalendar) InviteToEvent(eventID, email, name string) error
- func (c *GoogleCalendar) ListEvents(numEvents int) ([]CalendarEvent, error)
- func (c *GoogleCalendar) ListEventsBetween(start, end time.Time, numEvents int) ([]CalendarEvent, error)
- type IndexFridayData
- type MetricsRegistry
- type PageData
- type PrometheusCounterMetric
- type PrometheusGaugeMetric
- type PrometheusRegistry
- type SQLAccessor
- func (a *SQLAccessor) AddFriday(date time.Time) error
- func (a *SQLAccessor) AddFriend(email, name string) error
- func (a *SQLAccessor) Close()
- func (a *SQLAccessor) CreateTables() error
- func (a *SQLAccessor) GetFriendName(email string) (string, error)
- func (a *SQLAccessor) GetUpcomingFridays(daysAhead int) ([]time.Time, error)
- func (a *SQLAccessor) GetUpcomingFridaysAfter(after time.Time, daysAhead int) ([]time.Time, error)
- func (a *SQLAccessor) IsFriendAllowed(email string) (bool, error)
- type Server
- func (s *Server) GetWrapped(year int) (WrappedData, error)
- func (s *Server) Handle4xx(w http.ResponseWriter, r *http.Request)
- func (s *Server) Handle500(w http.ResponseWriter, r *http.Request)
- func (s *Server) HandleIndex(w http.ResponseWriter, r *http.Request)
- func (s *Server) HandleSubmit(w http.ResponseWriter, r *http.Request)
- func (s *Server) HandledWrapped(w http.ResponseWriter, r *http.Request)
- func (s *Server) Start() error
- func (s *Server) Stop()
- func (s *Server) WatchCalendar(period time.Duration)
- type Store
- type WrappedData
- type WrappedPageData
Constants ¶
View Source
const ( DefaultGoogleCalendarTimeout = 5 * time.Second DefaultGoogleCalendarTimezone = "America/New_York" )
View Source
const ( GmailSMTPServer = "" GmailSMTPPort = 800 )
Variables ¶
View Source
var (
ErrEventNotFound = errors.New("event not found")
)
View Source
var EventDuration = time.Hour * 4
View Source
var GMAIL_API_KEY string
View Source
var Log *zap.Logger
Functions ¶
func SendConfirmationEmail ¶
Types ¶
type Accessor ¶
type Accessor interface { CreateTables() error IsFriendAllowed(email string) (bool, error) GetFriendName(email string) (string, error) GetUpcomingFridays(daysAhead int) ([]time.Time, error) GetUpcomingFridaysAfter(after time.Time, daysAhead int) ([]time.Time, error) AddFriday(date time.Time) error }
type Cache ¶
type Cache[T any] struct { // contains filtered or unexported fields }
type CacheValue ¶
type CacheValue[V any] struct { // contains filtered or unexported fields }
type Calendar ¶
type Calendar struct {
// contains filtered or unexported fields
}
func NewCalendar ¶
func NewCalendar(source CalendarSource) *Calendar
func (*Calendar) ActivateEvent ¶
func (*Calendar) CancelEvent ¶
func (*Calendar) CreateEvent ¶
func (c *Calendar) CreateEvent(newEvent CalendarEvent) error
func (*Calendar) InviteToEvent ¶
func (*Calendar) ListEvents ¶
func (c *Calendar) ListEvents(numEvents int) ([]CalendarEvent, error)
func (*Calendar) ListEventsBetween ¶
type CalendarConfig ¶
type CalendarEvent ¶
type CalendarSource ¶
type CalendarSource interface { CreateEvent(CalendarEvent) error GetEvent(eventID string) (CalendarEvent, error) InviteToEvent(eventID, email, name string) error ListEvents(numEvents int) ([]CalendarEvent, error) ListEventsBetween(start, end time.Time, numEvents int) ([]CalendarEvent, error) CancelEvent(eventID string) error ActivateEvent(eventID string) error }
type Config ¶
type Config struct { Port int `yaml:"port"` StaticDir string `yaml:"staticDir"` ReadTimeout time.Duration `yaml:"readTimeout"` WriteTimeout time.Duration `yaml:"writeTimeout"` ShutdownTimeout time.Duration `yaml:"shutdownTimeout"` Calendar CalendarConfig `yaml:"calendar"` MetricsPort int `yaml:"metricsPort"` FaunaSecret string `yaml:"faunaSecret"` UseSQLite bool `yaml:"useSQLite"` DBFile string `yaml:"dbFile"` }
func LoadConfig ¶
func LoadConfigEnv ¶
func LoadConfigEnv() Config
type CounterMetric ¶
type CounterMetric interface {
Increment()
}
type FaunaClient ¶
type FaunaClient struct {
// contains filtered or unexported fields
}
func NewFaunaClient ¶
func NewFaunaClient(secret string) *FaunaClient
func (*FaunaClient) ConfirmRSVP ¶
func (c *FaunaClient) ConfirmRSVP(friendEmail, code string) error
func (*FaunaClient) CreateRSVP ¶
func (c *FaunaClient) CreateRSVP(friendEmail, code string, pendingDates []time.Time) error
func (*FaunaClient) CreateTables ¶
func (c *FaunaClient) CreateTables() error
func (*FaunaClient) GetAllFridays ¶
func (c *FaunaClient) GetAllFridays() ([]time.Time, error)
func (*FaunaClient) GetFriendName ¶
func (c *FaunaClient) GetFriendName(friendEmail string) (string, error)
func (*FaunaClient) GetUpcomingFridays ¶
func (c *FaunaClient) GetUpcomingFridays(daysAhead int) ([]time.Time, error)
func (*FaunaClient) GetUpcomingFridaysAfter ¶
func (*FaunaClient) IsFriendAllowed ¶
func (c *FaunaClient) IsFriendAllowed(friendEmail string) (bool, error)
type GaugeMetric ¶
type GaugeMetric interface {
Set(float64)
}
type GoogleCalendar ¶
type GoogleCalendar struct { Timezone string Timeout time.Duration // contains filtered or unexported fields }
func NewGoogleCalendar ¶
func NewGoogleCalendar(credentialFile, tokenFile, id string, ctx context.Context) (*GoogleCalendar, error)
func (*GoogleCalendar) ActivateEvent ¶
func (c *GoogleCalendar) ActivateEvent(eventID string) error
func (*GoogleCalendar) CancelEvent ¶
func (c *GoogleCalendar) CancelEvent(eventID string) error
func (*GoogleCalendar) CreateEvent ¶
func (c *GoogleCalendar) CreateEvent(newEvent CalendarEvent) error
func (*GoogleCalendar) GetEvent ¶
func (c *GoogleCalendar) GetEvent(eventID string) (CalendarEvent, error)
func (*GoogleCalendar) InviteToEvent ¶
func (c *GoogleCalendar) InviteToEvent(eventID, email, name string) error
func (*GoogleCalendar) ListEvents ¶
func (c *GoogleCalendar) ListEvents(numEvents int) ([]CalendarEvent, error)
func (*GoogleCalendar) ListEventsBetween ¶
func (c *GoogleCalendar) ListEventsBetween(start, end time.Time, numEvents int) ([]CalendarEvent, error)
type IndexFridayData ¶
type MetricsRegistry ¶
type MetricsRegistry interface { NewCounterMetric(name string, labels map[string]string) CounterMetric NewGaugeMetric(name string, labels map[string]string) GaugeMetric }
type PageData ¶
type PageData struct {
FridayTimes []IndexFridayData
}
type PrometheusCounterMetric ¶
type PrometheusCounterMetric struct {
// contains filtered or unexported fields
}
func (*PrometheusCounterMetric) Increment ¶
func (m *PrometheusCounterMetric) Increment()
type PrometheusGaugeMetric ¶
type PrometheusGaugeMetric struct {
// contains filtered or unexported fields
}
func (*PrometheusGaugeMetric) Set ¶
func (m *PrometheusGaugeMetric) Set(value float64)
type PrometheusRegistry ¶
type PrometheusRegistry struct {
// contains filtered or unexported fields
}
func NewPrometheusRegistry ¶
func NewPrometheusRegistry() *PrometheusRegistry
func (*PrometheusRegistry) NewCounterMetric ¶
func (reg *PrometheusRegistry) NewCounterMetric(name string, labels map[string]string) CounterMetric
func (*PrometheusRegistry) NewGaugeMetric ¶
func (reg *PrometheusRegistry) NewGaugeMetric(name string, labels map[string]string) GaugeMetric
func (*PrometheusRegistry) Serve ¶
func (reg *PrometheusRegistry) Serve(port int)
type SQLAccessor ¶
type SQLAccessor struct {
// contains filtered or unexported fields
}
func NewSQLAccessor ¶
func NewSQLAccessor(dbfile string) (*SQLAccessor, error)
func (*SQLAccessor) AddFriend ¶
func (a *SQLAccessor) AddFriend(email, name string) error
func (*SQLAccessor) Close ¶
func (a *SQLAccessor) Close()
func (*SQLAccessor) CreateTables ¶
func (a *SQLAccessor) CreateTables() error
func (*SQLAccessor) GetFriendName ¶
func (a *SQLAccessor) GetFriendName(email string) (string, error)
func (*SQLAccessor) GetUpcomingFridays ¶
func (a *SQLAccessor) GetUpcomingFridays(daysAhead int) ([]time.Time, error)
func (*SQLAccessor) GetUpcomingFridaysAfter ¶
func (*SQLAccessor) IsFriendAllowed ¶
func (a *SQLAccessor) IsFriendAllowed(email string) (bool, error)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) GetWrapped ¶
func (s *Server) GetWrapped(year int) (WrappedData, error)
func (*Server) HandleIndex ¶
func (s *Server) HandleIndex(w http.ResponseWriter, r *http.Request)
func (*Server) HandleSubmit ¶
func (s *Server) HandleSubmit(w http.ResponseWriter, r *http.Request)
func (*Server) HandledWrapped ¶
func (s *Server) HandledWrapped(w http.ResponseWriter, r *http.Request)
func (*Server) WatchCalendar ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) GetUpcomingFridays ¶
func (*Store) SetCacheTTL ¶
type WrappedData ¶
Click to show internal directories.
Click to hide internal directories.