# TimeUuid

<div class="jsdoc-content"><header>
    
        <h2><span class="attribs"><span class="type-signature"></span></span>
            <span class="ancestors"><a href="index.html">types</a>~</span>TimeUuid<span class="signature">(date, ticks, nodeId, clockId)</span><span class="type-signature"></span></h2>
        
            <div class="class-description"><p>Represents an immutable version 1 universally unique identifier (UUID). A UUID represents a 128-bit value.</p></div>
        
    
</header>


    
        

    
    </div>

## Constructor

<div class="jsdoc-content">
    

    
    <h4 class="name" id="TimeUuid"><span class="type-signature"></span>new TimeUuid<span class="signature">(date, ticks, nodeId, clockId)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Creates a new instance of Uuid based on the parameters provided according to rfc4122.
If any of the arguments is not provided, it will be randomly generated,
except for the date that will use the current date.</p>
<p>If nodeId and/or clockId portions are not provided, the constructor will generate them using
<code>crypto.randomBytes()</code>. As it's possible that <code>crypto.randomBytes()</code> might block, it's
recommended that you use the callback-based version of the static methods <code>fromDate()</code> or
<code>now()</code>in that case.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>date</code></td>
            

            <td class="type">
            
            </td>

            

            

            <td class="description last"><p>The date for the instance. If not provided, current Date will be used.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>ticks</code></td>
            

            <td class="type">
            
            </td>

            

            

            <td class="description last"><p>A number from 0 to 10000 representing the 100-nanoseconds units for this instance to fill in
the information not available in the Date, as Ecmascript Dates have only milliseconds precision.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>nodeId</code></td>
            

            <td class="type">
            
            </td>

            

            

            <td class="description last"><p>A 6-length Buffer or string of 6 ascii characters representing the node identifier, ie: 'host01'.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>clockId</code></td>
            

            <td class="type">
            
            </td>

            

            

            <td class="description last"><p>A 2-length Buffer or string of 6 ascii characters representing the clock identifier.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.7.1/lib/types/time-uuid.ts#L48" target="_blank" rel="noopener">types/time-uuid.ts, line 48</a></p></div>




















    
    

    
        </div>

## Extends

<div class="jsdoc-content">

        


    <ul>
        <li><a href="Uuid.html">module:types~Uuid</a></li>
    </ul>


    

    

    

    

    

    

    
        </div>

## Members

<div class="jsdoc-content">

        
            
<h4 class="name" id="buffer"><span class="type-signature">(readonly) </span>buffer<span class="type-signature"></span></h4>




<div class="description">
    <p>Returns the underlying buffer</p>
</div>







<dl class="details">

    

    

    

    
    <dt class="tag-overrides">Overrides:</dt>
    <dd class="tag-overrides"><ul class="dummy"><li>
        <a href="Uuid.html#buffer">module:types~Uuid#buffer</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    
    
    

    

    

    
</dl><div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.7.1/lib/types/uuid.ts#L38" target="_blank" rel="noopener">types/uuid.ts, line 38</a></p></div>






        
            
<h4 class="name" id="uuidRegex"><span class="type-signature"></span>uuidRegex<span class="type-signature"></span></h4>




<div class="description">
    <p>Used to check if the UUID is in a correct format
Source: https://stackoverflow.com/a/6640851
Verified also with documentation of UUID library in Rust: https://docs.rs/uuid/latest/uuid/</p>
</div>







<dl class="details">

    

    

    

    
    <dt class="tag-overrides">Overrides:</dt>
    <dd class="tag-overrides"><ul class="dummy"><li>
        <a href="Uuid.html#uuidRegex">module:types~Uuid#uuidRegex</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    
    
    

    

    

    
</dl><div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.7.1/lib/types/uuid.ts#L16" target="_blank" rel="noopener">types/uuid.ts, line 16</a></p></div>






        
    

    
        </div>

## Methods

<div class="jsdoc-content">

        
            

    

    
    <h4 class="name" id="equals"><span class="type-signature"></span>equals<span class="signature">(other)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Compares this object to the specified object.
The result is true if and only if the argument is not null, is a UUID object, and
contains the same value, bit for bit, as this UUID.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>other</code></td>
            

            <td class="type">
            
            </td>

            

            

            <td class="description last"><p>The other value to test for equality.</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    
    <dt class="tag-overrides">Overrides:</dt>
    <dd class="tag-overrides"><ul class="dummy"><li>
        <a href="Uuid.html#equals">module:types~Uuid#equals</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    
    
    

    

    

    
</dl><div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.7.1/lib/types/uuid.ts#L100" target="_blank" rel="noopener">types/uuid.ts, line 100</a></p></div>




















        
            

    

    
    <h4 class="name" id="getBuffer"><span class="type-signature"></span>getBuffer<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Gets the bytes representation of a Uuid</p>
</div>













