如何在indexeddb中选择区间值? [重复]

问题描述 投票:0回答:0

我的数据结构是这样的:

[{
"IdFrete":7,
"Descricao":"Frete XYZ",
"PrazoEntrega":"(Até 10 dias)",
"DescricaoArea":"TO",
"CepInicio":77000000,
"CepFim":77999999,
"PesoIni":0,
"PesoFim":5000,
"Valor":80
},{
"IdFrete":7,
"Descricao":"Frete XYZ",
"PrazoEntrega":"(Até 10 dias)",
"DescricaoArea":"SP",
"CepInicio":1000000,
"CepFim":19999999,
"PesoIni":0,
"PesoFim":5000,
"Valor":80
}]

我需要根据 CepInicio 和 CepFim 的区间以及 PesoIni 和 PesoFim 的区间进行选择。 类似于 SQL: 从表中选择 *,其中 (CepInicio>=14100500 and CepFim <=14100500) and (PesoIni>=500 and PesoFim <=500)

我尝试创建数组索引:

tb.createIndex('searchFreteIdx', ['IdFrete', 'CepInicio', 'PesoIni', 'CepFim', 'PesoFim'], {unique:false,multiEntry: true});

但我认为那是错误的。并且找不到任何样本来构建这个索引

javascript indexeddb
© www.soinside.com 2019 - 2024. All rights reserved.