MCPcopy Create free account
hub / github.com/gotify/server / GetUserByName

Method GetUserByName

database/user.go:9–19  ·  view source on GitHub ↗

GetUserByName returns the user by the given name or nil.

(name string)

Source from the content-addressed store, hash-verified

7
8// GetUserByName returns the user by the given name or nil.
9func (d *GormDatabase) GetUserByName(name string) (*model.User, error) {
10 user := new(model.User)
11 err := d.DB.Where("name = ?", name).Find(user).Error
12 if err == gorm.ErrRecordNotFound {
13 err = nil
14 }
15 if user.Name == name {
16 return user, err
17 }
18 return nil, err
19}
20
21// GetUserByID returns the user by the given id or nil.
22func (d *GormDatabase) GetUserByID(id uint) (*model.User, error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected