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