CountUser returns the user count which satisfies the given condition.
(condition ...interface{})
| 33 | |
| 34 | // CountUser returns the user count which satisfies the given condition. |
| 35 | func (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. |
| 48 | func (d *GormDatabase) GetUsers() ([]*model.User, error) { |
nothing calls this directly
no outgoing calls
no test coverage detected