(userID int64)
| 2208 | } |
| 2209 | |
| 2210 | func (db *datastore) GetUserPostsCount(userID int64) int64 { |
| 2211 | var count int64 |
| 2212 | err := db.QueryRow("SELECT COUNT(*) FROM posts WHERE owner_id = ?", userID).Scan(&count) |
| 2213 | switch { |
| 2214 | case err == sql.ErrNoRows: |
| 2215 | return 0 |
| 2216 | case err != nil: |
| 2217 | log.Error("Failed selecting posts count for user %d: %v", userID, err) |
| 2218 | return 0 |
| 2219 | } |
| 2220 | |
| 2221 | return count |
| 2222 | } |
| 2223 | |
| 2224 | // ChangeSettings takes a User and applies the changes in the given |
| 2225 | // userSettings, MODIFYING THE USER with successful changes. |
no outgoing calls
no test coverage detected