Class: OCI::Nosql::Models::StatementSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/nosql/models/statement_summary.rb

Overview

Information derived from parsing a NoSQL SQL statement.

Constant Summary collapse

OPERATION_ENUM =
[
  OPERATION_CREATE_TABLE = 'CREATE_TABLE'.freeze,
  OPERATION_ALTER_TABLE = 'ALTER_TABLE'.freeze,
  OPERATION_DROP_TABLE = 'DROP_TABLE'.freeze,
  OPERATION_CREATE_INDEX = 'CREATE_INDEX'.freeze,
  OPERATION_DROP_INDEX = 'DROP_INDEX'.freeze,
  OPERATION_SELECT = 'SELECT'.freeze,
  OPERATION_UPDATE = 'UPDATE'.freeze,
  OPERATION_INSERT = 'INSERT'.freeze,
  OPERATION_DELETE = 'DELETE'.freeze,
  OPERATION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ StatementSummary

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :operation (String)

    The value to assign to the #operation property

  • :table_name (String)

    The value to assign to the #table_name property

  • :index_name (String)

    The value to assign to the #index_name property

  • :is_if_exists (BOOLEAN)

    The value to assign to the #is_if_exists property

  • :is_if_not_exists (BOOLEAN)

    The value to assign to the #is_if_not_exists property

  • :syntax_error (String)

    The value to assign to the #syntax_error property



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/oci/nosql/models/statement_summary.rb', line 90

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.operation = attributes[:'operation'] if attributes[:'operation']

  self.table_name = attributes[:'tableName'] if attributes[:'tableName']

  raise 'You cannot provide both :tableName and :table_name' if attributes.key?(:'tableName') && attributes.key?(:'table_name')

  self.table_name = attributes[:'table_name'] if attributes[:'table_name']

  self.index_name = attributes[:'indexName'] if attributes[:'indexName']

  raise 'You cannot provide both :indexName and :index_name' if attributes.key?(:'indexName') && attributes.key?(:'index_name')

  self.index_name = attributes[:'index_name'] if attributes[:'index_name']

  self.is_if_exists = attributes[:'isIfExists'] unless attributes[:'isIfExists'].nil?

  raise 'You cannot provide both :isIfExists and :is_if_exists' if attributes.key?(:'isIfExists') && attributes.key?(:'is_if_exists')

  self.is_if_exists = attributes[:'is_if_exists'] unless attributes[:'is_if_exists'].nil?

  self.is_if_not_exists = attributes[:'isIfNotExists'] unless attributes[:'isIfNotExists'].nil?

  raise 'You cannot provide both :isIfNotExists and :is_if_not_exists' if attributes.key?(:'isIfNotExists') && attributes.key?(:'is_if_not_exists')

  self.is_if_not_exists = attributes[:'is_if_not_exists'] unless attributes[:'is_if_not_exists'].nil?

  self.syntax_error = attributes[:'syntaxError'] if attributes[:'syntaxError']

  raise 'You cannot provide both :syntaxError and :syntax_error' if attributes.key?(:'syntaxError') && attributes.key?(:'syntax_error')

  self.syntax_error = attributes[:'syntax_error'] if attributes[:'syntax_error']
end

Instance Attribute Details

#index_nameString

The index name from the SQL statement, if present.

Returns:

  • (String)


36
37
38
# File 'lib/oci/nosql/models/statement_summary.rb', line 36

def index_name
  @index_name
end

#is_if_existsBOOLEAN

True if the statement includes "IF EXISTS."

Returns:

  • (BOOLEAN)


40
41
42
# File 'lib/oci/nosql/models/statement_summary.rb', line 40

def is_if_exists
  @is_if_exists
end

#is_if_not_existsBOOLEAN

True if the statement includes "IF NOT EXISTS."

Returns:

  • (BOOLEAN)


44
45
46
# File 'lib/oci/nosql/models/statement_summary.rb', line 44

def is_if_not_exists
  @is_if_not_exists
end

#operationString

The operation represented in the statement, e.g. CREATE_TABLE.

Returns:

  • (String)


28
29
30
# File 'lib/oci/nosql/models/statement_summary.rb', line 28

def operation
  @operation
end

#syntax_errorString

If present, indicates a syntax error in the statement.

Returns:

  • (String)


48
49
50
# File 'lib/oci/nosql/models/statement_summary.rb', line 48

def syntax_error
  @syntax_error
end

#table_nameString

The table name from the SQL statement.

Returns:

  • (String)


32
33
34
# File 'lib/oci/nosql/models/statement_summary.rb', line 32

def table_name
  @table_name
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/oci/nosql/models/statement_summary.rb', line 51

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'operation': :'operation',
    'table_name': :'tableName',
    'index_name': :'indexName',
    'is_if_exists': :'isIfExists',
    'is_if_not_exists': :'isIfNotExists',
    'syntax_error': :'syntaxError'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/oci/nosql/models/statement_summary.rb', line 65

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'operation': :'String',
    'table_name': :'String',
    'index_name': :'String',
    'is_if_exists': :'BOOLEAN',
    'is_if_not_exists': :'BOOLEAN',
    'syntax_error': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



149
150
151
152
153
154
155
156
157
158
159
# File 'lib/oci/nosql/models/statement_summary.rb', line 149

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    operation == other.operation &&
    table_name == other.table_name &&
    index_name == other.index_name &&
    is_if_exists == other.is_if_exists &&
    is_if_not_exists == other.is_if_not_exists &&
    syntax_error == other.syntax_error
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/oci/nosql/models/statement_summary.rb', line 184

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


164
165
166
# File 'lib/oci/nosql/models/statement_summary.rb', line 164

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



173
174
175
# File 'lib/oci/nosql/models/statement_summary.rb', line 173

def hash
  [operation, table_name, index_name, is_if_exists, is_if_not_exists, syntax_error].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



217
218
219
220
221
222
223
224
225
226
# File 'lib/oci/nosql/models/statement_summary.rb', line 217

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



211
212
213
# File 'lib/oci/nosql/models/statement_summary.rb', line 211

def to_s
  to_hash.to_s
end