mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-10 23:11:01 +00:00
add 732
This commit is contained in:
parent
4b0789ebf0
commit
f9944e6498
6 changed files with 182 additions and 2388 deletions
2
api.go
2
api.go
|
|
@ -1605,7 +1605,7 @@ func (api *API) TranslateKeys(ctx context.Context, r io.Reader) (_ []byte, err e
|
|||
} else {
|
||||
field := api.holder.Field(req.Index, req.Field)
|
||||
if field == nil {
|
||||
return nil, newNotFoundError(ErrFieldNotFound, req.Field)
|
||||
return nil, newNotFoundError(ErrFieldNotFound)
|
||||
}
|
||||
|
||||
if fi := field.ForeignIndex(); fi != "" {
|
||||
|
|
|
|||
|
|
@ -38,11 +38,12 @@ func _() {
|
|||
_ = x[apiFinishTransaction-27]
|
||||
_ = x[apiTransactions-28]
|
||||
_ = x[apiGetTransaction-29]
|
||||
_ = x[apiActiveQueries-30]
|
||||
}
|
||||
|
||||
const _apiMethod_name = "apiClusterMessageapiCreateFieldapiCreateIndexapiDeleteFieldapiDeleteAvailableShardapiDeleteIndexapiDeleteViewapiExportCSVapiFragmentBlockDataapiFragmentBlocksapiFragmentDataapiTranslateDataapiFieldapiFieldAttrDiffapiImportapiImportValueapiIndexapiIndexAttrDiffapiQueryapiRecalculateCachesapiRemoveNodeapiResizeAbortapiSetCoordinatorapiShardNodesapiViewsapiApplySchemaapiStartTransactionapiFinishTransactionapiTransactionsapiGetTransaction"
|
||||
const _apiMethod_name = "apiClusterMessageapiCreateFieldapiCreateIndexapiDeleteFieldapiDeleteAvailableShardapiDeleteIndexapiDeleteViewapiExportCSVapiFragmentBlockDataapiFragmentBlocksapiFragmentDataapiTranslateDataapiFieldapiFieldAttrDiffapiImportapiImportValueapiIndexapiIndexAttrDiffapiQueryapiRecalculateCachesapiRemoveNodeapiResizeAbortapiSetCoordinatorapiShardNodesapiViewsapiApplySchemaapiStartTransactionapiFinishTransactionapiTransactionsapiGetTransactionapiActiveQueries"
|
||||
|
||||
var _apiMethod_index = [...]uint16{0, 17, 31, 45, 59, 82, 96, 109, 121, 141, 158, 173, 189, 197, 213, 222, 236, 244, 260, 268, 288, 301, 315, 332, 345, 353, 367, 386, 406, 421, 438}
|
||||
var _apiMethod_index = [...]uint16{0, 17, 31, 45, 59, 82, 96, 109, 121, 141, 158, 173, 189, 197, 213, 222, 236, 244, 260, 268, 288, 301, 315, 332, 345, 353, 367, 386, 406, 421, 438, 454}
|
||||
|
||||
func (i apiMethod) String() string {
|
||||
if i < 0 || i >= apiMethod(len(_apiMethod_index)-1) {
|
||||
|
|
|
|||
|
|
@ -176,8 +176,6 @@ func (s *TranslateStore) TranslateKey(key string, writable bool) (uint64, error)
|
|||
ids, err := s.translateKeys([]string{key}, writable)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
} else if id != 0 {
|
||||
return id, nil
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
return 0, ErrTranslateKeyNotFound
|
||||
|
|
@ -189,6 +187,7 @@ func (s *TranslateStore) TranslateKey(key string, writable bool) (uint64, error)
|
|||
bkt := tx.Bucket([]byte("keys"))
|
||||
|
||||
var boltKey []byte
|
||||
var id uint64
|
||||
if id, boltKey = findIDByKey(bkt, key); id != 0 {
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4201,7 +4201,7 @@ func (e *executor) translateCall(ctx context.Context, indexName string, c *pql.C
|
|||
return errors.New("prev value must be a string when field 'keys' option enabled")
|
||||
}
|
||||
// TODO: does this need to take field.ForeignIndex() into consideration?
|
||||
id, err := e.Cluster.translateFieldKey(ctx, field, prevStr)
|
||||
id, err := e.Cluster.translateFieldKey(ctx, field, prevStr, writable)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "translating field key: %s", prevStr)
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -8,6 +8,7 @@ import (
|
|||
"os"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const endSymbol rune = 1114112
|
||||
|
|
@ -432,6 +433,12 @@ func (p *PQL) WriteSyntaxTree(w io.Writer) {
|
|||
p.tokens32.WriteSyntaxTree(w, p.Buffer)
|
||||
}
|
||||
|
||||
func (p *PQL) SprintSyntaxTree() string {
|
||||
var bldr strings.Builder
|
||||
p.WriteSyntaxTree(&bldr)
|
||||
return bldr.String()
|
||||
}
|
||||
|
||||
func (p *PQL) Execute() {
|
||||
buffer, _buffer, text, begin, end := p.Buffer, p.buffer, "", 0, 0
|
||||
for _, token := range p.Tokens() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue