class Sequel::Postgres::CreatePartitionOfTableGenerator
Generator used for creating tables that are partitions of other tables.
Constants
- MAXVALUE
- MINVALUE
Public Class Methods
Source
# File lib/sequel/adapters/shared/postgres.rb 167 def initialize(&block) 168 instance_exec(&block) 169 end
Public Instance Methods
Source
# File lib/sequel/adapters/shared/postgres.rb 212 def default 213 @default = true 214 end
Sets that this is a default partition, where values not in other partitions are stored.
Source
# File lib/sequel/adapters/shared/postgres.rb 185 def from(*v) 186 @from = v 187 end
Assumes range partitioning, sets the inclusive minimum value of the range for this partition.
Source
# File lib/sequel/adapters/shared/postgres.rb 227 def hash_values 228 [@modulus, @remainder] 229 end
The modulus and remainder to use for this partition for a hash partition.
Source
# File lib/sequel/adapters/shared/postgres.rb 222 def list 223 @in 224 end
The values to include in this partition for a list partition.
Source
# File lib/sequel/adapters/shared/postgres.rb 179 def maxvalue 180 MAXVALUE 181 end
The minimum value of the data type used in range partitions, useful as an argument to to
.
Source
# File lib/sequel/adapters/shared/postgres.rb 173 def minvalue 174 MINVALUE 175 end
The minimum value of the data type used in range partitions, useful as an argument to from
.
Source
# File lib/sequel/adapters/shared/postgres.rb 201 def modulus(v) 202 @modulus = v 203 end
Assumes hash partitioning, sets the modulus for this parition.
Source
# File lib/sequel/adapters/shared/postgres.rb 233 def partition_type 234 raise Error, "Unable to determine partition type, multiple different partitioning methods called" if [@from || @to, @list, @modulus || @remainder, @default].compact.length > 1 235 236 if @from || @to 237 raise Error, "must call both from and to when creating a partition of a table if calling either" unless @from && @to 238 :range 239 elsif @in 240 :list 241 elsif @modulus || @remainder 242 raise Error, "must call both modulus and remainder when creating a partition of a table if calling either" unless @modulus && @remainder 243 :hash 244 elsif @default 245 :default 246 else 247 raise Error, "unable to determine partition type, no partitioning methods called" 248 end 249 end
Determine the appropriate partition type for this partition by which methods were called on it.
Source
# File lib/sequel/adapters/shared/postgres.rb 217 def range 218 [@from, @to] 219 end
The from and to values of this partition for a range partition.
Source
# File lib/sequel/adapters/shared/postgres.rb 206 def remainder(v) 207 @remainder = v 208 end
Assumes hash partitioning, sets the remainder for this parition.
Source
# File lib/sequel/adapters/shared/postgres.rb 191 def to(*v) 192 @to = v 193 end
Assumes range partitioning, sets the exclusive maximum value of the range for this partition.
Source
# File lib/sequel/adapters/shared/postgres.rb 196 def values_in(*v) 197 @in = v 198 end
Assumes list partitioning, sets the values to be included in this partition.