imagine if travis actually worked
This commit is contained in:
parent
fa9bf1f916
commit
79055994bd
|
@ -29,27 +29,27 @@ func NewDefaultLikeStore(acc *qgen.Accumulator) (*DefaultLikeStore, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Write a test for this
|
// TODO: Write a test for this
|
||||||
func (s *DefaultLikeStore) BulkExists(ids []int, sentBy int, targetType string) (eids []int, err error) {
|
func (s *DefaultLikeStore) BulkExists(ids []int, sentBy int, targetType string) (eids []int, e error) {
|
||||||
if len(ids) == 0 {
|
if len(ids) == 0 {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
var rows *sql.Rows
|
var rows *sql.Rows
|
||||||
if len(ids) == 1 {
|
if len(ids) == 1 {
|
||||||
rows, err = s.singleExists.Query(sentBy, targetType, ids[0])
|
rows, e = s.singleExists.Query(sentBy, targetType, ids[0])
|
||||||
} else {
|
} else {
|
||||||
rows, err = qgen.NewAcc().Select("likes").Columns("targetItem").Where("sentBy=? AND targetType=?").In("targetItem", ids).Query(sentBy, targetType)
|
rows, e = qgen.NewAcc().Select("likes").Columns("targetItem").Where("sentBy=? AND targetType=?").In("targetItem", ids).Query(sentBy, targetType)
|
||||||
}
|
}
|
||||||
if err == sql.ErrNoRows {
|
if e == sql.ErrNoRows {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
} else if err != nil {
|
} else if e != nil {
|
||||||
return nil, err
|
return nil, e
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
var id int
|
var id int
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
if err := rows.Scan(&id); err != nil {
|
if e := rows.Scan(&id); e != nil {
|
||||||
return nil, err
|
return nil, e
|
||||||
}
|
}
|
||||||
eids = append(eids, id)
|
eids = append(eids, id)
|
||||||
}
|
}
|
||||||
|
@ -64,9 +64,9 @@ func (s *DefaultLikeStore) Delete(targetID int, targetType string) error {
|
||||||
// TODO: Write a test for this
|
// TODO: Write a test for this
|
||||||
// Count returns the total number of likes globally
|
// Count returns the total number of likes globally
|
||||||
func (s *DefaultLikeStore) Count() (count int) {
|
func (s *DefaultLikeStore) Count() (count int) {
|
||||||
err := s.count.QueryRow().Scan(&count)
|
e := s.count.QueryRow().Scan(&count)
|
||||||
if err != nil {
|
if e != nil {
|
||||||
LogError(err)
|
LogError(e)
|
||||||
}
|
}
|
||||||
return count
|
return count
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue