(rowCount int)
| 491 | } |
| 492 | |
| 493 | func createTablet(rowCount int) (*client.Tablet, error) { |
| 494 | tablet, err := client.NewTablet("root.ln.device1", []*client.MeasurementSchema{ |
| 495 | { |
| 496 | Measurement: "restart_count", |
| 497 | DataType: client.INT32, |
| 498 | }, { |
| 499 | Measurement: "price", |
| 500 | DataType: client.DOUBLE, |
| 501 | }, { |
| 502 | Measurement: "tick_count", |
| 503 | DataType: client.INT64, |
| 504 | }, { |
| 505 | Measurement: "temperature", |
| 506 | DataType: client.FLOAT, |
| 507 | }, { |
| 508 | Measurement: "description", |
| 509 | DataType: client.TEXT, |
| 510 | }, |
| 511 | { |
| 512 | Measurement: "status", |
| 513 | DataType: client.BOOLEAN, |
| 514 | }, |
| 515 | }, rowCount) |
| 516 | |
| 517 | if err != nil { |
| 518 | return nil, err |
| 519 | } |
| 520 | ts := time.Now().UTC().UnixNano() / 1000000 |
| 521 | for row := 0; row < int(rowCount); row++ { |
| 522 | ts++ |
| 523 | tablet.SetTimestamp(ts, row) |
| 524 | tablet.SetValueAt(rand.Int31(), 0, row) |
| 525 | if row%2 == 1 { |
| 526 | tablet.SetValueAt(rand.Float64(), 1, row) |
| 527 | } else { |
| 528 | tablet.SetValueAt(nil, 1, row) |
| 529 | } |
| 530 | tablet.SetValueAt(rand.Int63(), 2, row) |
| 531 | tablet.SetValueAt(rand.Float32(), 3, row) |
| 532 | tablet.SetValueAt(fmt.Sprintf("Test Device %d", row+1), 4, row) |
| 533 | tablet.SetValueAt(bool(ts%2 == 0), 5, row) |
| 534 | tablet.RowSize++ |
| 535 | } |
| 536 | return tablet, nil |
| 537 | } |
| 538 | |
| 539 | func insertTablets() { |
| 540 | tablet1, err := createTablet(8) |
no test coverage detected
searching dependent graphs…