MCPcopy
hub / github.com/writefreely/writefreely / GetUserCollectionCount

Method GetUserCollectionCount

database.go:298–310  ·  view source on GitHub ↗
(userID int64)

Source from the content-addressed store, hash-verified

296}
297
298func (db *datastore) GetUserCollectionCount(userID int64) (uint64, error) {
299 var collCount uint64
300 err := db.QueryRow("SELECT COUNT(*) FROM collections WHERE owner_id = ?", userID).Scan(&collCount)
301 switch {
302 case err == sql.ErrNoRows:
303 return 0, impart.HTTPError{http.StatusInternalServerError, "Couldn't retrieve user from database."}
304 case err != nil:
305 log.Error("Couldn't get collections count for user %d: %v", userID, err)
306 return 0, err
307 }
308
309 return collCount, nil
310}
311
312func (db *datastore) CreateCollection(cfg *config.Config, alias, title string, userID int64) (*Collection, error) {
313 if db.PostIDExists(alias) {

Callers 2

GetMeStatsMethod · 0.95
viewCollectionsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected