diff --git a/TODO.md b/TODO.md index 7d48e11..6cab3a6 100644 --- a/TODO.md +++ b/TODO.md @@ -3,3 +3,4 @@ - [x] The mail field is case sensitive. Convert mail to lowercase before they are sent to InsertUser - [ ] All errors are fatal. Provide proper error handling. - [ ] Refactor UserStore code +- [ ] Request-scoped [context](https://www.alexedwards.net/blog/organising-database-access) diff --git a/data/db.go b/data/db.go index 572bd74..cd97eb7 100644 --- a/data/db.go +++ b/data/db.go @@ -5,8 +5,6 @@ import ( "log" _ "github.com/lib/pq" // postgresql database package - - "github.com/rjNemo/go-wiki/models" ) // NewDB read the connection parameters to establish a connection to the @@ -43,8 +41,8 @@ func NewContext(db *sql.DB) Context { type Store interface { CreateTable() Add(i interface{}) - Get(id int) (models.User, error) - GetAll(id int) ([]models.User, error) + Get(i interface{}) (interface{}, error) + GetAll() (interface{}, error) Delete(id int) // Find(ex string) Update(id int, i interface{}) diff --git a/views/templates/base.html b/views/templates/base.html index 8f6734e..c3a83ee 100644 --- a/views/templates/base.html +++ b/views/templates/base.html @@ -69,6 +69,19 @@ {{template "content" .}} + +