Brand ids?

Hi, it's possible to mapped a primary key to a branded type from effect?

export type UserId = string & Brand.Brand<"UserId">
export const UserId = Brand.nominal<UserId>()

export const usersTable = pgTable("users", {
  // Possible?
  id: uuid().primaryKey().transform((value) => UserId(value)),
  createdAt: timestamp().notNull().defaultNow(),
  givenName: varchar({ length: 64 }).notNull(),
  familyName: varchar({ length: 64 }).notNull(),
})
Was this page helpful?