Documentation ¶
Index ¶
- func BackgroundVoteGiver()
- func ConvertBool(value string) reflect.Value
- func GetCreateFactUrl() string
- func GetDeleteFactUrl(factId int64) string
- func GetHomeUrl() string
- func GetListFactUrl() string
- func GetRequestPasswordResetUrl() string
- func GetSignInUrl() string
- func GetSignOutUrl() string
- func GetSignUpUrl() string
- func GetViewFactUrl(factId int64) string
- func ReturnJSON(rw web.ResponseWriter, object interface{})
- func StartServer(serverAddress string, cookieStoreSalt string)
- func TruncateString(s string, charLimit int) string
- type AnyStorer
- type Context
- func (c *Context) AssignStorageMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)
- func (c *Context) AssignTemplatesAndSessionsMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)
- func (c *Context) BeginPasswordResetRequestHandler(rw web.ResponseWriter, req *web.Request)
- func (c *Context) CheckFailedRequestObject(rw web.ResponseWriter, req *web.Request) interface{}
- func (c *Context) CreateFactHandler(rw web.ResponseWriter, req *web.Request)
- func (c *Context) DeleteFactHandler(rw web.ResponseWriter, req *web.Request)
- func (c *Context) DoBeginPasswordResetRequestHandler(rw web.ResponseWriter, req *web.Request)
- func (c *Context) DoCreateFactHandler(rw web.ResponseWriter, req *web.Request)
- func (c *Context) DoDeleteFactHandler(rw web.ResponseWriter, req *web.Request)
- func (c *Context) DoPasswordResetRequestHandler(rw web.ResponseWriter, req *web.Request)
- func (c *Context) DoSignInRequestHandler(rw web.ResponseWriter, req *web.Request)
- func (c *Context) DoSignUpHandler(rw web.ResponseWriter, req *web.Request)
- func (c *Context) DoVerificationRequestHandler(rw web.ResponseWriter, req *web.Request)
- func (c *Context) GetErrorMessagesMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)
- func (c *Context) GetNotificationMessagesMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)
- func (c *Context) HomeHandler(rw web.ResponseWriter, req *web.Request)
- func (c *Context) ListFactsHandler(rw web.ResponseWriter, req *web.Request)
- func (c *Context) LoadUserMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)
- func (c *Context) PasswordResetRequestHandler(rw web.ResponseWriter, req *web.Request)
- func (c *Context) RequireAccountMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)
- func (c *Context) SetErrorMessage(rw web.ResponseWriter, req *web.Request, err string)
- func (c *Context) SetFailedRequestObject(rw web.ResponseWriter, req *web.Request, requestedObject interface{})
- func (c *Context) SetNotificationMessage(rw web.ResponseWriter, req *web.Request, notification string)
- func (c *Context) SignUpHandler(rw web.ResponseWriter, req *web.Request)
- func (c *Context) ViewFactHandler(rw web.ResponseWriter, req *web.Request)
- type CreateAccount
- type LoggedInContext
- type LoginRequestForm
- type PasswordResetRequestForm
- type ResetPasswordForm
- type URL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackgroundVoteGiver ¶
func BackgroundVoteGiver()
func ConvertBool ¶
func GetCreateFactUrl ¶
func GetCreateFactUrl() string
func GetDeleteFactUrl ¶
func GetHomeUrl ¶
func GetHomeUrl() string
func GetListFactUrl ¶
func GetListFactUrl() string
func GetRequestPasswordResetUrl ¶
func GetRequestPasswordResetUrl() string
func GetSignInUrl ¶
func GetSignInUrl() string
func GetSignOutUrl ¶
func GetSignOutUrl() string
func GetSignUpUrl ¶
func GetSignUpUrl() string
func GetViewFactUrl ¶
func ReturnJSON ¶
func ReturnJSON(rw web.ResponseWriter, object interface{})
func StartServer ¶
Types ¶
type AnyStorer ¶
type AnyStorer interface { account.AccountStorer fact.FactStorer }
type Context ¶
type Context struct { ErrorMessages []string NotificationMessages []string Data interface{} Store *sessions.CookieStore Account *account.Account Storage AnyStorer }
Used in all requests
func (*Context) AssignStorageMiddleware ¶
func (c *Context) AssignStorageMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)
func (*Context) AssignTemplatesAndSessionsMiddleware ¶
func (c *Context) AssignTemplatesAndSessionsMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)
func (*Context) BeginPasswordResetRequestHandler ¶
func (c *Context) BeginPasswordResetRequestHandler(rw web.ResponseWriter, req *web.Request)
func (*Context) CheckFailedRequestObject ¶
func (c *Context) CheckFailedRequestObject(rw web.ResponseWriter, req *web.Request) interface{}
This function returns just one "flash" failed request object for a session. Any other request objects that were stored will be removed without retrieval. It allows for users to amend bad forms without needing to retype all the data
func (*Context) CreateFactHandler ¶
func (c *Context) CreateFactHandler(rw web.ResponseWriter, req *web.Request)
func (*Context) DeleteFactHandler ¶
func (c *Context) DeleteFactHandler(rw web.ResponseWriter, req *web.Request)
func (*Context) DoBeginPasswordResetRequestHandler ¶
func (c *Context) DoBeginPasswordResetRequestHandler(rw web.ResponseWriter, req *web.Request)
func (*Context) DoCreateFactHandler ¶
func (c *Context) DoCreateFactHandler(rw web.ResponseWriter, req *web.Request)
func (*Context) DoDeleteFactHandler ¶
func (c *Context) DoDeleteFactHandler(rw web.ResponseWriter, req *web.Request)
func (*Context) DoPasswordResetRequestHandler ¶
func (c *Context) DoPasswordResetRequestHandler(rw web.ResponseWriter, req *web.Request)
func (*Context) DoSignInRequestHandler ¶
func (c *Context) DoSignInRequestHandler(rw web.ResponseWriter, req *web.Request)
func (*Context) DoSignUpHandler ¶
func (c *Context) DoSignUpHandler(rw web.ResponseWriter, req *web.Request)
func (*Context) DoVerificationRequestHandler ¶
func (c *Context) DoVerificationRequestHandler(rw web.ResponseWriter, req *web.Request)
func (*Context) GetErrorMessagesMiddleware ¶
func (c *Context) GetErrorMessagesMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)
This function returns any flash error messages that have been saved. Upon retrieving them, they will be deleted from the session (as they are "flash" session variables)
func (*Context) GetNotificationMessagesMiddleware ¶
func (c *Context) GetNotificationMessagesMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)
This function returns any flash notification messages that have been saved. Upon retrieving them, they will be deleted from the session (as they are "flash" session variables)
func (*Context) HomeHandler ¶
func (c *Context) HomeHandler(rw web.ResponseWriter, req *web.Request)
func (*Context) ListFactsHandler ¶
func (c *Context) ListFactsHandler(rw web.ResponseWriter, req *web.Request)
func (*Context) LoadUserMiddleware ¶
func (c *Context) LoadUserMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)
func (*Context) PasswordResetRequestHandler ¶
func (c *Context) PasswordResetRequestHandler(rw web.ResponseWriter, req *web.Request)
func (*Context) RequireAccountMiddleware ¶
func (c *Context) RequireAccountMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)
func (*Context) SetErrorMessage ¶
This function allows for a handler to set an error message as a "Flash" message which can be shown to the user in a later request (via a different handler) - it stores them in a session variable
func (*Context) SetFailedRequestObject ¶
func (c *Context) SetFailedRequestObject(rw web.ResponseWriter, req *web.Request, requestedObject interface{})
This function allows us to store a bad request from a form (eg not meeting the regex for the NHI parameter of system.Patient) so it can be recalled later for them to amend it
func (*Context) SetNotificationMessage ¶
func (c *Context) SetNotificationMessage(rw web.ResponseWriter, req *web.Request, notification string)
This function allows for a handler to set a notification message as a "Flash" message which can be shown to the user in a later request (via a different handler) - it stores them in a session variable
func (*Context) SignUpHandler ¶
func (c *Context) SignUpHandler(rw web.ResponseWriter, req *web.Request)
This handler is for the registration of an account
func (*Context) ViewFactHandler ¶
func (c *Context) ViewFactHandler(rw web.ResponseWriter, req *web.Request)
type CreateAccount ¶
type LoggedInContext ¶
type LoggedInContext struct {
*Context
}
func (*LoggedInContext) DoSignOutRequestHandler ¶
func (c *LoggedInContext) DoSignOutRequestHandler(rw web.ResponseWriter, req *web.Request)
This handler performs the logout request
func (*LoggedInContext) ModerateFactHandler ¶
func (c *LoggedInContext) ModerateFactHandler(rw web.ResponseWriter, req *web.Request)
func (*LoggedInContext) VoteOnFactHandler ¶
func (c *LoggedInContext) VoteOnFactHandler(rw web.ResponseWriter, req *web.Request)
type LoginRequestForm ¶
type PasswordResetRequestForm ¶
type PasswordResetRequestForm struct {
Email string
}
type ResetPasswordForm ¶
type URL ¶
type URL string
const ( HomeUrl URL = "/" ListFactUrl URL = "/fact" CreateFactUrl URL = "/fact/create" ViewFactUrl URL = "/fact/view/:factId" DeleteFactUrl URL = "/fact/delete/:factId" VoteOnFactUrl URL = "/api/vote" ModerateFactUrl URL = "/api/moderate" SignUpUrl URL = "/signup" SignInUrl URL = "/signin" SignOutUrl URL = "/signout" VerificationUrl URL = "/verify/:accountId/:verificationCode" RequestPasswordResetUrl URL = "/reset" ResetPasswordUrl URL = "/reset/:accountId/:resetVerificationCode" )