Skip to content

Commit

Permalink
Minor Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Dec 19, 2024
1 parent 2d39c5a commit 2d11e54
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions benchmark/UUID.Benchmarks/DatabaseOptimizationBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ public UUID GenerateRandomV4()
[Benchmark]
public UUID GeneratePostgreSQLOptimized()
{
return UUID.NewDatabaseFriendly(DatabaseType.PostgreSQL);
return UUID.NewDatabaseOptimized(DatabaseType.PostgreSQL);
}

[Benchmark]
public UUID GenerateSQLServerOptimized()
{
return UUID.NewDatabaseFriendly(DatabaseType.SQLServer);
return UUID.NewDatabaseOptimized(DatabaseType.SQLServer);
}

[Benchmark]
Expand Down
4 changes: 2 additions & 2 deletions demo/UUID.Demo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,15 @@ static async Task Main(string[] args)
Console.WriteLine("\n13. Database-Specific UUID Generation:");
Console.WriteLine("PostgreSQL Optimized (V7):");

UUID postgresUUID = UUID.NewDatabaseFriendly(DatabaseType.PostgreSQL);
UUID postgresUUID = UUID.NewDatabaseOptimized(DatabaseType.PostgreSQL);

Console.WriteLine($"UUID: {postgresUUID}");
Console.WriteLine($"Version: {Decoder.GetVersionDescription(postgresUUID)}");
Console.WriteLine($"Timestamp: {postgresUUID.Time}");

Console.WriteLine("\nSQL Server Optimized (V8):");

UUID sqlServerUUID = UUID.NewDatabaseFriendly(DatabaseType.SQLServer);
UUID sqlServerUUID = UUID.NewDatabaseOptimized(DatabaseType.SQLServer);

Console.WriteLine($"UUID: {sqlServerUUID}");
Console.WriteLine($"Version: {Decoder.GetVersionDescription(sqlServerUUID)}");
Expand Down
2 changes: 1 addition & 1 deletion src/UUID/Tools/Toolkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static UUID[] CreateSequentialBatch(int count, DatabaseType dbType = Data

for (int i = 0; i < count; i++)
{
result[i] = UUID.NewDatabaseFriendly(dbType);
result[i] = UUID.NewDatabaseOptimized(dbType);
}

return result;
Expand Down
4 changes: 2 additions & 2 deletions src/UUID/Versions/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace System
public readonly partial struct UUID
{
/// <summary>
/// Creates a new database-friendly UUID optimized for the specified database type.
/// Creates a new database UUID optimized for the specified database type.
/// </summary>
/// <param name="dbType">The type of database where the UUID will be stored.</param>
/// <returns>A new UUID instance optimized for the specified database.</returns>
Expand All @@ -17,7 +17,7 @@ public readonly partial struct UUID
/// - SQLite: Uses Version 7 (same as PostgreSQL)
/// - Other databases: Uses Version 4 (random) as default
/// </remarks>
public static UUID NewDatabaseFriendly(DatabaseType dbType)
public static UUID NewDatabaseOptimized(DatabaseType dbType)
{
return dbType switch
{
Expand Down
6 changes: 3 additions & 3 deletions test/UUID.Tests/DatabaseOptimizationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class DatabaseOptimizationTests
public void PostgreSQL_Optimized_UUID_Should_Be_Version7()
{
// Arrange & Act
UUID uuid = UUID.NewDatabaseFriendly(DatabaseType.PostgreSQL);
UUID uuid = UUID.NewDatabaseOptimized(DatabaseType.PostgreSQL);

// Assert
Assert.Equal(7, uuid.Version);
Expand All @@ -21,7 +21,7 @@ public void PostgreSQL_Optimized_UUID_Should_Be_Version7()
public void SQLServer_Optimized_UUID_Should_Be_Version8()
{
// Arrange & Act
UUID uuid = UUID.NewDatabaseFriendly(DatabaseType.SQLServer);
UUID uuid = UUID.NewDatabaseOptimized(DatabaseType.SQLServer);

// Assert
Assert.Equal(8, uuid.Version);
Expand Down Expand Up @@ -52,7 +52,7 @@ public void Sequential_Batch_Should_Maintain_Time_Order()
public void Database_Friendly_UUIDs_Should_Have_Valid_Sequence(DatabaseType dbType)
{
// Arrange & Act
UUID uuid = UUID.NewDatabaseFriendly(dbType);
UUID uuid = UUID.NewDatabaseOptimized(dbType);

// Assert
Assert.True(Decoder.TryGetSequence(uuid, out ushort sequence),
Expand Down

0 comments on commit 2d11e54

Please sign in to comment.