Class: RDBr::Metadata::Index
- Inherits:
-
Data
- Object
- Data
- RDBr::Metadata::Index
- Defined in:
- lib/rdbr/metadata/index.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#expressions ⇒ Object
readonly
Returns the value of attribute expressions.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#unique ⇒ Object
readonly
Returns the value of attribute unique.
-
#using ⇒ Object
readonly
Returns the value of attribute using.
-
#where ⇒ Object
readonly
Returns the value of attribute where.
Instance Method Summary collapse
- #expression? ⇒ Boolean
-
#initialize(name:, columns: [], expressions: [], unique: false, where: nil, using: nil) ⇒ Index
constructor
A new instance of Index.
- #partial? ⇒ Boolean
Constructor Details
#initialize(name:, columns: [], expressions: [], unique: false, where: nil, using: nil) ⇒ Index
Returns a new instance of Index.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rdbr/metadata/index.rb', line 4 def initialize(name:, columns: [], expressions: [], unique: false, where: nil, using: nil) index_columns = Values.names(columns, field: 'index columns', allow_empty: true) index_expressions = Values.names(expressions, field: 'index expressions', allow_empty: true) if index_columns.empty? && index_expressions.empty? raise InvalidMetadataError, 'index must contain columns or expressions' end super( name: Values.name(name, field: 'index name'), columns: index_columns, expressions: index_expressions, unique: Values.boolean(unique, field: 'index unique'), where: Values.optional_name(where, field: 'index predicate'), using: Values.optional_name(using, field: 'index method') ) end |
Instance Attribute Details
#columns ⇒ Object (readonly)
Returns the value of attribute columns
3 4 5 |
# File 'lib/rdbr/metadata/index.rb', line 3 def columns @columns end |
#expressions ⇒ Object (readonly)
Returns the value of attribute expressions
3 4 5 |
# File 'lib/rdbr/metadata/index.rb', line 3 def expressions @expressions end |
#name ⇒ Object (readonly)
Returns the value of attribute name
3 4 5 |
# File 'lib/rdbr/metadata/index.rb', line 3 def name @name end |
#unique ⇒ Object (readonly)
Returns the value of attribute unique
3 4 5 |
# File 'lib/rdbr/metadata/index.rb', line 3 def unique @unique end |
#using ⇒ Object (readonly)
Returns the value of attribute using
3 4 5 |
# File 'lib/rdbr/metadata/index.rb', line 3 def using @using end |
#where ⇒ Object (readonly)
Returns the value of attribute where
3 4 5 |
# File 'lib/rdbr/metadata/index.rb', line 3 def where @where end |
Instance Method Details
#expression? ⇒ Boolean
25 26 27 |
# File 'lib/rdbr/metadata/index.rb', line 25 def expression? !expressions.empty? end |
#partial? ⇒ Boolean
21 22 23 |
# File 'lib/rdbr/metadata/index.rb', line 21 def partial? !where.nil? end |