fukamachi / lack

Lack, the core of Clack
MIT License
156 stars 33 forks source link

Hoist dbi sql queries into configurable parameters #92

Closed mavericksy closed 4 months ago

mavericksy commented 4 months ago

The sql queries in the DBI store are not accessible and enforce the structure of the database table for sessions. This PR hoists the queries into package local parameters and allows them to be configured via &key function parameters to DBI. ie. 2024-07-13_13-48

fukamachi commented 4 months ago

What do you need it for? It's too low-level to give users access since it's not a kind of parameter that must be configured for each application.

mavericksy commented 4 months ago

In one instance the sessions table already exists and lack needs to conform to the already created table. Another instance is the sessions are handled by functions in the DB, so direct SQL queries will not work to handle the sessions table.

mavericksy commented 4 months ago

BTW the queries have defaults. Queries do not have to be setup to use the session dbi. The original queries will be honoured and used

fukamachi commented 4 months ago

I see your point. You have a session table with slightly different structures and want to customize the queries thrown in the code. However, I still don't think it's difficult for other users to use, in the sense that it must be a format-control string that takes arguments in the exact same order. How about simply adding parameters of the column names (id, session_data) to access?

mavericksy commented 4 months ago

I see your point. You have a session table with slightly different structures and want to customize the queries thrown in the code. However, I still don't think it's difficult for other users to use, in the sense that it must be a format-control string that takes arguments in the exact same order. How about simply adding parameters of the column names (id, session_data) to access?

Ok, just controlling and being able to change the column names will be safer and easier to use. Will update PR soon.

mavericksy commented 4 months ago

Changed format strings to accept dbi-store configurable column names. Just as table_name is used, so are session_data and id. Added README as well

fukamachi commented 4 months ago

Thanks!