clickhouse-go icon indicating copy to clipboard operation
clickhouse-go copied to clipboard

IPv6 column to be mapped from []uint8

Open lspgn opened this issue 2 years ago • 4 comments

Hello! Thank you for this great library!

Is your feature request related to a problem? Please describe.

I am trying to insert data into an IPv6 column. The real type is a FixedString(16) inside ClickHouse. The Append function of the library requires the underlying type to be:

  • string
  • netip.Addr
  • net.IP

I would prefer to avoid manipulating my array and insert the data directly.

Describe the solution you'd like

When looking at the IPv4 column, there is a way to pass a uint32 https://github.com/ClickHouse/clickhouse-go/blob/558434c679185cbf403018ebd6c74748d846343b/lib/column/ipv4.go#L74

(this was added with #966)

For IPv6, strings are currently parsed and then the bytes are inserted. I would like to be able to pass a [16]byte or a []uint8 (byte array).

Describe alternatives you've considered

Ended up using netip.AddrFrom16() but I'd like to avoid a cast or pass a pointer to the byte array I already have.

lspgn avatar Apr 20 '23 04:04 lspgn

Hi @lspgn

Thanks for this request. This will likely not be a priority for me to implement in the upcoming weeks. If someone from the community wants to work on it - I am happy to merge PR.

jkaflik avatar Apr 24 '23 05:04 jkaflik

@jkaflik this issue have been solved.

rogeryk avatar Feb 27 '24 13:02 rogeryk

@jkaflik Looking through good first issues and this looks like it can be closed.

gogingersnap777 avatar May 30 '24 00:05 gogingersnap777