in example/session_example.go [141:186]
func printDevice1(sds *client.SessionDataSet) {
showTimestamp := !sds.IsIgnoreTimeStamp()
if showTimestamp {
fmt.Print("Time\t\t\t\t")
}
for _, columnName := range sds.GetColumnNames() {
fmt.Printf("%s\t", columnName)
}
fmt.Println()
for next, err := sds.Next(); err == nil && next; next, err = sds.Next() {
if showTimestamp {
fmt.Printf("%s\t", sds.GetText(client.TimestampColumnName))
}
var restartCount int32
var price float64
var tickCount int64
var temperature float32
var description string
var status bool
// All of iotdb datatypes can be scan into string variables
// var restartCount string
// var price string
// var tickCount string
// var temperature string
// var description string
// var status string
if err := sds.Scan(&restartCount, &price, &tickCount, &temperature, &description, &status); err != nil {
log.Fatal(err)
}
whitespace := "\t\t"
fmt.Printf("%v%s", restartCount, whitespace)
fmt.Printf("%v%s", price, whitespace)
fmt.Printf("%v%s", tickCount, whitespace)
fmt.Printf("%v%s", temperature, whitespace)
fmt.Printf("%v%s", description, whitespace)
fmt.Printf("%v%s", status, whitespace)
fmt.Println()
}
}