Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/benhoyt/simplelists
/ functions
Functions
61 in github.com/benhoyt/simplelists
⨍
Functions
61
◇
Types & classes
9
↓ 44 callers
Function
ensureString
ensureString asserts that got==want for strings.
server_test.go:263
↓ 15 callers
Function
serve
serve records a single HTTP request and returns the response recorder.
server_test.go:288
↓ 12 callers
Method
internalError
(w http.ResponseWriter, msg string, err error)
server.go:329
↓ 9 callers
Function
ensureInt
ensureString asserts that got==want for ints.
server_test.go:271
↓ 8 callers
Function
exitOnError
(err error)
main.go:104
↓ 7 callers
Function
csrf
csrf wraps the given handler, ensuring that the HTTP method is POST and that the CSRF token in the "csrf-token" cookie matches the token in the "csrf-
server.go:353
↓ 7 callers
Method
signedIn
(h http.HandlerFunc)
server.go:100
↓ 6 callers
Function
getAttr
getAttr returns the value of the named attribute, or "" if not found.
server_test.go:399
↓ 6 callers
Function
parseForms
parseForms parses the forms in an HTML document and returns the list of forms.
server_test.go:317
↓ 5 callers
Method
Printf
(format string, v ...interface{})
server.go:48
↓ 5 callers
Function
ensureRedirect
ensureRedirect asserts that the HTTP status code and the Location header are correct.
server_test.go:255
↓ 4 callers
Function
ensureCode
ensureCode asserts that the HTTP status code is correct.
server_test.go:246
↓ 2 callers
Method
GetList
(id string)
server.go:35
↓ 2 callers
Function
NewSQLModel
NewSQLModel returns a new SQLite database model, creating tables if they don't already exist.
db.go:34
↓ 2 callers
Function
NewServer
NewServer creates a new server with the specified dependencies.
server.go:52
↓ 2 callers
Function
ensureRegex
ensureRegex asserts that got (in its entirety) matches the given regex pattern.
server_test.go:279
↓ 2 callers
Function
getCSRFToken
getCSRFToken returns the current session's CSRF token, generating a new one and settings the "csrf-token" cookie if not present.
server.go:372
↓ 2 callers
Function
getSignInCookie
(r *http.Request)
server.go:119
↓ 2 callers
Function
getText
getText recursively assembles the text nodes of n into a string.
server_test.go:409
↓ 2 callers
Method
isSignedIn
(r *http.Request)
server.go:111
↓ 2 callers
Function
parseLinks
parseLinks parses the links in an HTML document and returns the list of links.
server_test.go:372
↓ 1 callers
Method
AddItem
(listID, description string)
server.go:37
↓ 1 callers
Function
CheckPasswordHash
CheckPasswordHash returns a non-nil error if the given password hash is not a valid bcrypt hash.
server.go:342
↓ 1 callers
Method
CreateList
(name string)
server.go:33
↓ 1 callers
Method
CreateSignIn
()
server.go:41
↓ 1 callers
Method
DeleteItem
(listID, itemID string)
server.go:39
↓ 1 callers
Method
DeleteList
(id string)
server.go:34
↓ 1 callers
Method
DeleteSignIn
(id string)
server.go:43
↓ 1 callers
Function
GeneratePasswordHash
GeneratePasswordHash generates a bcrypt hash from the given password.
server.go:335
↓ 1 callers
Method
GetLists
()
server.go:32
↓ 1 callers
Method
IsSignInValid
(id string)
server.go:42
↓ 1 callers
Method
ServeHTTP
ServeHTTP implements the http.Handler interface.
server.go:133
↓ 1 callers
Method
UpdateDone
(listID, itemID string, done bool)
server.go:38
↓ 1 callers
Method
addRoutes
()
server.go:82
↓ 1 callers
Method
addTemplates
()
server.go:127
↓ 1 callers
Function
generateCSRFToken
()
server.go:390
↓ 1 callers
Function
generateSignInToken
()
db.go:201
↓ 1 callers
Method
getListItems
(listID string)
db.go:138
↓ 1 callers
Method
home
(w http.ResponseWriter, r *http.Request)
server.go:140
↓ 1 callers
Method
makeListID
just consonants to avoid spelling words makeListID creates a new randomized list ID.
db.go:103
Method
AddItem
AddItem adds an item with the given description to a list, returning the item ID.
db.go:164
Method
CreateList
CreateList creates a new list with the given name, returning its ID.
db.go:91
Method
CreateSignIn
CreateSignIn creates a new sign-in and returns its secure ID.
db.go:195
Method
DeleteItem
DeleteItem (soft) deletes the given item in a list.
db.go:185
Method
DeleteList
DeleteList (soft) deletes the given list (its items actually remain untouched). It's not an error if the list doesn't exist.
db.go:114
Method
DeleteSignIn
DeleteSignIn deletes the given sign-in. It's not an error if the sign-in doesn't exist.
db.go:230
Method
GetList
GetList fetches one list and returns it, or nil if not found.
db.go:120
Method
GetLists
GetLists fetches all the to-do lists (without their items), ordered with the most recent first.
db.go:66
Method
IsSignInValid
IsSignInValid reports whether the given sign-in ID is valid.
db.go:211
Method
Printf
(format string, v ...interface{})
server_test.go:425
Function
TestServer
(t *testing.T)
server_test.go:19
Method
UpdateDone
UpdateDone updates the "done" flag of the given item in a list.
db.go:178
Method
addItem
(w http.ResponseWriter, r *http.Request)
server.go:281
Method
createList
(w http.ResponseWriter, r *http.Request)
server.go:256
Method
deleteItem
(w http.ResponseWriter, r *http.Request)
server.go:318
Method
deleteList
(w http.ResponseWriter, r *http.Request)
server.go:271
Function
main
()
main.go:18
Method
showList
(w http.ResponseWriter, r *http.Request)
server.go:228
Method
signIn
(w http.ResponseWriter, r *http.Request)
server.go:178
Method
signOut
(w http.ResponseWriter, r *http.Request)
server.go:208
Method
updateDone
(w http.ResponseWriter, r *http.Request)
server.go:306