go-gorm / clickhouse

GORM clickhouse driver
MIT License
244 stars 72 forks source link

Support maps fields #180

Closed roarc0 closed 3 months ago

roarc0 commented 3 months ago

Describe the feature

Support maps fields

Motivation

I have a model containing a map[string]string field but got an error while trying to insert it. are specific struct tags needed or is it actually unsupported?

This field is supported by clickhouse since I successfully used it using the sql driver directly. data-type/map

[error] unsupported data type: &map[]
2024-06-03 13:51:20 ERR Failed to **** logs error="unsupported data type: &map[]: Table not set, please set it like: db.Model(&user) or db.Table(\"users\")"
2024-06-03 13:51:20 ERR Error storing record(s) error="unsupported data type: &map[]: Table not set, please set it like: db.Model(&user) or db.Table(\"users\")"
2024-06-03 13:51:20 DBG Closing partition consumer partition=0 topic=sessioncounter
panic: unsupported data type: &map[]: Table not set, please set it like: db.Model(&user) or db.Table("users")

Related Issues

none.

roarc0 commented 3 months ago

I made it work with this:

    Parameters     map[string]string `gorm:"type:Map(String,String)"`
7978178 commented 1 month ago

how do you insert data. i'm having trouble with it though it's able to create the tables...