On Friday, June 1, 2012 10:07:03 AM UTC-7, Joe Van Dyk wrote:
>
> Hi,
>
> There's been lots of activity in the postgresql world in the past couple 
> years. Arrays, hstores, ranges, json, etc. AR's postgresql adapter in 4.0 
> will have support for mapping ruby types to custom postgresql types (
> https://github.com/rails/rails/pull/4775). 
>
> I've noticed that sequel, AR's postgresql adapter, and 
> jdbc-activerecord-postgres all contain similar, but different parsers for 
> handling those postgresql datatypes. Each of the ORMs have their own 
> plugins for arrays, hstores, etc.
>
>
> https://github.com/jruby/activerecord-jdbc-adapter/blob/master/lib/arjdbc/postgresql/adapter.rb
>
> https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L119
>
> https://github.com/jeremyevans/sequel/blob/master/lib/sequel/adapters/postgres.rb#L86
>
> It seems like having a single gem for handling the postgresql parser code 
> would be helpful.  Maybe this could be done before ActiveRecord 4.0?
>
> Thoughts?
>

I'm not opposed to extracting the parsers that Sequel uses for complex 
types for use by other libraries.  In the array case, I'm using ruby's json 
parser for integer/float arrays, and a custom pure-ruby parser for 
string/numeric arrays.  In the hstore case, I'm using a strscan-based 
parser.  The json type just uses ruby's json parser.  The range parser I 
haven't written yet, but I'm assuming it'll be pure-ruby as well.

I don't see value in extracting the handling/parsing for primitive types 
such as integer/float/date, though.

As long as the interested developers can agree on an API, I don't foresee 
problems with your suggestion.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/1u1VmrozlJwJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to