class Fabrique::Test::Fixtures::Repository::MysqlStore
Public Class Methods
new(host: 'localhost', port: 3306, username: nil, password: nil)
click to toggle source
# File lib/fabrique/test/fixtures/repository.rb, line 77 def initialize(host: 'localhost', port: 3306, username: nil, password: nil) @connection = MysqlConnection.new(host, port, username, password) end
Public Instance Methods
find(table, id)
click to toggle source
# File lib/fabrique/test/fixtures/repository.rb, line 81 def find(table, id) @connection.find(table, "WHERE customer_id = ?", [id]) end
save(table, record)
click to toggle source
# File lib/fabrique/test/fixtures/repository.rb, line 94 def save(table, record) @connection.update_or_insert(table, record) end
search(table, filter)
click to toggle source
# File lib/fabrique/test/fixtures/repository.rb, line 85 def search(table, filter) clauses, bindings = [], [] filter.each do |k, v| clauses << k bindings << v end @connection.select(table, clauses.join(" AND "), bindings) end