Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supercharge prepareValue #555

Merged
merged 7 commits into from Apr 6, 2014
Merged

Supercharge prepareValue #555

merged 7 commits into from Apr 6, 2014

Commits on Mar 30, 2014

  1. benchmark value preparation

    benesch committed Mar 30, 2014
    Copy the full SHA
    5c49a4a View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    b778f2b View commit details
    Browse the repository at this point in the history
  3. utils: reorganize prepareValue conditional for clarity

    Prefer positive tests; group tests for specific objects.
    benesch committed Mar 30, 2014
    Copy the full SHA
    7faa2b3 View commit details
    Browse the repository at this point in the history
  4. utils: convert tabs to spaces

    benesch committed Mar 30, 2014
    Copy the full SHA
    364cf4b View commit details
    Browse the repository at this point in the history
  5. properly prepare complex arrays

    `arrayString` duplicated too much of `prepareValue`'s logic, and so
    didn't receive bugfixes for handling dates with timestamps. Defer to
    `prepareValue` whenever possible.
    
    This change enforces double-quote escaping of all array elements,
    regardless of whether escaping is necessary. This has the side-effect of
    properly escaping JSON arrays.
    benesch committed Mar 30, 2014
    Copy the full SHA
    c41eedc View commit details
    Browse the repository at this point in the history

Commits on Mar 31, 2014

  1. allow type-coercion overrides for custom objects

    Attempt to call a `toPostgres` method on objects passed as query values
    before converting them to JSON. This allows custom types to convert
    themselves to the appropriate PostgreSQL literal.
    
    This strategy is fully backwards-compatible and uses the same pattern as
    the `toJSON` override.
    benesch committed Mar 31, 2014
    Copy the full SHA
    6ced524 View commit details
    Browse the repository at this point in the history

Commits on Apr 3, 2014

  1. pass prepareValue hook to toPostgres

    Pass `toPostgres` type-coercers a reference to the `prepareValue`
    function to ease constructing literals composed of other Postgres types.
    benesch committed Apr 3, 2014
    Copy the full SHA
    619ba46 View commit details
    Browse the repository at this point in the history