completed the Scan() error handling

This commit is contained in:
2025-12-30 23:19:39 -07:00
parent d87b4b9411
commit c958bc5826
10 changed files with 179 additions and 153 deletions
+4 -4
View File
@@ -57,7 +57,7 @@ func lookupCommunityContact(ctx context.Context, id int32) (int32, error) {
rs, err := amdb.QueryContext(ctx, "SELECT contactid FROM contacts WHERE owner_commid = ?", id)
if err == nil {
if rs.Next() {
rs.Scan(&rc)
err = rs.Scan(&rc)
}
}
return rc, err
@@ -69,7 +69,7 @@ func lookupUserContact(ctx context.Context, uid int32) (int32, error) {
rs, err := amdb.QueryContext(ctx, "SELECT contactid FROM contacts WHERE owner_uid = ? AND owner_commid = -1", uid)
if err == nil {
if rs.Next() {
rs.Scan(&rc)
err = rs.Scan(&rc)
}
}
return rc, err
@@ -191,8 +191,8 @@ func (ci *ContactInfo) Save(ctx context.Context) (bool, error) {
if !rs.Next() {
return false, errors.New("internal error rereading update timestamp")
}
rs.Scan(&ci.LastUpdate)
return emailChange, nil
err = rs.Scan(&ci.LastUpdate)
return emailChange, err
}
// Clone makes a copy of the ContactInfo.