Fork me on GitHub
#sql
<
2019-11-09
>
seancorfield00:11:58

Well, it's definitely an "adapter" of some sort, since it takes a builder and returns a new builder. The current adapters are as-maps-adapter and as-arrays-adapter and those have the map/array logic built-in (as well as simply wrapping/delegating everything except with-column -- that's the behavior they "adapt"). I guess this is sort of an interceptor-adapter in that sense (of "hooks") but it doesn't actually change the behavior of the wrapped adapter -- beyond optionally calling side-effecting functions at certain points.

seancorfield00:11:02

Names are hard.

dcj01:11:49

AFAIK, middleware/interceptors can alter the inputs and/or outputs? My connotation of hooks is that they are triggered by things, but don’t alter the thing itself. Maybe I am wrong about that... https://en.wikipedia.org/wiki/Hooking https://stackoverflow.com/questions/467557/what-is-meant-by-the-term-hook-in-programming

seancorfield01:11:22

@dcj Thanks. Yeah. Interceptor isn't really right either. And it's not really middleware (although that introduces some interesting possibilities if I went in that direction instead).

dcj01:11:23

add-builder-hookfns 🙂

seancorfield01:11:02

I may yet go for something more middleware-like, rather than just part of the builder machinery, since that would also let you do timings. When I started out down this path this morning, I was thinking more of a "wrapper" namespace, and one of the "problems" I want to solve is to provide some relatively clean, simple way to do something that would allow default options to be provided across the whole API.

seancorfield01:11:04

The builder wrapper/adapter/hooker(!) is the only way to "get at" each row as it is built, but maybe that's not important...

dharrigan12:11:42

Hi @seancorfield, any chance of cutting a new release that includes the updated dep on java.data?

dharrigan12:11:16

oh, and good point about the unqualified names! 🙂

dharrigan12:11:21

I didn't think about that one!

seancorfield18:11:26

@dharrigan as soon as I've decided how to proceed with the middleware/hook thing and documented that. So, "soon".

seancorfield18:11:37

You can always add an explicit dep on the most recent java.data to solve the reflection stuff etc for the time being.

Darrell21:11:37

(apologies if this isn’t the right channel for this particular question) I’m running a test and getting the following error when I do:

org.postgresql.util.PSQLException: ERROR: null value in column "alliance_id" violates not-null constraint
  Detail: Failing row contains (7, null, 32, 2).
However, I’ve removed every reference to alliance_id in that test file. I’m guessing that a call to a function in another file is what is causing this problem. I’m looking at the stacktrace provided but I’m not seeing anything that points to what file may be causing the error. Is there something else I can do that will help inform where the problem lies?

seancorfield23:11:34

@darrell You'll need to provide us with a lot more information for us to be able to help. Based on just that error, I'd say you're trying to insert a row into a database table that has a column called alliance_id that column is declared not null. So either it's the second column (where you're passing nil) or its another column that you're not even trying to insert a value into.

seancorfield23:11:50

What does your insert code look like and what is the table structure?