Universally Unique Lexicographically Sortable Identifiers in R
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
|
|
|
|
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
|
|
|
|
|
|
|
|
#' Generate ULIDs from timestamps
|
|
|
|
#'
|
|
|
|
#' This function generates a new [Universally Unique Lexicographically
|
|
|
|
#' Sortable Identifier](https://github.com/ulid/spec) from a vector of
|
|
|
|
#' `POSIXct` timestamps.
|
|
|
|
#'
|
|
|
|
#' @md
|
|
|
|
#' @param tsv vector of `POSIXct` values
|
|
|
|
#' @export
|
|
|
|
#' @examples
|
|
|
|
#' ts_generate(as.POSIXct("2017-11-01 15:00:00", origin="1970-01-01"))
|
|
|
|
ts_generate <- function(tsv) {
|
|
|
|
.Call(`_ulid_ts_generate`, tsv)
|
|
|
|
}
|
|
|
|
|
|
|
|
#' Generate ULID
|
|
|
|
#'
|
|
|
|
#' [ULIDgenerate()] generates a new [Universally Unique Lexicographically
|
|
|
|
#' Sortable Identifier](https://github.com/ulid/spec).
|
|
|
|
#'
|
|
|
|
#' @md
|
|
|
|
#' @param n number of id's to generate (default = `1`)
|
|
|
|
#' @export
|
|
|
|
#' @examples
|
|
|
|
#' ULIDgenerate()
|
|
|
|
ULIDgenerate <- function(n = 1L) {
|
|
|
|
.Call(`_ulid_ULIDgenerate`, n)
|
|
|
|
}
|
|
|
|
|
|
|
|
#' Unmarshal a ULID into a data frame with timestamp and random bitstring columns
|
|
|
|
#'
|
|
|
|
#' @md
|
|
|
|
#' @param ulids character ULIDs (e.g. created with [ULIDgenerate()])
|
|
|
|
#' @export
|
|
|
|
#' @return data frame (tibble)
|
|
|
|
#' @examples
|
|
|
|
#' unmarshal(ULIDgenerate())
|
|
|
|
unmarshal <- function(ulids) {
|
|
|
|
.Call(`_ulid_unmarshal`, ulids)
|
|
|
|
}
|
|
|
|
|