1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 07:39:43 +02:00

event handlers framework

This commit is contained in:
Harvey Kandola 2017-05-01 12:13:05 +01:00
parent 740c2ca189
commit bcabe494e3
15 changed files with 1091 additions and 5 deletions

View file

@ -86,6 +86,23 @@ func (p *Persister) GetAccountsByOrg() (t []entity.Account, err error) {
return
}
// CountOrgAccounts returns the numnber of active user accounts for specified organization.
func (p *Persister) CountOrgAccounts() (c int) {
row := Db.QueryRow("SELECT count(*) FROM account WHERE orgid=? AND active=1", p.Context.OrgID)
err := row.Scan(&c)
if err != nil && err != sql.ErrNoRows {
log.Error(p.Base.SQLSelectError("CountOrgAccounts", p.Context.OrgID), err)
return 0
}
if err == sql.ErrNoRows {
return 0
}
return
}
// UpdateAccount updates the database record for the given account to the given values.
func (p *Persister) UpdateAccount(account entity.Account) (err error) {
account.Revised = time.Now().UTC()