ruby – Datamapper TEXT默认限制为65k个字符 – 如何提高限??制
发布时间:2020-12-17 02:18:52 所属栏目:百科 来源:网络整理
导读:我有一个类需要TEXT高达约300k字符,它存储在PostgreSQL数据库中. Postgres本身对兆字节blob没有问题(最终我会将它们存储在S3中),但Datamapper对于TEXT的默认限制为“65k字符”: By default,DataMapper supports the following primitive types: TrueClass,B
我有一个类需要TEXT高达约300k字符,它存储在PostgreSQL数据库中.
Postgres本身对兆字节blob没有问题(最终我会将它们存储在S3中),但Datamapper对于TEXT的默认限制为“65k字符”:
我想做点什么 property :id,Serial property :name,String,:index => true property :posted,DateTime property :info,DataMapper::Types::Text,:lazy => false property :data,:limit => 500000 # needs to be big is :limit correct?5 我知道懒惰的部分是可以的,因为我从http://datamapper.rubyforge.org/dm-core/DataMapper/Property.html开始 – 但是用于覆盖TEXT字段限制的关键字是什么: >:长度? 或者是其他东西? 解决方法
好,
事实证明:长度确实有效. class SomeClass include DataMapper::Resource property :id,Serial property :name,:index => true # strings are actively loaded property :posted,DateTime property :info,Text,:lazy => false # This is short stuff a hundred or so bytes long that I want loaded property :data,:length => 500000 # Text is lazy loaded by default,but I also need to override the default length limit which is 65536 chars in DM (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |