Class: Sequel::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/sequel/async.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.async_lookup(args) ⇒ Object

async version of Model#[]



168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/sequel/async.rb', line 168

def async_lookup args
  unless Hash === args
    args = primary_key_hash(args)
  end

  dataset.where(args).limit(1).async_all{ |rows|
    if rows.any?
      yield rows.first
    else
      yield nil
    end
  }
  nil
end

Instance Method Details

#async_delete(&cb) ⇒ Object



146
147
148
149
# File 'lib/sequel/async.rb', line 146

def async_delete &cb
  this.async_delete(&cb)
  nil
end

#async_update(*args, &cb) ⇒ Object



140
141
142
143
144
# File 'lib/sequel/async.rb', line 140

def async_update *args, &cb
  this.async_update(*args, &cb)
  set(*args)
  self
end