Top level module for Sequel
There are some module methods that are added via metaprogramming, one for each supported adapter. For example:
DB = Sequel.sqlite # Memory database
DB = Sequel.sqlite('blog.db')
DB = Sequel.postgres('database_name',
user:'user',
password: 'password',
host: 'host'
port: 5432,
max_connections: 10)
If a block is given to these methods, it is passed the opened Database object, which is closed (disconnected) when the block exits, just like a block passed to Sequel.connect. For example:
Sequel.sqlite('blog.db'){|db| puts db[:users].count}
For a more expanded introduction, see the README. For a quicker introduction, see the cheat sheet.
Included modules
Classes and Modules
- Sequel::Deprecation
- Sequel::Inflections
- Sequel::Plugins
- Sequel::SQL
- Sequel::Schema
- Sequel::SequelMethods
- Sequel::Timezones
- Sequel::ASTTransformer
- Sequel::BasicObject
- Sequel::ConnectionPool
- Sequel::Database
- Sequel::Dataset
- Sequel::Error
- Sequel::HookFailed
- Sequel::IntegerMigrator
- Sequel::LiteralString
- Sequel::MassAssignmentRestriction
- Sequel::Migration
- Sequel::MigrationAlterTableReverser
- Sequel::MigrationDSL
- Sequel::MigrationReverser
- Sequel::Migrator
- Sequel::Model
- Sequel::NoMatchingRow
- Sequel::Qualifier
- Sequel::SQLTime
- Sequel::ShardedSingleConnectionPool
- Sequel::ShardedThreadedConnectionPool
- Sequel::ShardedTimedQueueConnectionPool
- Sequel::SimpleMigration
- Sequel::SingleConnectionPool
- Sequel::ThreadedConnectionPool
- Sequel::TimedQueueConnectionPool
- Sequel::TimestampMigrator
- Sequel::ValidationFailed
Constants
| ADAPTER_MAP | = | {} |
Hash of adapters that have been used. The key is the adapter scheme symbol, and the value is the |
|
| AdapterNotFound | = | Class.new(Error) |
|
|
| AdvisoryLockError | = | Class.new(Error) |
|
|
| CheckConstraintViolation | = | Class.new(ConstraintViolation) |
|
|
| ConstraintViolation | = | Class.new(DatabaseError) |
Generic error raised when |
|
| DATABASES | = | [] |
Array of all databases to which |
|
| DEFAULT_INFLECTIONS_PROC | = | proc do plural(/$/, 's') plural(/s$/i, 's') plural(/(alias|(?:stat|octop|vir|b)us)$/i, '\1es') plural(/(buffal|tomat)o$/i, '\1oes') plural(/([ti])um$/i, '\1a') plural(/sis$/i, 'ses') plural(/(?:([^f])fe|([lr])f)$/i, '\1\2ves') plural(/(hive)$/i, '\1s') plural(/([^aeiouy]|qu)y$/i, '\1ies') plural(/(x|ch|ss|sh)$/i, '\1es') plural(/(matr|vert|ind)ix|ex$/i, '\1ices') plural(/([m|l])ouse$/i, '\1ice') singular(/s$/i, '') singular(/([ti])a$/i, '\1um') singular(/(analy|ba|cri|diagno|parenthe|progno|synop|the)ses$/i, '\1sis') singular(/([^f])ves$/i, '\1fe') singular(/([h|t]ive)s$/i, '\1') singular(/([lr])ves$/i, '\1f') singular(/([^aeiouy]|qu)ies$/i, '\1y') singular(/(m)ovies$/i, '\1ovie') singular(/(x|ch|ss|sh)es$/i, '\1') singular(/([m|l])ice$/i, '\1ouse') singular(/buses$/i, 'bus') singular(/oes$/i, 'o') singular(/shoes$/i, 'shoe') singular(/(alias|(?:stat|octop|vir|b)us)es$/i, '\1') singular(/(vert|ind)ices$/i, '\1ex') singular(/matrices$/i, 'matrix') irregular('person', 'people') irregular('man', 'men') irregular('child', 'children') irregular('sex', 'sexes') irregular('move', 'moves') irregular('quiz', 'quizzes') irregular('testis', 'testes') uncountable(%w(equipment information rice money species series fish sheep news)) end |
Proc that is instance_execed to create the default inflections for both the model inflector and the inflector extension. |
|
| DatabaseConnectionError | = | Class.new(DatabaseError) |
|
|
| DatabaseDisconnectError | = | Class.new(DatabaseError) |
|
|
| DatabaseError | = | Class.new(Error) |
Generic error raised by the database adapters, indicating a problem originating from the database server. Usually raised because incorrect |
|
| DatabaseLockTimeout | = | Class.new(DatabaseError) |
|
|
| ForeignKeyConstraintViolation | = | Class.new(ConstraintViolation) |
|
|
| InvalidOperation | = | Class.new(Error) |
|
|
| InvalidValue | = | Class.new(Error) |
|
|
| MAJOR | = | 5 |
The major version of |
|
| MINOR | = | 98 |
The minor version of |
|
| NoExistingObject | = | Class.new(Error) |
Exception class raised when |
|
| NotNullConstraintViolation | = | Class.new(ConstraintViolation) |
|
|
| OPTS | = | {}.freeze |
Frozen hash used as the default options hash for most options. |
|
| PoolTimeout | = | Class.new(Error) |
|
|
| Rollback | = | Class.new(Error) |
|
|
| SHARED_ADAPTER_MAP | = | {} |
Hash of shared adapters that have been registered. The key is the adapter scheme symbol, and the value is the |
|
| SPLIT_SYMBOL_CACHE | = | {} | ||
| SerializationFailure | = | Class.new(DatabaseError) |
|
|
| TINY | = | 0 |
The tiny version of |
|
| Timezones | = | SequelMethods |
Backwards compatible alias |
|
| UndefinedAssociation | = | Class.new(Error) |
Raised when an undefined association is used when eager loading. |
|
| UniqueConstraintViolation | = | Class.new(ConstraintViolation) |
|
|
| VERSION | = | [MAJOR, MINOR, TINY].join('.').freeze |
The version of |
|
| VERSION_NUMBER | = | MAJOR*10000 + MINOR*10 + TINY |
The version of |
|
| VIRTUAL_ROW | = | new |
Public Class methods
Yield the Inflections module if a block is given, and return the Inflections module.
# File lib/sequel/model/inflections.rb 6 def self.inflections 7 yield Inflections if defined?(yield) 8 Inflections 9 end
The preferred method for writing Sequel migrations, using a DSL:
Sequel.migration do up do create_table(:artists) do primary_key :id String :name end end down do drop_table(:artists) end end
Designed to be used with the Migrator class, part of the migration extension.
# File lib/sequel/extensions/migration.rb 312 def self.migration(&block) 313 MigrationDSL.create(&block) 314 end
The version of Sequel you are using, as a string (e.g. “2.11.0”)
# File lib/sequel/version.rb 22 def self.version 23 VERSION 24 end