uuid

ReQL command: uuid

Command syntax

r.uuid([string]) → string

Description

Return a UUID (universally unique identifier), a string that can be used as a unique ID. If a string is passed to uuid as an argument, the UUID will be deterministic, derived from the string’s SHA-1 hash.

RethinkDB’s UUIDs are standards-compliant. Without the optional argument, a version 4 random UUID will be generated; with that argument, a version 5 UUID will be generated, using a fixed namespace UUID of 91461c99-f89d-49d2-af96-d8e2e14e9b58. For more information, read Wikipedia’s UUID article.

Example: Generate a UUID.

> r.uuid().run(conn)

"27961a0e-f4e8-4eb3-bf95-c5203e1d87b9"

Example: Generate a UUID based on a string.

> r.uuid("slava@example.com").run(conn)

"90691cbc-b5ea-5826-ae98-951e30fc3b2d"

Get more help

Couldn't find what you were looking for?

© RethinkDB contributors
Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
https://rethinkdb.com/api/ruby/uuid/

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部