Compare commits

...

3 Commits

Author SHA1 Message Date
Yessiest c5f6a11a8d Fixed YARD documentation for Database.new.table 2023-10-11 10:29:27 +04:00
Yessiest ca2feecef7 bugfix for sync_query 2023-10-09 16:05:54 +04:00
Yessiest d1539a7e0e added parameters for map function 2023-10-09 15:50:52 +04:00
2 changed files with 5 additions and 4 deletions

View File

@ -106,8 +106,9 @@ module LPGAR
# Map returned rows from a query to an array of objects of this table.
# @param query [String] raw postgresql query
# @return [Array(Object)] array of records of this table
def map(query)
conn.exec(query).map do |row|
def map(query, params = [])
# @sg-ignore
conn.exec(query, params).map do |row|
new(row, syncless: true)
end
end
@ -134,7 +135,6 @@ module LPGAR
WHERE #{selector}
LIMIT 1
QUERY
puts @sync_query
end
# Returns transaction class for this record.
@ -357,6 +357,7 @@ module LPGAR
# Create class from table name
# @param name [String]
# @param block [#call]
# @return [Class]
def table(name, &block)
conn = @conn
new_class = Class.new(Record) do

View File

@ -2,7 +2,7 @@
Gem::Specification.new do |spec|
spec.name = "lpgar"
spec.version = "0.2.1"
spec.version = "0.2.4"
spec.summary = "Lightweight Postgres Active Record"
spec.description = <<~DESC
Lightweight implementation of Active Record pattern for Postgres.