R/RcppExports.R

Defines functions ts_generate ULIDgenerate unmarshal

Documented in ts_generate ULIDgenerate unmarshal

# 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)
}

Try the ulid package in your browser

Any scripts or data that you put into this service are public.

ulid documentation built on July 9, 2019, 5:03 p.m.