Class: Ci::JobAnalytics::QueryBuilder
- Inherits:
-
Object
- Object
- Ci::JobAnalytics::QueryBuilder
- Defined in:
- lib/ci/job_analytics/query_builder.rb
Instance Attribute Summary collapse
-
#aggregations ⇒ Object
readonly
Returns the value of attribute aggregations.
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#from_time ⇒ Object
readonly
Returns the value of attribute from_time.
-
#name_search ⇒ Object
readonly
Returns the value of attribute name_search.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
-
#select_fields ⇒ Object
readonly
Returns the value of attribute select_fields.
-
#sort ⇒ Object
readonly
Returns the value of attribute sort.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#to_time ⇒ Object
readonly
Returns the value of attribute to_time.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project:, current_user:, options: {}) ⇒ QueryBuilder
constructor
A new instance of QueryBuilder.
Constructor Details
#initialize(project:, current_user:, options: {}) ⇒ QueryBuilder
Returns a new instance of QueryBuilder.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ci/job_analytics/query_builder.rb', line 19 def initialize(project:, current_user:, options: {}) @project = project @current_user = current_user @select_fields = [:select_fields] || [] @aggregations = [:aggregations] || [] @sort = [:sort] @source = [:source] @ref = [:ref] @from_time = [:from_time] || 1.week.ago.utc @to_time = [:to_time] @name_search = [:name_search] end |
Instance Attribute Details
#aggregations ⇒ Object (readonly)
Returns the value of attribute aggregations.
6 7 8 |
# File 'lib/ci/job_analytics/query_builder.rb', line 6 def aggregations @aggregations end |
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
6 7 8 |
# File 'lib/ci/job_analytics/query_builder.rb', line 6 def current_user @current_user end |
#from_time ⇒ Object (readonly)
Returns the value of attribute from_time.
6 7 8 |
# File 'lib/ci/job_analytics/query_builder.rb', line 6 def from_time @from_time end |
#name_search ⇒ Object (readonly)
Returns the value of attribute name_search.
6 7 8 |
# File 'lib/ci/job_analytics/query_builder.rb', line 6 def name_search @name_search end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
6 7 8 |
# File 'lib/ci/job_analytics/query_builder.rb', line 6 def project @project end |
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
6 7 8 |
# File 'lib/ci/job_analytics/query_builder.rb', line 6 def ref @ref end |
#select_fields ⇒ Object (readonly)
Returns the value of attribute select_fields.
6 7 8 |
# File 'lib/ci/job_analytics/query_builder.rb', line 6 def select_fields @select_fields end |
#sort ⇒ Object (readonly)
Returns the value of attribute sort.
6 7 8 |
# File 'lib/ci/job_analytics/query_builder.rb', line 6 def sort @sort end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
6 7 8 |
# File 'lib/ci/job_analytics/query_builder.rb', line 6 def source @source end |
#to_time ⇒ Object (readonly)
Returns the value of attribute to_time.
6 7 8 |
# File 'lib/ci/job_analytics/query_builder.rb', line 6 def to_time @to_time end |
Instance Method Details
#execute ⇒ Object
32 33 34 35 36 37 |
# File 'lib/ci/job_analytics/query_builder.rb', line 32 def execute return unless ::Gitlab::ClickHouse.enabled_for_analytics? && Ability.allowed?(current_user, :read_build, project) build_finder.query_builder end |