mirror of
https://github.com/pushbits/server.git
synced 2025-06-09 22:22:01 +02:00
Add misspell, gocritic, and revive
This commit is contained in:
parent
5e640800fe
commit
2c20e42a21
30 changed files with 79 additions and 43 deletions
|
@ -25,16 +25,16 @@ func (d *Database) UpdateApplication(application *model.Application) error {
|
|||
}
|
||||
|
||||
// GetApplicationByID returns the application with the given ID or nil.
|
||||
func (d *Database) GetApplicationByID(ID uint) (*model.Application, error) {
|
||||
func (d *Database) GetApplicationByID(id uint) (*model.Application, error) {
|
||||
var application model.Application
|
||||
|
||||
err := d.gormdb.First(&application, ID).Error
|
||||
err := d.gormdb.First(&application, id).Error
|
||||
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
assert.Assert(application.ID == ID)
|
||||
assert.Assert(application.ID == id)
|
||||
|
||||
return &application, err
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Package database provides definitions and functionality related to the database.
|
||||
package database
|
||||
|
||||
import (
|
||||
|
|
|
@ -34,16 +34,16 @@ func (d *Database) UpdateUser(user *model.User) error {
|
|||
}
|
||||
|
||||
// GetUserByID returns the user with the given ID or nil.
|
||||
func (d *Database) GetUserByID(ID uint) (*model.User, error) {
|
||||
func (d *Database) GetUserByID(id uint) (*model.User, error) {
|
||||
var user model.User
|
||||
|
||||
err := d.gormdb.First(&user, ID).Error
|
||||
err := d.gormdb.First(&user, id).Error
|
||||
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
assert.Assert(user.ID == ID)
|
||||
assert.Assert(user.ID == id)
|
||||
|
||||
return &user, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue