Class: BetterAuth::Adapters::SQLite

Inherits:
SQL
  • Object
show all
Defined in:
lib/better_auth/adapters/sqlite.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, path: nil, connection: nil) ⇒ SQLite

Returns a new instance of SQLite.



8
9
10
11
12
13
14
15
16
17
# File 'lib/better_auth/adapters/sqlite.rb', line 8

def initialize(options = nil, path: nil, connection: nil)
  require "sqlite3" unless connection

  config = options || Configuration.new(secret: Configuration::DEFAULT_SECRET, database: :memory)
  @path = path || ":memory:"
  connection ||= SQLite3::Database.new(@path)
  connection.results_as_hash = true if connection.respond_to?(:results_as_hash=)
  connection.execute("PRAGMA foreign_keys = ON") if connection.respond_to?(:execute)
  super(config, connection: connection, dialect: :sqlite)
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end