Skip to content

Conversation

@shane-circuithub
Copy link
Contributor

@shane-circuithub shane-circuithub commented Apr 28, 2025

This requires the introduction of a new Encoder type with three members: binary, which is the Hasql binary encoder, text which encodes a type in PostgreSQL's text format (needed for nested arrays) and quote, which does the thing that the function we previously called encode does (i.e., a -> Opaleye.PrimExpr).

This will break any downstream code that uses a completely custom DBType implementation, but anything that uses ReadShow, Enum, Composite, JSONBEncoded or parseTypeInformation will continue working as before (which should cover all common cases).

I dropped support for network-ip instead of trying to figure out how to write binary and text encoders for it. We still support iproute.

@shane-circuithub shane-circuithub force-pushed the prepared branch 2 times, most recently from b35c498 to da75d2b Compare April 28, 2025 02:39
Copy link
Contributor

@TeofilC TeofilC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a quick glance through

format. For large amounts of data this can be significantly more efficient
than embedding the values directly in the statement with 'Rel8.lit'.
-}
prepared :: forall a b i o.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seeems more like parameterized - there's nothing that requires the statement-function you pass in to be calling a prepared statement, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused about what you mean by "calling a prepared statement". The True here makes the statement preparable.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I am probably confused!

@TeofilC
Copy link
Contributor

TeofilC commented May 1, 2025

Is this ready to be merged @shane-circuithub ?

This requires the introduction of a new `Encoder` type with three members: `binary`, which is the Hasql binary encoder, `text` which encodes a type in PostgreSQL's text format (needed for nested arrays) and `quote`, which does the thing that the function we previously called `encode` does (i.e., `a -> Opaleye.PrimExpr`).

This will break any downstream code that uses a completely custom `DBType` implementation, but anything that uses `ReadShow`, `Enum`, `Composite`, `JSONBEncoded` or `parseTypeInformation` will continue working as before (which should cover all common cases).

I dropped support for `network-ip` instead of trying to figure out how to write binary and text encoders for it. We still support `iproute`.
@shane-circuithub shane-circuithub enabled auto-merge (squash) May 12, 2025 11:43
@shane-circuithub shane-circuithub merged commit 80a4449 into master May 12, 2025
2 checks passed
@shane-circuithub shane-circuithub deleted the prepared branch May 12, 2025 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants