error handling for usermodel and reformatting
This commit is contained in:
parent
adaf6cf87d
commit
2a15f4b91d
@ -75,6 +75,9 @@ func (m *UserModel) GetById(id int64) (User, error) {
|
|||||||
func (m *UserModel) GetAll() ([]User, error) {
|
func (m *UserModel) GetAll() ([]User, error) {
|
||||||
stmt := `SELECT Id, ShortId, Username, Email, Created FROM users WHERE IsDeleted = FALSE`
|
stmt := `SELECT Id, ShortId, Username, Email, Created FROM users WHERE IsDeleted = FALSE`
|
||||||
rows, err := m.DB.Query(stmt)
|
rows, err := m.DB.Query(stmt)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
var users []User
|
var users []User
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var u User
|
var u User
|
||||||
|
Loading…
x
Reference in New Issue
Block a user