Skip to content
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/1_create_hashids_constent_shuffle.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
drop function if exists hashids.consistent_shuffle(text, text);
DROP FUNCTION if exists hashids.consistent_shuffle(text, text);

CREATE OR REPLACE FUNCTION hashids.consistent_shuffle
(
Expand Down
4 changes: 2 additions & 2 deletions src/2_create_hashids_setup_seps.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

create or replace function hashids.clean_seps_from_alphabet(
CREATE OR REPLACE FUNCTION hashids.clean_seps_from_alphabet(
p_seps text,
p_alphabet text
)
Expand Down Expand Up @@ -32,7 +32,7 @@ $$
LANGUAGE plpgsql IMMUTABLE
COST 200;

create or replace function hashids.clean_alphabet_from_seps(
CREATE OR REPLACE FUNCTION hashids.clean_alphabet_from_seps(
p_seps text,
p_alphabet text
)
Expand Down
2 changes: 1 addition & 1 deletion src/4_create_hashids_hash.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
drop function if exists hashids.hash(bigint, text, boolean);
DROP FUNCTION if exists hashids.hash(bigint, text, boolean);

CREATE OR REPLACE FUNCTION hashids.hash(
p_input bigint,
Expand Down
12 changes: 6 additions & 6 deletions src/6_create_hashids_encode_list.sql
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

drop function if exists hashids.encode_list(bigint[], text, integer, text, boolean);
drop function if exists hashids.encode_list(bigint[], text, integer, text);
drop function if exists hashids.encode_list(bigint[], text, integer);
drop function if exists hashids.encode_list(bigint[], text);
drop function if exists hashids.encode_list(bigint[]);
DROP FUNCTION if exists hashids.encode_list(bigint[], text, integer, text, boolean);
DROP FUNCTION if exists hashids.encode_list(bigint[], text, integer, text);
DROP FUNCTION if exists hashids.encode_list(bigint[], text, integer);
DROP FUNCTION if exists hashids.encode_list(bigint[], text);
DROP FUNCTION if exists hashids.encode_list(bigint[]);


CREATE OR REPLACE FUNCTION hashids.encode_list(
in p_numbers bigint[],
in p_salt text, -- DEFAULT '',
in p_min_hash_length, -- integer default 0,
in p_min_hash_length integer, -- DEFAULT 0,
in p_alphabet text, -- DEFAULT 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890',
in p_zero_offset boolean DEFAULT true)
RETURNS text AS
Expand Down
2 changes: 1 addition & 1 deletion src/7_create_hashids_encode.sql
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ CREATE OR REPLACE FUNCTION hashids.encode(
in p_number bigint,
in p_salt text,
in p_min_hash_length integer,
in p_alphabet text
in p_alphabet text,
in p_zero_offset boolean)
RETURNS text AS
$$
Expand Down
40 changes: 0 additions & 40 deletions src/8_create_hashids_decode.sql
Original file line number Diff line number Diff line change
Expand Up @@ -145,43 +145,3 @@ $$
LANGUAGE plpgsql IMMUTABLE
COST 300;

CREATE OR REPLACE FUNCTION hashids.decode(
in p_hash text,
in p_salt text,
in p_min_hash_length integer,
in p_alphabet text)
RETURNS bigint[] AS
$$
DECLARE
p_numbers ALIAS for $1;
p_salt ALIAS for $2; -- default
p_min_hash_length ALIAS for $3; -- default
p_alphabet ALIAS for $4; -- default
p_zero_offset boolean := true ; -- adding an offset so that this can work with values from a zero based array language
BEGIN
RETURN hashids.decode(p_hash, p_salt, p_min_hash_length, p_alphabet, p_zero_offset);
END;
$$
LANGUAGE plpgsql IMMUTABLE
COST 300;

CREATE OR REPLACE FUNCTION hashids.decode(
in p_hash text,
in p_salt text,
in p_min_hash_length integer,
in p_alphabet text
in p_zero_offset boolean)
RETURNS bigint[] AS
$$
DECLARE
p_numbers ALIAS for $1;
p_salt ALIAS for $2; -- default
p_min_hash_length ALIAS for $3; -- default
p_alphabet ALIAS for $4; -- default
p_zero_offset ALIAS for $5 ; -- adding an offset so that this can work with values from a zero based array language
BEGIN
RETURN hashids.decode(p_hash, p_salt, p_min_hash_length, p_alphabet, p_zero_offset);
END;
$$
LANGUAGE plpgsql IMMUTABLE
COST 300;