Module: Ec::Pg

Defined in:
lib/ec/pg.rb,
lib/ec/pg/context.rb,
lib/ec/pg/railtie.rb,
lib/ec/pg/version.rb,
lib/ec/pg/rls_mixin.rb,
lib/ec/pg/rls_manager.rb,
lib/ec/pg/shard_mixin.rb,
lib/ec/pg/schema_mixin.rb,
lib/ec/pg/configuration.rb,
lib/ec/pg/shard_manager.rb,
lib/ec/pg/schema_manager.rb,
lib/ec/pg/tenant_context.rb,
lib/ec/pg/middleware/context_switcher.rb

Defined Under Namespace

Modules: Context, RlsManager, RlsMixin, SchemaManager, SchemaMixin, ShardManager, ShardMixin, TenantContext Classes: Configuration, ContextSwitcher, Error, InvalidType, Railtie

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.clear_context!Object

Clears all thread-local context.



51
# File 'lib/ec/pg.rb', line 51

def clear_context! = TenantContext.clear_context!

.configurationObject



39
40
41
# File 'lib/ec/pg.rb', line 39

def configuration
  @configuration ||= Ec::Pg::Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



35
36
37
# File 'lib/ec/pg.rb', line 35

def configure
  yield configuration
end

.current_schemaObject



48
# File 'lib/ec/pg.rb', line 48

def current_schema = TenantContext.current_schema

.current_shardObject



47
# File 'lib/ec/pg.rb', line 47

def current_shard = TenantContext.current_shard

.switch(shard: nil, schema: nil, &block) ⇒ Object



43
44
45
# File 'lib/ec/pg.rb', line 43

def switch(shard: nil, schema: nil, &block)
  TenantContext.switch(shard: shard, schema: schema, &block)
end