Versions in this module Expand all Collapse all v0 v0.6.1 Oct 4, 2022 Changes in this version + const ContentTypeHTML + const UserEdoIDKey + const UserEnvironmentKey + const UserIDKey + const UserLocaleKey + const UserNameKey + var ErrCannotFindUser = constError("user not found") + var ErrCannotGetSession = constError("cannot get session from the store") + var ErrNoUserInContext = constError("no user in the context") + var ErrNoValueForThisKey = constError("session holds no value for this key") + var ErrNotUnique = constError("user with this ID already exists") + var ErrRequiredField = constError("this field is required") + var ErrWrongPassword = constError("wrong password") + func ContextWithParams(ctx context.Context, vars url.Values) context.Context + func ContextWithUser(ctx context.Context, user User) context.Context + func GetParam(ctx context.Context, param string) string + func NewMuxRouter() *mux.Router + func TypeFromString(raw string, t interface{}) error + func TypeToString(t interface{}) (string, error) + type App struct + EnvironmentName string + Locale Locale + Logger log.FieldLogger + Router *mux.Router + Session *Session + Static fs.FS + StaticPrefix string + UserRepository UserRepository + ViewFiles fs.FS + ViewHelpers []ViewHelperFunc + func (app App) Authenticate(destination string) MiddlewareFunc + func (app App) Cors() MiddlewareFunc + func (app App) Logging(logger *log.Entry) MiddlewareFunc + func (app App) NewTemplatingEngine() TemplatingEngine + func (app App) Recoverer(destination string) MiddlewareFunc + func (app App) RedirectIfAuthenticated(destination string) MiddlewareFunc + func (app App) ServeFiles(notFound http.Handler) http.Handler + func (app App) StoreParamsToContext() MiddlewareFunc + func (app App) StoreUserToContext() MiddlewareFunc + type FlashMessage struct + AutoClose bool + Kind string + Message string + func NewFlash(message string) FlashMessage + type InMemoryUser struct + Email string + ID string + Name string + Password string + func (u InMemoryUser) GetID() string + type InMemoryUserRepository struct + Users []InMemoryUser + func (u *InMemoryUserRepository) AddUser(user InMemoryUser) error + func (u InMemoryUserRepository) Authenticate(w http.ResponseWriter, r *http.Request) (User, error) + func (u InMemoryUserRepository) GetUserByID(id string) (User, error) + type Locale interface + T func(language string, s string, p ...interface{}) string + TP func(language string, s string, n int, p ...interface{}) string + func NewLocale(set map[string]map[string]string) Locale + type MiddlewareFunc = mux.MiddlewareFunc + type Session struct + func NewSession(store sessions.Store, name string) *Session + func (s Session) Delete(w http.ResponseWriter, r *http.Request, key string) error + func (s Session) Destroy(w http.ResponseWriter, r *http.Request) error + func (s Session) Flash(w http.ResponseWriter, r *http.Request, flashMessage FlashMessage) error + func (s Session) Flashes(w http.ResponseWriter, r *http.Request) []FlashMessage + func (s Session) Get(r *http.Request, key string) (string, error) + func (s Session) GetEdoID(r *http.Request) (string, error) + func (s Session) GetEnvironment(r *http.Request) string + func (s Session) GetLocale(r *http.Request) string + func (s Session) GetName(r *http.Request) string + func (s Session) GetUserID(r *http.Request) (string, error) + func (s Session) IsGuest(r *http.Request) bool + func (s Session) Put(w http.ResponseWriter, r *http.Request, key string, value string) error + func (s Session) SetEdoID(w http.ResponseWriter, r *http.Request, id string) error + func (s Session) SetEnvironment(w http.ResponseWriter, r *http.Request, id string) error + func (s Session) SetLocale(w http.ResponseWriter, r *http.Request, id string) error + func (s Session) SetName(w http.ResponseWriter, r *http.Request, id string) error + func (s Session) SetUserID(w http.ResponseWriter, r *http.Request, id string) error + type TemplatingEngine interface + GetErrors func() map[string]string + Render func(w http.ResponseWriter, r *http.Request, patterns ...string) + Set func(key string, data interface{}) TemplatingEngine + SetError func(errorKey, description string) TemplatingEngine + type User interface + GetID func() string + func GetUserFromContext(ctx context.Context) (User, error) + type UserRepository interface + Authenticate func(w http.ResponseWriter, r *http.Request) (User, error) + GetUserByID func(id string) (User, error) + func NewInMemoryUserRepository(users []InMemoryUser) UserRepository + type ViewHelperFunc func(w http.ResponseWriter, r *http.Request) (string, interface{})