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#[]



173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/sequel/async.rb', line 173

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



151
152
153
154
# File 'lib/sequel/async.rb', line 151

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

#async_update(*args, &cb) ⇒ Object



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

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