GreptimeTeam / greptimedb-ingester-go

A Go ingester for GreptimeDB, which is compatible with GreptimeDB protocol and lightweight.
Apache License 2.0
15 stars 5 forks source link

Implement greptime: "-", ignore struct field #54

Open adminpass opened 3 days ago

adminpass commented 3 days ago
type Electric struct {
    ID       int64     `gorm:"id" greptime:"-"`
    DataTime time.Time `gorm:"data_time;primaryKey" greptime:"timestamp;column:data_time;type:timestamp;precision:second"`
    DeviceNo string    `gorm:"device_no;primaryKey" greptime:"tag;column:device_no;type:string"`
    Value    float32   `gorm:"value" greptime:"field;column:value;type:float32"`
}

use gorm to query data, ignore ID when writing to greptimedb

daviderli614 commented 3 days ago

Do you want to ignore the fields marked with - when writing data? @adminpass

adminpass commented 2 days ago

@daviderli614 yes, use greptime:"-"