Documentation ¶
Index ¶
- Constants
- Variables
- func Edit(args []string)
- func Patch(args []string)
- func Patch001(a *SQLAccessor) error
- 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) AddFriend(email, name string) 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) DoesFridayExist(date time.Time) (bool, 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)
- func (c *FaunaClient) ListFridays() ([]Friday, error)
- func (c *FaunaClient) ListFriends() ([]Friend, error)
- func (c *FaunaClient) RemoveFriday(date time.Time) error
- func (c *FaunaClient) RemoveFriend(email string) error
- type Friday
- type Friend
- 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 Group
- type IndexFridayData
- type Keycloak
- type MetricsRegistry
- type OAuth2Config
- 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) DoesFridayExist(date time.Time) (bool, 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)
- func (a *SQLAccessor) ListFridays() ([]Friday, error)
- func (a *SQLAccessor) ListFriends() ([]Friend, error)
- func (a *SQLAccessor) RemoveFriday(date time.Time) error
- func (a *SQLAccessor) RemoveFriend(email string) 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) HandleAdmin(w http.ResponseWriter, r *http.Request)
- func (s *Server) HandleAdminSubmit(w http.ResponseWriter, r *http.Request)
- func (s *Server) HandleIndex(w http.ResponseWriter, r *http.Request)
- func (s *Server) HandleLogin(w http.ResponseWriter, r *http.Request)
- func (s *Server) HandleLoginCallback(w http.ResponseWriter, r *http.Request)
- func (s *Server) HandleLogout(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 TokenClaims
- type User
- type WrappedData
- type WrappedPageData
Constants ¶
View Source
const ( DefaultGoogleCalendarTimeout = 5 * time.Second DefaultGoogleCalendarTimezone = "America/New_York" )
View Source
const ( GmailSMTPServer = "" GmailSMTPPort = 800 )
View Source
const ( DefaultFridayCacheTTL = 1 * time.Hour DefaultFriendNameCacheTTL = 24 * time.Hour DefaultNegativeFriendCacheTTL = 5 * time.Minute )
View Source
const (
UserCacheExpire = 1 * time.Minute
)
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 Patch001 ¶ added in v0.8.1
func Patch001(a *SQLAccessor) error
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) DoesFridayExist(date time.Time) (bool, error) AddFriday(date time.Time) error AddFriend(email, name string) error ListFriends() ([]Friend, error) ListFridays() ([]Friday, error) RemoveFriend(email string) error RemoveFriday(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"` OAuth2 OAuth2Config }
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) AddFriend ¶ added in v0.7.2
func (c *FaunaClient) AddFriend(email, name string) error
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) DoesFridayExist ¶ added in v0.8.1
func (c *FaunaClient) DoesFridayExist(date time.Time) (bool, 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)
func (*FaunaClient) ListFridays ¶ added in v0.7.3
func (c *FaunaClient) ListFridays() ([]Friday, error)
func (*FaunaClient) ListFriends ¶ added in v0.7.3
func (c *FaunaClient) ListFriends() ([]Friend, error)
func (*FaunaClient) RemoveFriday ¶ added in v0.7.3
func (c *FaunaClient) RemoveFriday(date time.Time) error
func (*FaunaClient) RemoveFriend ¶ added in v0.7.3
func (c *FaunaClient) RemoveFriend(email string) 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 Keycloak ¶ added in v0.8.1
type Keycloak struct {
// contains filtered or unexported fields
}
func NewKeycloak ¶ added in v0.8.1
func NewKeycloak(config OAuth2Config) (*Keycloak, error)
type MetricsRegistry ¶
type MetricsRegistry interface { NewCounterMetric(name string, labels map[string]string) CounterMetric NewGaugeMetric(name string, labels map[string]string) GaugeMetric }
type OAuth2Config ¶ added in v0.8.0
type PageData ¶
type PageData struct { FridayTimes []IndexFridayData Name string LoggedIn bool LogoutURL string }
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) DoesFridayExist ¶ added in v0.8.1
func (a *SQLAccessor) DoesFridayExist(date time.Time) (bool, 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)
func (*SQLAccessor) ListFridays ¶ added in v0.7.3
func (a *SQLAccessor) ListFridays() ([]Friday, error)
func (*SQLAccessor) ListFriends ¶ added in v0.7.3
func (a *SQLAccessor) ListFriends() ([]Friend, error)
func (*SQLAccessor) RemoveFriday ¶ added in v0.7.3
func (a *SQLAccessor) RemoveFriday(date time.Time) error
func (*SQLAccessor) RemoveFriend ¶ added in v0.7.3
func (a *SQLAccessor) RemoveFriend(email string) error
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) GetWrapped ¶
func (s *Server) GetWrapped(year int) (WrappedData, error)
func (*Server) HandleAdmin ¶ added in v0.8.1
func (s *Server) HandleAdmin(w http.ResponseWriter, r *http.Request)
func (*Server) HandleAdminSubmit ¶ added in v0.8.1
func (s *Server) HandleAdminSubmit(w http.ResponseWriter, r *http.Request)
func (*Server) HandleIndex ¶
func (s *Server) HandleIndex(w http.ResponseWriter, r *http.Request)
func (*Server) HandleLogin ¶ added in v0.8.0
func (s *Server) HandleLogin(w http.ResponseWriter, r *http.Request)
func (*Server) HandleLoginCallback ¶ added in v0.8.0
func (s *Server) HandleLoginCallback(w http.ResponseWriter, r *http.Request)
func (*Server) HandleLogout ¶ added in v0.8.0
func (s *Server) HandleLogout(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 TokenClaims ¶ added in v0.8.0
type TokenClaims struct { Exp int64 `json:"exp"` Iat int64 `json:"iat"` AuthTime int64 `json:"auth_time"` Jti string `json:"jti"` Iss string `json:"iss"` Aud string `json:"aud"` Sub string `json:"sub"` Typ string `json:"typ"` Azp string `json:"azp"` SessionState string `json:"session_state"` At_hash string `json:"at_hash"` Acr string `json:"acr"` Sid string `json:"sid"` EmailVerified bool `json:"email_verified"` Name string `json:"name"` PreferredUsername string `json:"preferred_username"` GivenName string `json:"given_name"` FamilyName string `json:"family_name"` Email string `json:"email"` Groups []string `json:"groups"` Roles []string `json:"roles"` }
func (*TokenClaims) HasRole ¶ added in v0.8.1
func (c *TokenClaims) HasRole(role string) bool
type WrappedData ¶
Click to show internal directories.
Click to hide internal directories.