Swiftpack.co - Package - std-swift/ULID

ULID

Universally Unique Lexicographically Sortable Identifier

Importing

import ULID
platforms: [
	.macOS(.v10_12)
],
dependencies: [
	.package(url: "https://github.com/std-swift/ULID.git",
	         from: "1.0.0")
],
targets: [
	.target(
		name: "",
		dependencies: [
			"ULID"
		]),
]

Using

ULID

ULID conforms to Equatable, Comparable, Hashable, Codable, and LosslessStringConvertible

Initialize the raw data:

init(rawTime: (high: UInt32, low: UInt16), random: (UInt16, UInt32, UInt32))

Initialize with a Time and data

init(time: Time = Clock.realtime.now(), random: (Int) -> (UInt16, UInt32, UInt32))
init(time: Time = Clock.realtime.now(), random: @autoclosure () -> (UInt16, UInt32, UInt32))

Initialize with a Time and random data

init(time: Time = Clock.realtime.now())
init<T: RandomNumberGenerator>(time: Time = Clock.realtime.now(), generator: inout T)

Get time and random data from a ULID

ulid.time: Time
ulid.rawTime: (high: UInt32, low: UInt16)
ulid.random: (UInt16, UInt32, UInt32)

Github

link
Stars: 0
Help us keep the lights on

Used By

Total: 1