-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
AstorisTheBrave edited this page Aug 30, 2026
·
1 revision
The repository contains an executable production example for every supported language. Each creates or accepts a UUIDv7 MID, derives an order_ PID, parses it, and asserts that the original MID is recovered.
MID 019d4c72-c910-7a84-b313-53c3ac61a32f
PID order_01kn675j8gfa2b64tkrep638sf
import { parsePublicId, publicIdFromMachineId } from "@greyfoundry/identifold";
const mid = "019d4c72-c910-7a84-b313-53c3ac61a32f";
const pid = publicIdFromMachineId(mid, "order");
const parsed = parsePublicId(pid, "order");Run the checked-in example:
pnpm --dir examples/typescript test
pnpm --dir examples/typescript startfrom identifold import parse_public_id, public_id_from_machine_id
mid = "019d4c72-c910-7a84-b313-53c3ac61a32f"
pid = public_id_from_machine_id(mid, "order")
parsed = parse_public_id(pid, "order")python examples/python/basic.pyimport io.greyfoundry.identifold.Identifold;
var mid = "019d4c72-c910-7a84-b313-53c3ac61a32f";
var pid = Identifold.publicIdFromMachineId(mid, "order");
var parsed = Identifold.parsePublicId(pid);Source: examples/java/Basic.java
using Greyfoundry.Identifold;
var mid = "019d4c72-c910-7a84-b313-53c3ac61a32f";
var pid = Identifiers.PublicIdFromMachineId(mid, "order");
var parsed = Identifiers.ParsePublicId(pid);dotnet run --project examples/csharp/Identifold.Example.csprojimport "github.com/greyfoundry/identifold/packages/go"
mid := "019d4c72-c910-7a84-b313-53c3ac61a32f"
pid, err := identifold.PublicIDFromMachineID(mid, "order")
parsed, err := identifold.ParsePublicID(pid)cd examples/go
go run .use Greyfoundry\Identifold\Identifold;
$mid = '019d4c72-c910-7a84-b313-53c3ac61a32f';
$pid = Identifold::publicIdFromMachineId($mid, 'order');
$parsed = Identifold::parsePublicId($pid);cd examples/php
composer install
php basic.phpimport io.greyfoundry.identifold.KotlinIdentifold
val mid = "019d4c72-c910-7a84-b313-53c3ac61a32f"
val pid = KotlinIdentifold.publicIdFromMachineId(mid, "order")
val parsed = KotlinIdentifold.parsePublicId(pid)Source: examples/kotlin/Basic.kt
let mid = "019d4c72-c910-7a84-b313-53c3ac61a32f";
let pid = identifold::public_id_from_machine_id(mid, "order")?;
let parsed = identifold::parse_public_id(&pid)?;cargo run --locked --manifest-path examples/rust/Cargo.tomlrequire "identifold"
mid = "019d4c72-c910-7a84-b313-53c3ac61a32f"
pid = Identifold.public_id_from_machine_id(mid, "order")
parsed = Identifold.parse_public_id(pid)cd examples/ruby
bundle install
bundle exec ruby basic.rbimport Identifold
let mid = "019d4c72-c910-7a84-b313-53c3ac61a32f"
let pid = try Identifiers.publicID(from: mid, namespace: "order")
let parsed = try Identifiers.parsePublicID(pid)swift run IdentifoldExampleThe TypeScript and Python examples are executed by their dedicated workflows. The other eight are executed by their corresponding language jobs. A broken public API example therefore fails one of the 17 checks required on protected main.
See the repository's production example guide for exact source paths and verification commands.