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

Method GetUserByID

database/user.go:22–32  ·  view source on GitHub ↗

GetUserByID returns the user by the given id or nil.

(id uint)

Source from the content-addressed store, hash-verified

20
21// GetUserByID returns the user by the given id or nil.
22func (d *GormDatabase) GetUserByID(id uint) (*model.User, error) {
23 user := new(model.User)
24 err := d.DB.Find(user, id).Error
25 if err == gorm.ErrRecordNotFound {
26 err = nil
27 }
28 if user.ID == id {
29 return user, err
30 }
31 return nil, err
32}
33
34// CountUser returns the user count which satisfies the given condition.
35func (d *GormDatabase) CountUser(condition ...interface{}) (int64, error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected