Fix bug with cursors and multiple order by

This commit is contained in:
Vikram Rangnekar
2020-02-23 02:28:37 +05:30
parent d3ecb1d6cc
commit 7ec1f59224
5 changed files with 127 additions and 97 deletions

View File

@ -19,11 +19,13 @@ func cmdServ(cmd *cobra.Command, args []string) {
fatalInProd(err, "failed to connect to database")
}
initCrypto()
initCompiler()
initResolvers()
initAllowList(confPath)
initPreparedList(confPath)
if conf != nil && db != nil {
initCrypto()
initCompiler()
initResolvers()
initAllowList(confPath)
initPreparedList(confPath)
}
startHTTP()
}

View File

@ -36,15 +36,20 @@ func encryptCursor(qc *qcode.QCode, data []byte) ([]byte, error) {
continue
}
v, err := crypto.Encrypt(f.Value[1:len(f.Value)-1], &internalKey)
if err != nil {
return nil, err
}
var buf bytes.Buffer
buf.WriteByte('"')
buf.WriteString(base64.StdEncoding.EncodeToString(v))
buf.WriteByte('"')
if len(f.Value) > 2 {
v, err := crypto.Encrypt(f.Value[1:len(f.Value)-1], &internalKey)
if err != nil {
return nil, err
}
buf.WriteByte('"')
buf.WriteString(base64.StdEncoding.EncodeToString(v))
buf.WriteByte('"')
} else {
buf.WriteString(`null`)
}
to[i].Value = buf.Bytes()
}