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

represent slice of uints as hex string #25

Merged
merged 2 commits into from
Jan 31, 2025

Conversation

LukasJenicek
Copy link
Contributor

@LukasJenicek LukasJenicek commented Jan 17, 2025

Format:

  • []uint8 as hex
  • format time correct ISO
  • use single quotes where necessary to be compliant with postgres

Examples:

image

It can handle more complex queries now:

S args : 14 []interface {}
     0: 43113
     1: 0x5425890298aed601595a70ab815c96711a31bc65
     2: 2025-01-14 09:06:21.384727 +0000 UTC
     3: 6
     4: true
     5: <nil>
     6: 1
     7: 4
     8: https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png
     9: USD Coin
    10: false
    11: USDC
    12: 2025-01-17 17:03:59.614270958 +0000 UTC
    13: 4
  query: UPDATE currencies SET chain_id = 43113, contract_address = 0x5425890298aed601595a70ab815c96711a31bc65, created_at = '2025-01-14 09:06:21.384727', decimals = 6, default_chain_currency = true, deleted_at = NULL, exchange_rate = 1.000000, id = 4, image_url = 'https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png', name = 'USD Coin', native_currency = false, symbol = 'USDC', updated_at = '2025-01-17 17:03:59.614270' WHERE id = 4

Copy link
Member

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

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

Looks good. Minor suggestion, so we can copy/paste to psql

tracer/slog.go Outdated Show resolved Hide resolved
@LukasJenicek
Copy link
Contributor Author

Looks good. Minor suggestion, so we can copy/paste to psql

image

I've updated this acccordingly.

Copy link
Member

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Member

@david-littlefarmer david-littlefarmer left a comment

Choose a reason for hiding this comment

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

LGTM, just a note this is printing all []uint8 to hex string, but that shouldn't be an issue.

@VojtechVitek
Copy link
Member

@david-littlefarmer []uint8 in Go should be BYTEA in Postgres, so I think \x{DATA} is expected 👍

@VojtechVitek VojtechVitek merged commit 312c618 into goware:master Jan 31, 2025
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.

3 participants