|
|
@@ -35,7 +35,7 @@ type DataSync struct {
|
|
|
tokeyspace string
|
|
|
todc string
|
|
|
fromdata []string
|
|
|
- classmapping map[string]string
|
|
|
+ classmapping map[string][]string
|
|
|
datatimesince time.Duration
|
|
|
buckettimesince time.Duration
|
|
|
ctx context.Context
|
|
|
@@ -297,10 +297,13 @@ func (ds *DataSync) syncclassdata(cifrom *dbo.ClassInfoHelper, fields, condition
|
|
|
}
|
|
|
// 确定目标类已创建
|
|
|
toclass := ds.classmapping[cifrom.Fullname]
|
|
|
- if toclass == "" {
|
|
|
- toclass = cifrom.Fullname
|
|
|
+ if len(toclass) > 1 {
|
|
|
+ return merrs.New("datasync.mapping.class config error, should be map to one class only", []string{"fromclass", cifrom.Fullname, "toclass", fmt.Sprint(toclass)})
|
|
|
}
|
|
|
- cito, e := ds.assureToClass(toclass, cifrom)
|
|
|
+ if len(toclass) == 0 || toclass[0] == "" {
|
|
|
+ toclass = []string{cifrom.Fullname}
|
|
|
+ }
|
|
|
+ cito, e := ds.assureToClass(toclass[0], cifrom)
|
|
|
if e != nil {
|
|
|
return merrs.New(e)
|
|
|
}
|