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

Method CountUser

database/user.go:35–45  ·  view source on GitHub ↗

CountUser returns the user count which satisfies the given condition.

(condition ...interface{})

Source from the content-addressed store, hash-verified

33
34// CountUser returns the user count which satisfies the given condition.
35func (d *GormDatabase) CountUser(condition ...interface{}) (int64, error) {
36 c := int64(-1)
37 handle := d.DB.Model(new(model.User))
38 if len(condition) == 1 {
39 handle = handle.Where(condition[0])
40 } else if len(condition) > 1 {
41 handle = handle.Where(condition[0], condition[1:]...)
42 }
43 err := handle.Count(&c).Error
44 return c, err
45}
46
47// GetUsers returns all users.
48func (d *GormDatabase) GetUsers() ([]*model.User, error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected