Validate and/or create Uuid
Summary
Functions
Callback function for outstanding to expect trailing uuid4.
Callback function for outstanding to expect uuid4.
Returns trailing uuid4 if valid, or nil.
Generates a uuid4
Ensures the supplied uuid is valid uuid4, if not creates one.
Tests whether the uuid is uuid4.
Tests whether the uuid is uuid4 or nil.
Functions
Callback function for outstanding to expect trailing uuid4.
Examples
iex> Diffo.Uuid.expect_trailing_uuid4("serviceInventoryManagement/v4/service/d2566874-d5ee-400b-9983-10d63ec52f32") nil
iex> Diffo.Uuid.expect_trailing_uuid4("serviceInventoryManagement/v4/service/d2566874-d5ee-400b-9983") :trailing_uuid4
iex> Diffo.Uuid.expect_trailing_uuid4("d2566874-d5ee-400b-9983-10d63ec52f32") nil
iex> Diffo.Uuid.expect_trailing_uuid4(nil) :trailing_uuid4
Callback function for outstanding to expect uuid4.
Examples
iex> Diffo.Uuid.expect_uuid4("d2566874-d5ee-400b-9983-10d63ec52f32") nil
iex> Diffo.Uuid.expect_uuid4("serviceInventoryManagement/v4/service/d2566874-d5ee-400b-9983-10d63ec52f32") :uuid4
iex> Diffo.Uuid.expect_uuid4(nil) :uuid4
Returns trailing uuid4 if valid, or nil.
Examples
iex> Diffo.Uuid.trailing_uuid4("serviceInventoryManagement/v4/service/d2566874-d5ee-400b-9983-10d63ec52f32") "d2566874-d5ee-400b-9983-10d63ec52f32"
iex> Diffo.Uuid.trailing_uuid4("serviceInventoryManagement/v4/service/d2566874-d5ee-400b-9983") nil
iex> Diffo.Uuid.trailing_uuid4("d2566874-d5ee-400b-9983-10d63ec52f32") "d2566874-d5ee-400b-9983-10d63ec52f32"
iex> Diffo.Uuid.trailing_uuid4(nil) nil
Generates a uuid4
Ensures the supplied uuid is valid uuid4, if not creates one.
Examples
iex> validated = Diffo.Uuid.uuid4("4cc5b107-0ff3-4bda-80e1-e4264cbaf868") iex> validated "4cc5b107-0ff3-4bda-80e1-e4264cbaf868"
iex> generated = Diffo.Uuid.uuid4(nil) iex> valid = Diffo.Uuid.uuid4?(generated) iex> valid true
Tests whether the uuid is uuid4.
Examples
iex> Diffo.Uuid.uuid4?("746e465b-3969-460a-980f-af69c9ab248a") true
iex> Diffo.Uuid.uuid4?("9a4cdc44-ca5a-11ef-9cd2-0242ac120002") false
iex> Diffo.Uuid.uuid4?(nil) false
Tests whether the uuid is uuid4 or nil.
Examples
iex> Diffo.Uuid.uuid4_or_nil?("746e465b-3969-460a-980f-af69c9ab248a") true
iex> Diffo.Uuid.uuid4_or_nil?("9a4cdc44-ca5a-11ef-9cd2-0242ac120002") false
iex> Diffo.Uuid.uuid4_or_nil?(nil) true