DataMapper -


未知
跨平台
Ruby

软件简介

DataMapper 是 Ruby 的数据库映射框架,使用示例:

  @parent = Tree.find(:first, :conditions => ['name = ?', 'bob'])

  @parent.children.each do |child|  
    puts @parent.object_id == child.parent.object_id  
  end



  Zoo.first(:name => 'Galveston')

  # 'gt' means greater-than. We also do 'lt'.  
  Person.all(:age.gt => 30)

  # 'gte' means greather-than-or-equal-to. We also do 'lte'.  
  Person.all(:age.gte => 30)

  Person.all(:name.not => 'bob')

  # If the value of a pair is an Array, we do an IN-clause for you.  
  Person.all(:name.like => 'S%', :id => [1, 2, 3, 4, 5])

  # An alias for Zoo.find(11)  
  Zoo[11]

  # Does a NOT IN () clause for you.  
  Person.all(:name.not => ['bob','rick','steve'])