DataMapper 介绍
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'])
DataMapper 官网
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。