Skip to content

Commit bef9712

Browse files
committed
feat: remane blake3 field to b3
1 parent 35f7ad5 commit bef9712

File tree

5 files changed

+25
-24
lines changed

5 files changed

+25
-24
lines changed

src/blake3/functions.sql

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,22 @@
44

55
-- extracts blake3 index from a jsonb value
66

7+
78
CREATE FUNCTION eql_v2.blake3(val jsonb)
89
RETURNS eql_v2.blake3
910
IMMUTABLE STRICT PARALLEL SAFE
1011
AS $$
1112
BEGIN
1213

13-
IF NOT (val ? 'b') NULL THEN
14-
RAISE 'Expected a blake3 index (b) value in json: %', val;
14+
IF NOT (val ? 'b3') NULL THEN
15+
RAISE 'Expected a blake3 index (b3) value in json: %', val;
1516
END IF;
1617

17-
IF val->>'b' IS NULL THEN
18+
IF val->>'b3' IS NULL THEN
1819
RETURN NULL;
1920
END IF;
2021

21-
RETURN val->>'b';
22+
RETURN val->>'b3';
2223
END;
2324
$$ LANGUAGE plpgsql;
2425

src/operators/->.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
-- - ore_cllw_var_8
1414
--
1515
-- {
16-
-- "sv": [ {"c": "", "s": "", "b": "" } ]
16+
-- "sv": [ {"c": "", "s": "", "b3": "" } ]
1717
-- }
1818
--
1919

src/operators/<>_test.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ DECLARE
7777
BEGIN
7878

7979
for i in 1..3 loop
80-
e := create_encrypted_json(i, 'b');
80+
e := create_encrypted_json(i, 'b3');
8181

