ClickHouse / ClickHouse/ch-go

[QUESTION] How to call AppendKV when ColMap is wrapped in an array

Open
#412 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
428
Forks
84
Avg merge
9d 6h
Merged PRs (30d)
4

Description

Hello!
Thank you for the wonderful library.

Could you please help me? I want to call the method `AppendKV` for `ColMap` that is wrapped inside a `ColArr`. My goal is to set a specific order of keys in each of these maps.

Here is an example of what I'm trying to achieve:
```go
eventsAttr := proto.NewArray(
proto.NewMap[string, string](
new(proto.ColStr).LowCardinality(),
new(proto.ColStr),
),
)

eventsAttrArr := make([][]proto.KV[string, string], 0, len(events))
eventsAttrArr = append(eventsAttrArr, []proto.KV[string, string]{
{Key: "one", Value: "specific"},
{Key: "two", Value: "order"},
})

eventsAttrArr = append(eventsAttrArr, []proto.KV[string, string]{
{Key: "one", Value: "totally"},
{Key: "two", Value: "specific"},
{Key: "three", Value: "order"},
})

// somehow add all eventsAttrArr to eventsAttr (?)
```

Could you provide an example of how this can be done?

Thank you in advance for your assistance!

P.S.
Is it maybe possible to achieve this using `*proto.ColArr[[]proto.KV]`? Will it serialize correctly to `Array(Map(LowCardinality(String), String))`?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.