misc #4
|
@ -59,7 +59,7 @@
|
||||||
Value: Array.isArray(change[3]) ? btoa(String.fromCharCode.apply(null, change[3])) : btoa(change[3]),
|
Value: Array.isArray(change[3]) ? btoa(String.fromCharCode.apply(null, change[3])) : btoa(change[3]),
|
||||||
ColVersion: Number(change[4]),
|
ColVersion: Number(change[4]),
|
||||||
DBVersion: Number(change[5]),
|
DBVersion: Number(change[5]),
|
||||||
SiteID: Array.isArray(change[6]) ? arrayBufferToBase64(Uint8Array.from(change[6]).buffer) : btoa(change[6]),
|
SiteID: Array.isArray(change[6]) ? btoa(new TextDecoder('utf8').decode(change[6])) : btoa(change[6]),
|
||||||
CL: Number(change[7]),
|
CL: Number(change[7]),
|
||||||
Seq: Number(change[8])
|
Seq: Number(change[8])
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -80,7 +80,7 @@ type CRSQLChange struct {
|
||||||
Value []byte
|
Value []byte
|
||||||
ColVersion int64
|
ColVersion int64
|
||||||
DBVersion int64
|
DBVersion int64
|
||||||
SiteID []byte
|
SiteID []int
|
||||||
CL int64
|
CL int64
|
||||||
Seq int64
|
Seq int64
|
||||||
}
|
}
|
||||||
|
@ -108,8 +108,8 @@ func mapToCRSQLChange(m map[string]interface{}) (CRSQLChange, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return change, err
|
return change, err
|
||||||
}
|
}
|
||||||
//change.SiteID, err = decodeBase64ToIntArray(m["SiteID"].(string))
|
change.SiteID, err = decodeBase64ToIntArray(string(m["SiteID"].(string)))
|
||||||
change.SiteID, err = base64.URLEncoding.DecodeString(m["SiteID"].(string))
|
fmt.Println(change.SiteID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return change, err
|
return change, err
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ func applyChanges(changes []interface{}) {
|
||||||
log.Println("Error inserting change:", err)
|
log.Println("Error inserting change:", err)
|
||||||
}
|
}
|
||||||
log.Println("We inserted data successfully??")
|
log.Println("We inserted data successfully??")
|
||||||
printChange(change)
|
fmt.Println(c)
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Not OK to convert change")
|
fmt.Println("Not OK to convert change")
|
||||||
fmt.Println("Change look like:")
|
fmt.Println("Change look like:")
|
||||||
|
|
Loading…
Reference in a new issue