<dl class="details">

    

    

    

    
    <dt class="tag-overrides">Overrides:</dt>
    <dd class="tag-overrides"><ul class="dummy"><li>
        <a href="Uuid.html#getBuffer">module:types~Uuid#getBuffer</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    
    
    

    

    

    
</dl><div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.7.1/lib/types/uuid.ts#L90" target="_blank" rel="noopener">types/uuid.ts, line 90</a></p></div>




















        
            

    

    
    <h4 class="name" id="getClockId"><span class="type-signature"></span>getClockId<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Returns the clock id this instance, with the variant applied (first 2 msb being 1 and 0).</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.7.1/lib/types/time-uuid.ts#L240" target="_blank" rel="noopener">types/time-uuid.ts, line 240</a></p></div>




















        
            

    

    
    <h4 class="name" id="getDate"><span class="type-signature"></span>getDate<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Gets the Date representation of this instance.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.7.1/lib/types/time-uuid.ts#L226" target="_blank" rel="noopener">types/time-uuid.ts, line 226</a></p></div>




















        
            

    

    
    <h4 class="name" id="getDatePrecision"><span class="type-signature"></span>getDatePrecision<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Gets the Date and 100-nanoseconds units representation of this instance.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.7.1/lib/types/time-uuid.ts#L205" target="_blank" rel="noopener">types/time-uuid.ts, line 205</a></p></div>




















        
            

    

    
    <h4 class="name" id="getNodeId"><span class="type-signature"></span>getNodeId<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Returns the node id this instance</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.7.1/lib/types/time-uuid.ts#L233" target="_blank" rel="noopener">types/time-uuid.ts, line 233</a></p></div>




















        
            

    

    
    <h4 class="name" id="getNodeIdString"><span class="type-signature"></span>getNodeIdString<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Returns the node id this instance as an ascii string</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.7.1/lib/types/time-uuid.ts#L247" target="_blank" rel="noopener">types/time-uuid.ts, line 247</a></p></div>




















        
            

    

    
    <h4 class="name" id="inspect"><span class="type-signature"></span>inspect<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Provide the name of the constructor and the string representation</p>
</div>













<dl class="details">

    

    

    

    
    <dt class="tag-overrides">Overrides:</dt>
    <dd class="tag-overrides"><ul class="dummy"><li>
        <a href="Uuid.html#inspect">module:types~Uuid#inspect</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    
    
    

    

    

    
</dl><div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.7.1/lib/types/uuid.ts#L120" target="_blank" rel="noopener">types/uuid.ts, line 120</a></p></div>




















        
            

    

    
    <h4 class="name" id="toJSON"><span class="type-signature"></span>toJSON<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Returns the string representation.
Method used by the native JSON.stringify() to serialize this instance.</p>
</div>













<dl class="details">

    

    

    

    
    <dt class="tag-overrides">Overrides:</dt>
    <dd class="tag-overrides"><ul class="dummy"><li>
        <a href="Uuid.html#toJSON">module:types~Uuid#toJSON</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    
    
    

    

    

    
</dl><div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.7.1/lib/types/uuid.ts#L128" target="_blank" rel="noopener">types/uuid.ts, line 128</a></p></div>




















        
            

    

    
    <h4 class="name" id="toString"><span class="type-signature"></span>toString<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Returns a string representation of the value of this Uuid instance.
32 hex separated by hyphens, in the form of 00000000-0000-0000-0000-000000000000.</p>
</div>













<dl class="details">

    

    

    

    
    <dt class="tag-overrides">Overrides:</dt>
    <dd class="tag-overrides"><ul class="dummy"><li>
        <a href="Uuid.html#toString">module:types~Uuid#toString</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    
    
    

    

    

    
</dl><div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.7.1/lib/types/uuid.ts#L111" target="_blank" rel="noopener">types/uuid.ts, line 111</a></p></div>




















        
            

    

    
    <h4 class="name" id=".fromString"><span class="type-signature">(static) </span>fromString<span class="signature">(value)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Parses a string representation of a TimeUuid</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>value</code></td>
            

            <td class="type">
            
            </td>

            

            

            <td class="description last"><p>should be in 00000000-0000-0000-0000-000000000000 format</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.7.1/lib/types/time-uuid.ts#L145" target="_blank" rel="noopener">types/time-uuid.ts, line 145</a></p></div>




















        
            

    

    
    <h4 class="name" id=".max"><span class="type-signature">(static) </span>max<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Returns the biggest possible type 1 uuid with the provided Date.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.7.1/lib/types/time-uuid.ts#L159" target="_blank" rel="noopener">types/time-uuid.ts, line 159</a></p></div>




















        
            

    

    
    <h4 class="name" id=".min"><span class="type-signature">(static) </span>min<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Returns the smallest possible type 1 uuid with the provided Date.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.7.1/lib/types/time-uuid.ts#L152" target="_blank" rel="noopener">types/time-uuid.ts, line 152</a></p></div></div>
