diff --git a/sdk/parse.go b/sdk/parse.go index 6faf43c..f75c55a 100644 --- a/sdk/parse.go +++ b/sdk/parse.go @@ -98,7 +98,7 @@ func parseRowsToXLSX(rows []interface{}, filename string) error { } // ParseRowsToCSV -func ParseRowsToCSV(rows []interface{}, filename string) error { +func parseRowsToCSV(rows []interface{}, filename string) error { // 首先,检查 rows 是否为空 if len(rows) == 0 { return errors.New("rows is empty") diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go index b9d2285..2d55033 100644 --- a/sdk/sdk_test.go +++ b/sdk/sdk_test.go @@ -34,7 +34,7 @@ func Test_ParseRowsToCSV(t *testing.T) { filename := "test.csv" - if err := ParseRowsToCSV(rows, filename); err != nil { + if err := parseRowsToCSV(rows, filename); err != nil { t.Error(err) } diff --git a/sdk/sync.go b/sdk/sync.go index 93a47bc..6980226 100644 --- a/sdk/sync.go +++ b/sdk/sync.go @@ -58,6 +58,11 @@ func (api *APIConfig) ParamEncode() string { return api.params.Encode() } +func SyncToCSV(fileName string, api APIConfig) (int64, error) { + mode := "csv" + return SyncToFile(mode, fileName, api) +} + func SyncToFile(mode string, fileName string, api APIConfig) (int64, error) { c := GetOpenAPIClient() api.SetDefault() @@ -75,7 +80,7 @@ func SyncToFile(mode string, fileName string, api APIConfig) (int64, error) { } switch mode { case "csv": - err = ParseRowsToCSV(rows, fileName) + err = parseRowsToCSV(rows, fileName) case "xlsx": err = parseRowsToXLSX(rows, fileName) default: