Open exfly opened 8 months ago
temp workaround:
rawDB, err := gorm.Open(clickhouse.Open(dsn), &gorm.Config{
QueryFields: true,
})
In addition, if you want to use the array, you can consider the following custom types:
type StringArray []string
func (a *StringArray) Scan(value interface{}) error {
*a, _ = value.([]string)
return nil
}
func (a StringArray) Value() (driver.Value, error) {
val, err := json.Marshal([]string(a))
if err != nil {
return nil, err
}
return val, nil
}
type User struct {
Uniqid uint8 `gorm:"column:col1"`
Name string `gorm:"column:col2"`
Tags StringArray
}
你的可以用?dsn := "clickhouse://username:pwd#@host:9000/database?dial_timeout=10s&read_timeout=20s" rawDB, err := gorm.Open(clickhouse.Open(dsn), &gorm.Config{}) if err != nil { fmt.Print("failed to connect database") } fmt.Print(rawDB)为啥 就这两行 都链接不上啊,官方的就行 他娘嘞 处死后 都错误 failed to initialize database,
GORM Playground Link
https://github.com/go-gorm/playground/pull/1
Description