Skip to content

Commit

Permalink
docs: mention prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
g105b committed Sep 13, 2023
1 parent 2b66808 commit 4bc609e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Unique, lexicographically sortable identifiers.
===============================================

Create a `new Ulid()` anywhere in your application, and you have a stringable object that can be used as the primary key in a database. Ulid strings look something like `01G2J6MYN0PGC5Q21W9C`. They are cryptographically pseudo-random, and sort so that newer Ulids compare "greater than" older Ulids.
Create a `new Ulid()` anywhere in your application, and you have a stringable object that can be used as the primary key in a database. Ulid strings look something like `01G2J6MYN0PGC5Q21W9C` or can be prefixed with a type like `CUSTOMER_01G2J6MYN0PGC5Q21W9C`. They are cryptographically pseudo-random, and sort so that newer Ulids compare "greater than" older Ulids.

This solves the problems exposed with working with auto-incrementing integer primary keys, which are predictable and difficult to work with in distributed databases.

Expand Down Expand Up @@ -29,7 +29,7 @@ This solves the problems exposed with working with auto-incrementing integer pri
use Gt\Ulid\Ulid;

$exampleDataSource->create(new Person(
new Ulid(),
new Ulid("pet"),
name: "Cody",
age: 5,
));
Expand Down

0 comments on commit 4bc609e

Please sign in to comment.