Skip to content

Add Inline query + args print #1267

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

cynsupercat
Copy link

Attempt at #499

It works well with non Null types but unfortunately Null types will always output their valid values like so:

"INSERT INTO \"rockets\" (\"id\",\"name\",\"model\",\"launched\",\"launch_date\",\"data\") VALUES ('1c309a44-c3b6-4924-b5b4-57532cff1c1f',{bunpollo 13 true},{1 true},{true true},{2023-04-10 02:59:16.207365677 +0000 UTC m=+9.860239922 true},{[123 34 100 97 116 97 34 58 34 116 101 115 116 34 125] true})"

From a personal standpoint, this is an improvement to current logging so I'm happy with this, but this might be a naive approach so any suggestions welcome.

@stephenafamo
Copy link
Collaborator

To handle database values, you can try to use the Value method which is likely available on types meant for database/sql

However, this will be a breaking change so I am unlikely to merge this anyway. If there is a way to make this behaviour opt-in, then maybe.

@cynsupercat
Copy link
Author

@stephenafamo I suppose you could do an opt in using a func (writer, query, args) global variable in debug.go to override during logging if it's not nil?

@stephenafamo
Copy link
Collaborator

I suppose that could work. While I like to avoid globals, this may be the best way to avoid breaking changes.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants