Skip to content

Commit

Permalink
feat: Renamed CreateFromUuid to Encode
Browse files Browse the repository at this point in the history
  • Loading branch information
nletullier committed Aug 25, 2023
1 parent 3cbe429 commit cec9082
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cat sql/functions/typeId_NewIdv7.sql >> typeid_tsql.generated.sql
echo "GO" >> typeid_tsql.generated.sql
cat sql/functions/typeId_ToBase32.sql >> typeid_tsql.generated.sql
echo "GO" >> typeid_tsql.generated.sql
cat sql/functions/typeId_CreateFromUuid.sql >> typeid_tsql.generated.sql
cat sql/functions/typeId_Encode.sql >> typeid_tsql.generated.sql
echo "GO" >> typeid_tsql.generated.sql
cat sql/functions/typeId_NewTypeId.sql >> typeid_tsql.generated.sql
echo "GO" >> typeid_tsql.generated.sql
Expand Down
13 changes: 0 additions & 13 deletions sql/functions/typeId_CreateFromUuid.sql

This file was deleted.

13 changes: 13 additions & 0 deletions sql/functions/typeId_Encode.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
IF EXISTS (
SELECT *
FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[typeId_Encode]')
)
DROP FUNCTION [dbo].[typeId_Encode]
GO
CREATE FUNCTION typeId_Encode(@prefix VARCHAR(63), @uuid VARCHAR(36)) RETURNS VARCHAR(90)
AS
BEGIN
RETURN LOWER(@prefix) + '_' + dbo.typeId_ToBase32('00' + dbo.typeId_HexToBinary(@uuid))
END
GO
2 changes: 1 addition & 1 deletion sql/functions/typeId_NewTypeId.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ GO
CREATE FUNCTION typeId_NewTypeId(@prefix VARCHAR(63)) RETURNS VARCHAR(90)
AS
BEGIN
RETURN dbo.typeId_CreateFromUuid(@prefix, dbo.typeId_NewIdv7())
RETURN dbo.typeId_Encode(@prefix, dbo.typeId_NewIdv7())
END
8 changes: 4 additions & 4 deletions typeid_tsql.generated.sql
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,11 @@ GO
IF EXISTS (
SELECT *
FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[typeId_CreateFromUuid]')
WHERE object_id = OBJECT_ID(N'[dbo].[typeId_Encode]')
)
DROP FUNCTION [dbo].[typeId_CreateFromUuid]
DROP FUNCTION [dbo].[typeId_Encode]
GO
CREATE FUNCTION typeId_CreateFromUuid(@prefix VARCHAR(63), @uuid VARCHAR(36)) RETURNS VARCHAR(90)
CREATE FUNCTION typeId_Encode(@prefix VARCHAR(63), @uuid VARCHAR(36)) RETURNS VARCHAR(90)
AS
BEGIN
RETURN LOWER(@prefix) + '_' + dbo.typeId_ToBase32('00' + dbo.typeId_HexToBinary(@uuid))
Expand All @@ -309,6 +309,6 @@ GO
CREATE FUNCTION typeId_NewTypeId(@prefix VARCHAR(63)) RETURNS VARCHAR(90)
AS
BEGIN
RETURN dbo.typeId_CreateFromUuid(@prefix, dbo.typeId_NewIdv7())
RETURN dbo.typeId_Encode(@prefix, dbo.typeId_NewIdv7())
END
GO

0 comments on commit cec9082

Please sign in to comment.