model.go 437 B

12345678910111213141516171819202122
  1. package DB
  2. // BaseModel 普通表基类 — 嵌入后自动获得 _id 主键
  3. //
  4. // type User struct {
  5. // DB.BaseModel
  6. // Name string `tsdb:"32byte"`
  7. // Age int
  8. // }
  9. type BaseModel struct {
  10. ID uint64 `tsdb:"_id"`
  11. }
  12. // TimeSeriesModel 时序表基类 — 嵌入后自动获得 _ts 主键
  13. //
  14. // type Sensor struct {
  15. // DB.TimeSeriesModel
  16. // Value float64
  17. // }
  18. type TimeSeriesModel struct {
  19. TS uint64 `tsdb:"_ts"`
  20. }