MCPcopy Create free account
hub / github.com/kataras/iris / Count

Method Count

_examples/database/mysql/sql/service.go:57–63  ·  view source on GitHub ↗

Count returns the total records count in the table.

(ctx context.Context)

Source from the content-addressed store, hash-verified

55
56// Count returns the total records count in the table.
57func (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.
66type ListOptions struct {

Callers

nothing calls this directly

Calls 3

PrimaryKeyMethod · 0.65
TableNameMethod · 0.65
SelectMethod · 0.65

Tested by

no test coverage detected