Documentation
¶
Index ¶
- Constants
- Variables
- func AddItemForUser(username string, itemId int) error
- func AddKeywordForUser(keyword Keyword, username string) error
- func CreateUser(username string, password string) error
- func DeleteCookie(next http.HandlerFunc) http.HandlerFunc
- func DeleteItemForUser(username string, itemId int) error
- func DeleteKeywordForUser(keywordID uint, username string) error
- func LoginMiddleware(loginFailedRedirect string, next http.HandlerFunc) http.HandlerFunc
- func SavedItemsForUser(username string) ([]feeds.Item, error)
- func SessionMiddleware(noSessionRedirect string, next http.HandlerFunc) http.HandlerFunc
- func VerifyUser(username string, password string) error
- type Configuration
- type ContextKey
- type CustomClaims
- type Keyword
- type KeywordList
- type KeywordMode
- type Session
- type User
Constants ¶
View Source
const ( SessionContextKey ContextKey = "session" ErrLoginFailed = "login failed" ErrMustUsePost = "must use POST" ErrInvalidToken = "token invalid" ErrInvalidAudience = "audience invalid" )
Variables ¶
View Source
var ( ErrNotImplemented = errors.New("not implemented") ErrNoDBConnection = errors.New("no database connection") ErrNotFound = errors.New("wrong username or password") Config = Configuration{} )
Functions ¶
func AddItemForUser ¶
func AddKeywordForUser ¶
func CreateUser ¶
func DeleteCookie ¶
func DeleteCookie(next http.HandlerFunc) http.HandlerFunc
func DeleteItemForUser ¶
func DeleteKeywordForUser ¶
func LoginMiddleware ¶
func LoginMiddleware(loginFailedRedirect string, next http.HandlerFunc) http.HandlerFunc
func SessionMiddleware ¶
func SessionMiddleware(noSessionRedirect string, next http.HandlerFunc) http.HandlerFunc
looks for a cookie that identifies the user; if not found, redirects to url provided as noSessionRedirect
Types ¶
type Configuration ¶
func (*Configuration) OpenDatabase ¶
func (c *Configuration) OpenDatabase(path string) error
type ContextKey ¶
type ContextKey string
type CustomClaims ¶
type CustomClaims struct {
jwt.RegisteredClaims
Admin bool `json:"adm"`
}
type KeywordList ¶
type KeywordList []Keyword
func KeywordsForUser ¶
func KeywordsForUser(name string) (KeywordList, error)
func (KeywordList) Match ¶
func (kl KeywordList) Match(search string) (KeywordMode, string)
Compares a the search string provided to the keyword list and returns a Mode (highlight/suppress/do nothing)
type KeywordMode ¶
type KeywordMode string
const ( HighlightMode KeywordMode = "KeywordHighlight" SuppressMode KeywordMode = "KeywordSuppress" DoNothingMode KeywordMode = "KeywordIgnore" )
Click to show internal directories.
Click to hide internal directories.