Count returns the total records count in the table.
(ctx context.Context)
| 55 | |
| 56 | // Count returns the total records count in the table. |
| 57 | func (s *Service) Count(ctx context.Context) (total int64, err error) { |
| 58 | q := fmt.Sprintf("SELECT COUNT(DISTINCT %s) FROM %s", s.rec.PrimaryKey(), s.rec.TableName()) |
| 59 | if err = s.db.Select(ctx, &total, q); err == sql.ErrNoRows { |
| 60 | err = nil |
| 61 | } |
| 62 | return |
| 63 | } |
| 64 | |
| 65 | // ListOptions holds the options to be passed on the `Service.List` method. |
| 66 | type ListOptions struct { |
nothing calls this directly
no test coverage detected