@actually_connor/uuid
TypeScript icon, indicating that this package has built-in type declarations

0.3.12 • Public • Published

@actually_connor/uuid

A JavaScript library that provides a 'ramsey/uuid'-like interface for the uuid package.

@actually_connor/uuid is a JavaScript library for generating and working with universally unique identifiers (UUIDs). It provides a ramsey/uuid-like interface to the uuid package that

This project adheres to a code of conduct. By participating in this project and its community, you are expected to uphold this code.

Quickstart

  1. Install
npm i --save @actually_connor/uuid
  1. Generate a UUID (ES6 module syntax)
import { Uuid } from '@actually_connor/uuid';
const uuid = Uuid.uuid4();

... or using CommonJS syntax:

const { Uuid } = require('@actually_connor/uuid');
const uuid = Uuid.uuid4();

Documentation

@actually_connor/uuid docs

Use in Database - MySQL

The recommended use for saving UUID values in the database would be to create a BINARY(16) column in the database. When persisting the UUIDs you can UNHEX the hexadecimal representation of the UUID.

TypeORM

await this.model
  .createQueryBuilder()
  .insert()
  .into(Table)
  .values({
    uuid: Uuid.uuid4().getBuffer(),
  })
  .execute();
await this.model
  .createQueryBuilder()
  .where('uuid = :uuid', { uuid: uuid.getBuffer() })
  .getOne();

Contributing

Contributions are welcome! To contribute, please familiarize yourself with CONTRIBUTING.md.

Copyright and License

The @actually_connor/uuid library is copyright © Connor Smyth and licensed for use under the MIT License (MIT). Please see LICENSE for more information.

Install

DownloadsWeekly Downloads

44

Version

0.3.12

License

MIT

Unpacked Size

36.5 kB

Total Files

27

Last publish

Collaborators

  • actually_connor