Skip to content

fix: Allow for encoding bigint #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/4_create_hashids_hash.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ BEGIN
--raise notice 'SUBSTRING(%, %, 1): %', p_alphabet, v_pos, (SUBSTRING(p_alphabet, v_pos, 1));
--raise notice '% || % == %', SUBSTRING(p_alphabet, v_pos, 1), v_hash, SUBSTRING(p_alphabet, v_pos, 1) || v_hash;
v_hash := SUBSTRING(p_alphabet, v_pos, 1) || v_hash;
p_input := CAST((p_input / v_alphabet_length) as int);
p_input := CAST((p_input / v_alphabet_length) as bigint);
--raise notice 'p_input %', p_input;
IF p_input <= 0 THEN
EXIT;
Expand Down
2 changes: 1 addition & 1 deletion src/6_create_hashids_encode_list.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $$
v_count int = array_length(p_numbers, 1);
v_i int = 0;
v_id int = 0;
v_number int;
v_number bigint;
v_guardIndex int;
v_guard char(1);
v_halfLength int;
Expand Down
4 changes: 2 additions & 2 deletions src/all_hashids.sql
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ BEGIN
--raise notice 'SUBSTRING(%, %, 1): %', p_alphabet, v_pos, (SUBSTRING(p_alphabet, v_pos, 1));
--raise notice '% || % == %', SUBSTRING(p_alphabet, v_pos, 1), v_hash, SUBSTRING(p_alphabet, v_pos, 1) || v_hash;
v_hash := SUBSTRING(p_alphabet, v_pos, 1) || v_hash;
p_input := CAST((p_input / v_alphabet_length) as int);
p_input := CAST((p_input / v_alphabet_length) as bigint);
--raise notice 'p_input %', p_input;
IF p_input <= 0 THEN
EXIT;
Expand Down Expand Up @@ -355,7 +355,7 @@ $$
v_count int = array_length(p_numbers, 1);
v_i int = 0;
v_id int = 0;
v_number int;
v_number bigint;
v_guardIndex int;
v_guard char(1);
v_halfLength int;
Expand Down