8282
PERFORM assert_result(
8383
format('eql_v2_encrypted <> eql_v2_encrypted with blake3 index term %s of 3', i),
@@ -86,7 +86,7 @@ DECLARE
8686
end loop;
8787

8888
-- remove the ore index term
89-
e := create_encrypted_json(91347, 'b');
89+
e := create_encrypted_json(91347, 'b3');
9090

9191
PERFORM assert_no_result(
9292
'eql_v2_encrypted <> eql_v2_encrypted with no matching record',
@@ -107,15 +107,15 @@ DECLARE
107107
BEGIN
108108

109109
for i in 1..3 loop
110-
e := create_encrypted_json(i, 'b');
110+
e := create_encrypted_json(i, 'b3');
111111

112112
PERFORM assert_result(
113113
format('eql_v2.neq(eql_v2_encrypted, eql_v2_encrypted) with unique index term %s of 3', i),
114114
format('SELECT e FROM encrypted WHERE eql_v2.neq(e, %L);', e));
115115
end loop;
116116

117117
-- remove the ore index term
118-
e := create_encrypted_json(91347, 'b');
118+
e := create_encrypted_json(91347, 'b3');
119119

120120
PERFORM assert_no_result(
121121
'eql_v2.neq(eql_v2_encrypted, eql_v2_encrypted) with no matching record',
@@ -137,7 +137,7 @@ DECLARE
137137
for i in 1..3 loop
138138

139139
-- remove the default
140-
e := create_encrypted_json(i, 'b');
140+
e := create_encrypted_json(i, 'b3');
141141

142142
PERFORM assert_result(
143143
format('eql_v2_encrypted = jsonb with unique index term %s of 3', i),
@@ -148,7 +148,7 @@ DECLARE
148148
format('SELECT e FROM encrypted WHERE %L::jsonb = e', e));
149149
end loop;
150150

151-
e := create_encrypted_json(91347, 'b');
151+
e := create_encrypted_json(91347, 'b3');
152152

153153
PERFORM assert_no_result(
154154
'eql_v2_encrypted = jsonb with no matching record',

src/operators/=_test.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ DECLARE
108108
BEGIN
109109

110110
for i in 1..3 loop
111-
e := create_encrypted_json(i, 'b');
111+
e := create_encrypted_json(i, 'b3');
112112

113113
PERFORM assert_result(
114114
format('eql_v2_encrypted = eql_v2_encrypted with unique index term %s of 3', i),
@@ -117,7 +117,7 @@ DECLARE
117117
end loop;
118118

119119
-- remove the ore index term
120-
e := create_encrypted_json(91347, 'b');
120+
e := create_encrypted_json(91347, 'b3');
121121

122122
PERFORM assert_no_result(
123123
'eql_v2_encrypted = eql_v2_encrypted with no matching record',
@@ -138,15 +138,15 @@ DECLARE
138138
BEGIN
139139

140140
for i in 1..3 loop
141-
e := create_encrypted_json(i, 'b');
141+
e := create_encrypted_json(i, 'b3');
142142

143143
PERFORM assert_result(
144144
format('eql_v2.eq(eql_v2_encrypted, eql_v2_encrypted) with unique index term %s of 3', i),
145145
format('SELECT e FROM encrypted WHERE eql_v2.eq(e, %L);', e));
146146
end loop;
147147

148148
-- remove the ore index term
149-
e := create_encrypted_json(91347, 'b');
149+
e := create_encrypted_json(91347, 'b3');
150150

151151
PERFORM assert_no_result(
152152
'eql_v2.eq(eql_v2_encrypted, eql_v2_encrypted) with no matching record',
@@ -168,7 +168,7 @@ DECLARE
168168
for i in 1..3 loop
169169

170170
-- remove the default
171-
e := create_encrypted_json(i, 'b');
171+
e := create_encrypted_json(i, 'b3');
172172

173173
PERFORM assert_result(
174174
format('eql_v2_encrypted = jsonb with unique index term %s of 3', i),
@@ -179,7 +179,7 @@ DECLARE
179179
format('SELECT e FROM encrypted WHERE %L::jsonb = e', e));
180180
end loop;
181181

182-
e := create_encrypted_json(91347, 'b');
182+
e := create_encrypted_json(91347, 'b3');
183183

184184
PERFORM assert_no_result(
185185
'eql_v2_encrypted = jsonb with no matching record',

tests/test_helpers.sql

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ AS $$
4747
RETURN '{
4848
"sv": [
4949
{
50-
"b": "7b4ffe5d60e4e4300dc3e28d9c300c87",
50+
"b3": "7b4ffe5d60e4e4300dc3e28d9c300c87",
5151
"c": "mBbLGB9xHAGzLvUj-`@Wmf=IhD87n7r3ir3n!Sk6AKir_YawR=0c>pk(OydB;ntIEXK~c>V&4>)rNkf<JN7fmlO)c^iBv;-X0+3XyK5d`&&I-oeIEOcwPf<3zy",
5252
"s": "bca213de9ccce676fa849ff9c4807963"
5353
},
@@ -76,7 +76,7 @@ AS $$
7676
RETURN '{
7777
"sv": [
7878
{
79-
"b": "7b4ffe5d60e4e4300dc3e28d9c300c87",
79+
"b3": "7b4ffe5d60e4e4300dc3e28d9c300c87",
8080
"c": "mBbJ`WPCW@ifNK3@++t4I%$E#DC8yBXbTwDs-nff1*Ug?f<icvvAaiqXfmPqD#S)r*2IUxCWIn{^28wV{TP}lqWol}K{;1%c;CDw21Y#EyOWiy884b7XQ@e`zy",
8181
"s": "bca213de9ccce676fa849ff9c4807963"
8282
},
@@ -108,7 +108,7 @@ $$ LANGUAGE plpgsql;
108108

109109
-- ORIGINAL $.a encoding
110110
-- {
111-
-- "b": "8258356162d2415d55244abf49e40da3",
111+
-- "b3": "8258356162d2415d55244abf49e40da3",
112112
-- "c": "mBbL9j9(QoRD)R+z?=Fvn#=FR9iI)K4Nzk-ea`~#Lx@wBSDPSmkp-h+tNEHoo@T@#vwh?Ejvk%78G}b+je+xufQA5mSwHSid)iEOkg@>mpuh",
113113
-- "s": "f510853730e1c3dbd31b86963f029dd5"
114114
-- },
@@ -121,7 +121,7 @@ AS $$
121121
RETURN '{
122122
"sv": [
123123
{
124-
"b": "7b4ffe5d60e4e4300dc3e28d9c300c87",
124+
"b3": "7b4ffe5d60e4e4300dc3e28d9c300c87",
125125
"c": "mBbL9j9(QoRD)R+z?=Fvn#=FRIg79JJM`MCq+nE0*U^ca-cViL884d-TInfY&E9HW@X>!U&lkYne2!EecKG8xwLYb0X#y7|05rrPvwh?Ejvk%78G}b+je+xufQA5mSwHSid)iEOkg@>mpuh",
126126
"s": "bca213de9ccce676fa849ff9c4807963"
127127
},
@@ -209,7 +209,7 @@ AS $$
209209
RETURN '{
210210
"sv": [
211211
{
212-
"b": "7b4ffe5d60e4e4300dc3e28d9c300c87",
212+
"b3": "7b4ffe5d60e4e4300dc3e28d9c300c87",
213213
"c": "mBbM0#UZON2jQ3@LiWcvns2YfD7#?5ZXlp8Wk1R*iA%o6cD0VZWqPY%l%_z!JC9wAR4?XKSouV_AjBXFod39C7TF-SiCD-NgkG)l%Vw=l!tX>H*P<PfE$+0Szy",
214214
"s": "bca213de9ccce676fa849ff9c4807963"
215215
},
@@ -238,7 +238,7 @@ AS $$
238238
"sv": [
239239
{
240240
"c": "mBbK0Cob5dQ5Jki69vRd75f9kDqkudQIbo}$J)f!EYW$7#FJ{kA1^NPL~KtPnCJ^MjEZiv5-P~GgJu!LAm>kiFH&De7C+d}sDugsc?JuI*>$AsG83nsXvrND0-(S",
241-
"b": "7b4ffe5d60e4e4300dc3e28d9c300c87",
241+
"b3": "7b4ffe5d60e4e4300dc3e28d9c300c87",
242242
"s": "bca213de9ccce676fa849ff9c4807963"
243243
},
244244
{
@@ -318,7 +318,7 @@ AS $$
318318
"c": "e"
319319
},
320320
"u": "unique.%s",
321-
"b": "blake3.%s",
321+
"b3": "blake3.%s",
322322
"bf": %s
323323
}',
324324
random_key,

0 commit comments

Comments
 (0)