add test db

This commit is contained in:
w1ndyb0y
2020-12-21 11:36:08 +08:00
parent 787a949428
commit 8e417699c0
7 changed files with 31 additions and 3 deletions
+5
View File
@@ -29,6 +29,9 @@ var (
baudrate int
bytesize byte
dbFile string
dbInit bool
// rootCmd represents the base command when called without any subcommands
rootCmd = &cobra.Command{
Use: "tele-recv",
@@ -90,5 +93,7 @@ func initConfig() {
device = viper.GetString("serial.device")
baudrate = viper.GetInt("serial.baudrate")
bytesize = byte(viper.GetInt("serial.bytesize"))
dbFile = viper.GetString("sqlite.file")
dbInit = viper.GetBool("sqlite.init")
}
}
+3
View File
@@ -20,6 +20,7 @@ import (
"github.com/spf13/cobra"
"github.com/tarm/serial"
"os"
"it2000.com.cn/tele-recv/database"
)
// testCmd represents the test command
@@ -39,6 +40,8 @@ Test serial port`,
}
fmt.Println(c , "opened")
_ = s.Close()
database.Init(dbFile, dbInit)
},
}