Compare commits
No commits in common. "fdb66f92f5236f61ff5d47dd1eb24285e1cf6a60" and "9b9eadfe92cbea4e8277e3b31d68b815cb561330" have entirely different histories.
fdb66f92f5
...
9b9eadfe92
@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
|
||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
@ -23,14 +22,12 @@ func (c *CsvExporter) Convert(filePath string, rows chan []any) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
buf := bufio.NewWriterSize(f, 4*1024*1024)
|
|
||||||
|
|
||||||
enc, err := c.Encoding.Encoder()
|
enc, err := c.Encoding.Encoder()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
w := csv.NewWriter(enc.Writer(buf))
|
w := csv.NewWriter(enc.Writer(f))
|
||||||
w.Comma = ';'
|
w.Comma = ';'
|
||||||
|
|
||||||
rowNum := 0
|
rowNum := 0
|
||||||
@ -54,12 +51,6 @@ func (c *CsvExporter) Convert(filePath string, rows chan []any) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = buf.Flush()
|
|
||||||
if err != nil {
|
|
||||||
f.Close()
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = f.Close()
|
err = f.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"archive/zip"
|
"archive/zip"
|
||||||
"bufio"
|
|
||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -23,9 +22,7 @@ func (c *CsvZipExporter) Convert(filePath string, rows chan []any) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
buf := bufio.NewWriterSize(f, 4*1024*1024)
|
z := zip.NewWriter(f)
|
||||||
|
|
||||||
z := zip.NewWriter(buf)
|
|
||||||
|
|
||||||
zw, err := z.Create(filepath.Base(filePath) + ".csv")
|
zw, err := z.Create(filepath.Base(filePath) + ".csv")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -68,12 +65,6 @@ func (c *CsvZipExporter) Convert(filePath string, rows chan []any) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = buf.Flush()
|
|
||||||
if err != nil {
|
|
||||||
f.Close()
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = f.Close()
|
err = f.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -25,7 +25,6 @@ type Job struct {
|
|||||||
scriptFilePath string
|
scriptFilePath string
|
||||||
exportFileFormat ExportFormat
|
exportFileFormat ExportFormat
|
||||||
encoding Encoding
|
encoding Encoding
|
||||||
exportPath string
|
|
||||||
|
|
||||||
config Config
|
config Config
|
||||||
|
|
||||||
@ -73,7 +72,7 @@ func (j *Job) export(inputRows chan Row) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fileName := filepath.Join(j.exportPath, filepath.Base(j.scriptFilePath))
|
fileName := filepath.Base(j.scriptFilePath)
|
||||||
fileName = strings.TrimSuffix(fileName, filepath.Ext(fileName))
|
fileName = strings.TrimSuffix(fileName, filepath.Ext(fileName))
|
||||||
|
|
||||||
outputRows := make(chan []any)
|
outputRows := make(chan []any)
|
||||||
|
@ -33,8 +33,6 @@ type TMainForm struct {
|
|||||||
ExportFormatComboBox *vcl.TComboBox
|
ExportFormatComboBox *vcl.TComboBox
|
||||||
CharsetLabel *vcl.TLabel
|
CharsetLabel *vcl.TLabel
|
||||||
CharsetComboBox *vcl.TComboBox
|
CharsetComboBox *vcl.TComboBox
|
||||||
ExportPathLabel *vcl.TLabel
|
|
||||||
ExportPathPicker *vcl.TDirectoryEdit
|
|
||||||
BottomPanel *vcl.TPanel
|
BottomPanel *vcl.TPanel
|
||||||
LaunchButton *vcl.TBitBtn
|
LaunchButton *vcl.TBitBtn
|
||||||
|
|
||||||
@ -159,24 +157,6 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
|
|||||||
f.CharsetComboBox.SetTop(700)
|
f.CharsetComboBox.SetTop(700)
|
||||||
f.CharsetComboBox.SetStyle(types.CsDropDownList)
|
f.CharsetComboBox.SetStyle(types.CsDropDownList)
|
||||||
|
|
||||||
f.ExportPathLabel = vcl.NewLabel(f)
|
|
||||||
f.ExportPathLabel.SetParent(f.GroupBox)
|
|
||||||
f.ExportPathLabel.SetCaption("Путь сохранения результата")
|
|
||||||
f.ExportPathLabel.SetAlign(types.AlTop)
|
|
||||||
f.ExportPathLabel.SetTop(800)
|
|
||||||
f.ExportPathLabel.BorderSpacing().SetTop(8)
|
|
||||||
f.ExportPathLabel.BorderSpacing().SetLeft(8)
|
|
||||||
f.ExportPathLabel.BorderSpacing().SetRight(8)
|
|
||||||
|
|
||||||
f.ExportPathPicker = vcl.NewDirectoryEdit(f)
|
|
||||||
f.ExportPathPicker.SetParent(f.GroupBox)
|
|
||||||
f.ExportPathPicker.SetAlign(types.AlTop)
|
|
||||||
f.ExportPathPicker.BorderSpacing().SetTop(2)
|
|
||||||
f.ExportPathPicker.BorderSpacing().SetLeft(8)
|
|
||||||
f.ExportPathPicker.BorderSpacing().SetRight(8)
|
|
||||||
f.ExportPathPicker.SetTop(900)
|
|
||||||
f.ExportPathPicker.SetFlat(true)
|
|
||||||
|
|
||||||
f.BottomPanel = vcl.NewPanel(f)
|
f.BottomPanel = vcl.NewPanel(f)
|
||||||
f.BottomPanel.SetParent(f.TabSheet1)
|
f.BottomPanel.SetParent(f.TabSheet1)
|
||||||
f.BottomPanel.SetAlign(types.AlBottom)
|
f.BottomPanel.SetAlign(types.AlBottom)
|
||||||
@ -278,8 +258,7 @@ func (f *TMainForm) OnLaunchButtonClick(sender vcl.IObject) {
|
|||||||
configFilePath: filepath.Join(CONFIG_FILES_DIR, f.ConfigComboBox.Text()) + "." + CONFIG_FILE_EXT,
|
configFilePath: filepath.Join(CONFIG_FILES_DIR, f.ConfigComboBox.Text()) + "." + CONFIG_FILE_EXT,
|
||||||
scriptFilePath: filepath.Join(SQL_FILES_DIR, f.SqlFileComboBox.Text()) + "." + SQL_FILE_EXT,
|
scriptFilePath: filepath.Join(SQL_FILES_DIR, f.SqlFileComboBox.Text()) + "." + SQL_FILE_EXT,
|
||||||
exportFileFormat: ExportFormat(f.ExportFormatComboBox.Text()),
|
exportFileFormat: ExportFormat(f.ExportFormatComboBox.Text()),
|
||||||
encoding: Encoding(f.CharsetComboBox.Text()),
|
encoding: Encoding(f.CharsetComboBox.Text())}
|
||||||
exportPath: f.ExportPathPicker.Directory()}
|
|
||||||
|
|
||||||
err := job.init()
|
err := job.init()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user