go-gorm / clickhouse

GORM clickhouse driver
MIT License
243 stars 71 forks source link

保存到ck表中后,列和值错乱 #61

Open wl506 opened 1 year ago

wl506 commented 1 year ago
type SubProperties struct {
    ID       string
    Contract string
    Type     string
    Name     string
}

type Properties struct {
    Channel string
    SubProperties
}

p := Properties{
    Channel: "aaaa",
    SubProperties: SubProperties{
        ID:       "ID3333",
        Contract: "c3",
        Type:     "ty3",
        Name:     "n3",
    },
}

Db.Table(strings.ToUpper(p.Channel) + "Attr").Create(p.SubProperties)

保存后 ID值为c3, Contract为ty3, Type为n3,Name为ID3333

当前版本0.5.0

表结构 CREATE TABLE FFAttr ( id String, contract String, type String, name String ) ENGINE = MergeTree PRIMARY KEY (contract, type) ORDER BY (contract, type)

The document you expected this should be explained

Expected answer

wl506 commented 1 year ago

把SubProperties里的ID去掉就正常了~