Class: Types::CountableConnectionType
- Inherits:
-
GraphQL::Types::Relay::BaseConnection
- Object
- GraphQL::Types::Relay::BaseConnection
- Types::CountableConnectionType
- Includes:
- CountableConnectionHelper
- Defined in:
- app/graphql/types/countable_connection_type.rb
Overview
rubocop: disable Graphql/AuthorizeTypes
Direct Known Subclasses
Types::Ci::RunnerCountableConnectionType, IssueConnectionType, MergeRequestConnectionType, TimeTracking::TimelogConnectionType
Constant Summary collapse
- COUNT_DESCRIPTION =
"Total count of collection. Returns limit + 1 for counts greater than the limit."
Instance Method Summary collapse
Methods included from CountableConnectionHelper
Instance Method Details
#count(limit: nil) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/graphql/types/countable_connection_type.rb', line 17 def count(limit: nil) relation = object.items if limit # Limited counting for performance limited_count(relation, limit) else # Existing unlimited counting logic # sometimes relation is an Array relation = relation.without_order if relation.respond_to?(:reorder) if relation.try(:group_values).present? relation.size.keys.size else relation.size end end end |