objects/callbacks.rb
def match(wallet, prefix, details)
    found = []
    @pgsql.exec('SELECT * FROM callback WHERE wallet = $1 AND prefix = $2', [wallet, prefix]).each do |r|
      next unless Regexp.new(r['regexp']).match?(details)
      id = @pgsql.exec(
        'INSERT INTO match (callback) VALUES ($1) ON CONFLICT (callback) DO NOTHING RETURNING id',
        [r['id'].to_i]
      )
      next if id.empty?
      mid = id[0]['id'].to_i
      found << mid
      @log.info("Callback ##{r['id']} just matched in #{wallet}/#{prefix} with \"#{details}\", match ##{mid}")
    end
    found
  end
# Returns the list of IDs of matches found
Returns the list of IDs of matches found
Returns the list of IDs of matches found
def match(wallet, prefix, details)
    found = []
    @pgsql.exec('SELECT * FROM callback WHERE wallet = $1 AND prefix = $2', [wallet, prefix]).each do |r|
      next unless Regexp.new(r['regexp']).match?(details)
      id = @pgsql.exec(
        'INSERT INTO match (callback) VALUES ($1) ON CONFLICT (callback) DO NOTHING RETURNING id',
        [r['id'].to_i]
      )
      next if id.empty?
      mid = id[0]['id'].to_i
      found << mid
      @log.info("Callback ##{r['id']} just matched in #{wallet}/#{prefix} with \"#{details}\", match ##{mid}")
    end
    found
  end
def match ( wallet , prefix , details ) found = [ ] @pgsql . exec ( 'SELECT * FROM callback WHERE wallet = $1 AND prefix = $2' , [ wallet , prefix ] ) . each do | r | next unless Regexp . new ( r [ 'regexp' ] ) . match? ( details ) id = @pgsql . exec ( 'INSERT INTO match (callback) VALUES ($1) ON CONFLICT (callback) DO NOTHING RETURNING id' , [ r [ 'id' ] . to_i ] ) next if id . empty? mid = id [ 0 ] [ 'id' ] . to_i found << mid @log . info ( "Callback ##{r['id']} just matched in #{wallet}/#{prefix} with \"#{details}\", match ##{mid}" ) end found end
Returns the list of IDs of matches found
Returns the list of IDs of matches found
wallet
prefix
details