Class: RailsLiveDashboard::Types::QueryContent
- Inherits:
-
ActiveRecord::Type::Value
- Object
- ActiveRecord::Type::Value
- RailsLiveDashboard::Types::QueryContent
- Defined in:
- app/models/rails_live_dashboard/types/query_content.rb
Defined Under Namespace
Classes: CONTENT_STRUCT
Constant Summary collapse
- PAYLOAD =
%i[ name sql parameters duration kind cached ].freeze
Instance Method Summary collapse
Instance Method Details
#cast(value) ⇒ Object
20 21 22 23 |
# File 'app/models/rails_live_dashboard/types/query_content.rb', line 20 def cast(value) sanitized = sanitize_input(value) CONTENT_STRUCT.new(**sanitized) end |
#deserialize(value) ⇒ Object
25 26 27 28 29 |
# File 'app/models/rails_live_dashboard/types/query_content.rb', line 25 def deserialize(value) decoded = ActiveSupport::JSON.decode(value)&.symbolize_keys sanitized = sanitize_input(decoded) CONTENT_STRUCT.new(**sanitized) end |
#serialize(value) ⇒ Object
31 32 33 |
# File 'app/models/rails_live_dashboard/types/query_content.rb', line 31 def serialize(value) ActiveSupport::JSON.encode(value) end |
#type ⇒ Object
16 17 18 |
# File 'app/models/rails_live_dashboard/types/query_content.rb', line 16 def type :jsonb end |