Created
November 10, 2018 18:56
-
-
Save adriano-di-giovanni/4ee90431ef5fb0d741cddf08df0e57b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { createEntityAttribute, CASE_SENSITIVE, NULLABLE, UNIQUE } = require('reaves') | |
const { generate } = require('randomstring') | |
const redis = require('redis') | |
const uuidv4 = require('uuid/v4') | |
const client = redis.createClient() | |
const entityName = 'player' | |
const attributeName = 'nickname' | |
const flags = CASE_SENSITIVE | NULLABLE | UNIQUE | |
createEntityAttribute(client, entityName, attributeName, flags, (err, playerNickname) => { | |
if (err) { | |
throw err | |
} | |
const entityId = uuidv4() | |
const newValue = generate() | |
const createdAt = Date.now() | |
playerNickname.insert(entityId, newValue, createdAt, console.log.bind(console)) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment