MCPcopy Index your code
hub / github.com/Effect-TS/effect / UuidV4WithGenerate

Function UuidV4WithGenerate

packages/sql/src/Model.ts:635–645  ·  view source on GitHub ↗
(
  schema: Schema.brand<typeof Schema.Uint8ArrayFromSelf, B>
)

Source from the content-addressed store, hash-verified

633 * @category uuid
634 */
635export const UuidV4WithGenerate = <B extends string | symbol>(
636 schema: Schema.brand<typeof Schema.Uint8ArrayFromSelf, B>
637): VariantSchema.Overrideable<Uint8Array & Brand<B>, Uint8Array> =>
638 VariantSchema.Overrideable(Schema.Uint8ArrayFromSelf, schema, {
639 generate: Option.match({
640 onNone: () => Effect.sync(() => Uuid.v4({}, new Uint8Array(16))),
641 onSome: (id) => Effect.succeed(id as any)
642 }),
643 decode: Schema.Uint8ArrayFromSelf,
644 constructorDefault: () => Uuid.v4({}, new Uint8Array(16)) as any
645 })
646
647/**
648 * A field that represents a binary UUID v4 that is generated on inserts.

Callers 1

UuidV4InsertFunction · 0.85

Calls 1

syncMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…