wip: fix size = 0 error
This commit is contained in:
@ -6,13 +6,14 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/loveuer/esgo2dump/log"
|
||||
"github.com/loveuer/esgo2dump/model"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/loveuer/esgo2dump/log"
|
||||
"github.com/loveuer/esgo2dump/model"
|
||||
|
||||
"github.com/loveuer/esgo2dump/internal/interfaces"
|
||||
"github.com/loveuer/esgo2dump/internal/opt"
|
||||
"github.com/loveuer/esgo2dump/internal/xes"
|
||||
@ -24,7 +25,7 @@ import (
|
||||
func check(cmd *cobra.Command) error {
|
||||
if f_input == "" {
|
||||
return cmd.Help()
|
||||
//return fmt.Errorf("must specify input(example: data.json/http://127.0.0.1:9200/my_index)")
|
||||
// return fmt.Errorf("must specify input(example: data.json/http://127.0.0.1:9200/my_index)")
|
||||
}
|
||||
|
||||
if f_limit == 0 || f_limit > 10000 {
|
||||
@ -148,9 +149,7 @@ func executeData(ctx context.Context, input, output interfaces.DumpIO) error {
|
||||
}
|
||||
|
||||
if f_query_file != "" {
|
||||
var (
|
||||
qf *os.File
|
||||
)
|
||||
var qf *os.File
|
||||
|
||||
if qf, err = os.Open(f_query_file); err != nil {
|
||||
return fmt.Errorf("open query_file err=%v", err)
|
||||
@ -208,10 +207,10 @@ func executeData(ctx context.Context, input, output interfaces.DumpIO) error {
|
||||
log.Info("Query: got queries=%d", len(queries))
|
||||
|
||||
Loop:
|
||||
for qi, query := range queries {
|
||||
for queryIdx, query := range queries {
|
||||
bs, _ := json.Marshal(query)
|
||||
|
||||
log.Debug("Query[%d]: %s", qi, string(bs))
|
||||
log.Debug("Query[%d]: %s", queryIdx, string(bs))
|
||||
|
||||
dch, ech = input.ReadData(ctx, f_limit, query, sources, []string{f_sort})
|
||||
|
||||
@ -294,7 +293,7 @@ ClientByFile:
|
||||
}
|
||||
}
|
||||
|
||||
if file, err = os.OpenFile(source, os.O_CREATE|os.O_RDWR, 0644); err != nil {
|
||||
if file, err = os.OpenFile(source, os.O_CREATE|os.O_RDWR, 0o644); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user