package main import ( "fmt" "time" "git.wecise.com/wecise/cgimport/importer" "git.wecise.com/wecise/cgimport/odbc" ) // 获取配置信息 // // 默认配置: // 当前工作目录下 与应用同名的 .conf 文件 // 环境变量 // 命令行参数 var mcfg = odbc.Config var logger = odbc.Logger func main() { // 开始计时 st := time.Now() // 配置参数 // 文件目录 datapath := mcfg.GetString("datapath", "data") // 并发数 parallel := mcfg.GetInt("parallel", 10) // 导入 filescount, recordscount, e := importer.ImportDir(datapath, parallel) if e != nil { panic(e) } if filescount == 0 { fmt.Println(`not found data files in "` + datapath + `"`) return } // 输出统计信息 fmt.Println("total import", filescount, "files", recordscount, "records", "in", time.Since(st)) fmt.Println("access", odbc.LogFile, "for detail information") }