Class: Scenic::Index

Inherits:
Object
  • Object
show all
Defined in:
lib/scenic/index.rb

Overview

The in-memory representation of a database index.

This object is used internally by adapters and the schema dumper and is not intended to be used by application code. It is documented here for use by adapter gems.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object_name:, index_name:, definition:) ⇒ Index

Returns a new instance of Index

Parameters:

  • object_name (String)

    The name of the object that has the index

  • index_name (String)

    The name of the index

  • definition (String)

    The SQL statements that defined the index


30
31
32
33
34
# File 'lib/scenic/index.rb', line 30

def initialize(object_name:, index_name:, definition:)
  @object_name = object_name
  @index_name = index_name
  @definition = definition
end

Instance Attribute Details

#definitionString (readonly)

The SQL statement that defines the index

Examples:

"CREATE INDEX index_users_on_email ON users USING btree (email)"

Returns:

  • (String)

23
24
25
# File 'lib/scenic/index.rb', line 23

def definition
  @definition
end

#index_nameString (readonly)

The name of the index

Returns:

  • (String)

16
17
18
# File 'lib/scenic/index.rb', line 16

def index_name
  @index_name
end

#object_nameString (readonly)

The name of the object that has the index

Returns:

  • (String)

12
13
14
# File 'lib/scenic/index.rb', line 12

def object_name
  @object_name
end