Class: BetterAuth::Adapters::Postgres

Inherits:
SQL
  • Object
show all
Defined in:
lib/better_auth/adapters/postgres.rb

Instance Attribute Summary collapse

Attributes inherited from SQL

#connection, #dialect

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from SQL

#count, #create, #delete, #delete_many, #find_many, #find_one, #transaction, #update, #update_many

Methods inherited from Base

#count, #create, #delete, #delete_many, #find_many, #find_one, #transaction, #update, #update_many

Constructor Details

#initialize(options = nil, url: nil, connection: nil) ⇒ Postgres

Returns a new instance of Postgres.



8
9
10
11
12
13
14
# File 'lib/better_auth/adapters/postgres.rb', line 8

def initialize(options = nil, url: nil, connection: nil)
  require "pg" unless connection

  config = options || Configuration.new(secret: Configuration::DEFAULT_SECRET, database: :memory)
  @url = url
  super(config, connection: connection || PG.connect(url), dialect: :postgres)
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



6
7
8
# File 'lib/better_auth/adapters/postgres.rb', line 6

def url
  @url
end