Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
.travis.yml | H A D | 02-Mar-2019 | 113 | 13 | 10 | |
LICENSE | H A D | 02-Mar-2019 | 1 KiB | 20 | 16 | |
README.md | H A D | 02-Mar-2019 | 1,022 | 49 | 32 | |
gormstore.go | H A D | 02-Mar-2019 | 6.2 KiB | 241 | 159 | |
gormstore_test.go | H A D | 02-Mar-2019 | 7.6 KiB | 333 | 251 | |
test | H A D | 02-Mar-2019 | 1.6 KiB | 61 | 52 |
README.md
1#### GORM backend for gorilla sessions 2 3 go get github.com/wader/gormstore 4 5#### Documentation 6 7http://www.godoc.org/github.com/wader/gormstore 8 9#### Example 10 11```go 12// initialize and setup cleanup 13store := gormstore.New(gorm.Open(...), []byte("secret")) 14// db cleanup every hour 15// close quit channel to stop cleanup 16quit := make(chan struct{}) 17go store.PeriodicCleanup(1*time.Hour, quit) 18``` 19 20```go 21// in HTTP handler 22func handlerFunc(w http.ResponseWriter, r *http.Request) { 23 session, err := store.Get(r, "session") 24 session.Values["user_id"] = 123 25 store.Save(r, w, session) 26 http.Error(w, "", http.StatusOK) 27} 28``` 29 30For more details see [gormstore godoc documentation](http://www.godoc.org/github.com/wader/gormstore). 31 32#### Testing 33 34Just sqlite3 tests: 35 36 go test 37 38All databases using docker: 39 40 ./test 41 42If docker is not local (docker-machine etc): 43 44 DOCKER_IP=$(docker-machine ip dev) ./test 45 46#### License 47 48gormstore is licensed under the MIT license. See [LICENSE](LICENSE) for the full license text. 49