ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Deployments
    • Cloud
    • Server
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
    • Supported Driver Versions
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Install
Search Ask AI
ScyllaDB Docs ScyllaDB Node.js Driver API Reference Modules types Integer
For AI agents: a documentation index is available at https://nodejs-rs-driver.docs.scylladb.com/v0.7.1/llms.txt. A Markdown version of this page is at https://nodejs-rs-driver.docs.scylladb.com/v0.7.1/api/types/Integer.md.

Integer¶

types~Integer(bits, sign)

The internal representation of an integer is an array of 32-bit signed pieces, along with a sign (0 or -1) that indicates the contents of all the other 32-bit pieces out to infinity. We use 32-bit pieces because these are the size of integers on which Javascript performs bit-operations. For operations like addition and multiplication, we split each number into 16-bit pieces, which can easily be multiplied within Javascript's floating-point representation without overflow or change in sign.

Constructor¶

new Integer(bits, sign)

Constructs a two's-complement integer an array containing bits of the integer in 32-bit (signed) pieces, given in little-endian order (i.e., lowest-order bits in the first piece), and the sign of -1 or 0.

See the from* functions below for other convenient ways of constructing Integers.

Parameters:
Name Type Description
bits

Array containing the bits of the number.

sign

The sign of the number: -1 for negative and 0 positive.

Source

types/integer.ts, line 18

Deprecated

Use either Long or builtin BigInt type instead of Integer. This class will be remover at a later time.

Methods¶

abs()

Returns a Integer whose value is the absolute value of this

Source

types/integer.ts, line 710

add(other)

Returns the sum of this and the given Integer.

Parameters:
Name Type Description
other

The Integer to add to this.

Source

types/integer.ts, line 449

Returns:

The Integer result.

and(other)

Returns the bitwise-AND of this Integer and the given one.

Parameters:
Name Type Description
other

The Integer to AND with this.

Source

types/integer.ts, line 625

Returns:

The bitwise-AND of this and the other.

compare(other)

Compares this Integer with the given one.

Parameters:
Name Type Description
other

Integer to compare against.

Source

types/integer.ts, line 407

Returns:

0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.

divide(other)

Returns this Integer divided by the given one.

Parameters:
Name Type Description
other

Th Integer to divide this by.

Source

types/integer.ts, line 546

Returns:

This value divided by the given one.

equals(other)

Parameters:
Name Type Description
other

Integer to compare against.

Source

types/integer.ts, line 354

Returns:

Whether this Integer equals the other.

getBits(index)

Returns the index-th 32-bit (signed) piece of the Integer according to little-endian order (i.e., index 0 contains the smallest bits).

Parameters:
Name Type Description
index

The index in question.

Source

types/integer.ts, line 306

Returns:

The requested 32-bits as a signed number.

getBitsUnsigned(index)

Returns the index-th 32-bit piece as an unsigned number.

Parameters:
Name Type Description
index

The index in question.

Source

types/integer.ts, line 319

Returns:

The requested 32-bits as an unsigned number.

getSign()

Source

types/integer.ts, line 324

Returns:

The sign bit of this number, -1 or 0.

greaterThan(other)

Parameters:
Name Type Description
other

Integer to compare against.

Source

types/integer.ts, line 377

Returns:

Whether this Integer is greater than the other.

greaterThanOrEqual(other)

Parameters:
Name Type Description
other

Integer to compare against.

Source

types/integer.ts, line 384

Returns:

Whether this Integer is greater than or equal to the other.

inspect()

Provide the name of the constructor and the string representation

Source

types/integer.ts, line 704

isNegative()

Source

types/integer.ts, line 340

Returns:

Whether this value is negative.

isOdd()

Source

types/integer.ts, line 344

Returns:

Whether this value is odd.

isZero()

Source

types/integer.ts, line 328

Returns:

Whether this value is zero.

lessThan(other)

Parameters:
Name Type Description
other

Integer to compare against.

Source

types/integer.ts, line 391

Returns:

Whether this Integer is less than the other.

lessThanOrEqual(other)

Parameters:
Name Type Description
other

Integer to compare against.

Source

types/integer.ts, line 398

Returns:

Whether this Integer is less than or equal to the other.

modulo(other)

Returns this Integer modulo the given one.

Parameters:
Name Type Description
other

The Integer by which to mod.

Source

types/integer.ts, line 608

Returns:

This value modulo the given one.

multiply(other)

Returns the product of this and the given Integer.

Parameters:
Name Type Description
other

The Integer to multiply against this.

Source

types/integer.ts, line 483

Returns:

The product of this and the other.

negate()

Source

types/integer.ts, line 441

Returns:

The negation of this value.

not()

Source

types/integer.ts, line 612

Returns:

The bitwise-NOT of this value.

notEquals(other)

Parameters:
Name Type Description
other

Integer to compare against.

Source

types/integer.ts, line 370

Returns:

Whether this Integer does not equal the other.

or(other)

Returns the bitwise-OR of this Integer and the given one.

Parameters:
Name Type Description
other

The Integer to OR with this.

Source

types/integer.ts, line 638

Returns:

The bitwise-OR of this and the other.

shiftLeft(numBits)

Returns this value with bits shifted to the left by the given amount.

Parameters:
Name Type Description
numBits

The number of bits by which to shift.

Source

types/integer.ts, line 664

Returns:

This shifted to the left by the given amount.

shiftRight(numBits)

Returns this value with bits shifted to the right by the given amount.

Parameters:
Name Type Description
numBits

The number of bits by which to shift.

Source

types/integer.ts, line 685

Returns:

This shifted to the right by the given amount.

shorten(numBits)

Returns an integer with only the first numBits bits of this value, sign extended from the final bit.

Parameters:
Name Type Description
numBits

The number of bits by which to shift.

Source

types/integer.ts, line 422

Returns:

The shorted integer value.

subtract(other)

Returns the difference of this and the given Integer.

Parameters:
Name Type Description
other

The Integer to subtract from this.

Source

types/integer.ts, line 475

Returns:

The Integer result.

toInt()

Returns the value, assuming it is a 32-bit integer.

Source

types/integer.ts, line 246

Returns:

The corresponding int value.

toJSON()

Returns the string representation. Method used by the native JSON.stringify() to serialize this instance.

Source

types/integer.ts, line 717

toNumber()

Source

types/integer.ts, line 250

Returns:

The closest floating-point representation to this value.

toString(optRadix)

Parameters:
Name Type Description
optRadix

The radix in which the text should be written.

Source

types/integer.ts, line 267

Returns:

The textual representation of this value.

xor(other)

Returns the bitwise-XOR of this Integer and the given one.

Parameters:
Name Type Description
other

The Integer to XOR with this.

Source

types/integer.ts, line 651

Returns:

The bitwise-XOR of this and the other.

(static) fromBits(bits)

Returns a Integer representing the value that comes by concatenating the given entries, each is assumed to be 32 signed bits, given in little-endian order (lowest order bits in the lowest index), and sign-extending the highest order 32-bit value.

Parameters:
Name Type Description
bits

The bits of the number, in 32-bit signed pieces, in little-endian order.

Source

types/integer.ts, line 95

Returns:

The corresponding Integer value.

(static) fromBuffer()

Returns an Integer representation of a given big endian Buffer. The internal representation of bits contains bytes in groups of 4

Source

types/integer.ts, line 145

(static) fromInt(value)

Returns an Integer representing the given (32-bit) integer value.

Parameters:
Name Type Description
value

A 32-bit integer value.

Source

types/integer.ts, line 52

Returns:

The corresponding Integer value.

(static) fromNumber(value)

Returns an Integer representing the given value, provided that it is a finite number. Otherwise, zero is returned.

Parameters:
Name Type Description
value

The value in question.

Source

types/integer.ts, line 72

Returns:

The corresponding Integer value.

(static) fromString(str, optRadix)

Returns an Integer representation of the given string, written using the given radix.

Parameters:
Name Type Description
str

The textual representation of the Integer.

optRadix

The radix in which the text is written.

Source

types/integer.ts, line 107

Returns:

The corresponding Integer value.

(static) toBuffer()

Returns a big endian buffer representation of an Integer. Internally the bits are represented using 4 bytes groups (numbers), in the Buffer representation there might be the case where we need less than the 4 bytes. For example: 0x00000001 -> '01', 0xFFFFFFFF -> 'FF', 0xFFFFFF01 -> 'FF01'

Source

types/integer.ts, line 181

Was this page helpful?

PREVIOUS
InetAddress
NEXT
LocalDate
  • Create an issue
  • Edit this page

On this page

  • Integer
    • Constructor
    • Methods
ScyllaDB Node.js Driver
Search Ask AI
  • v0.7.1
    • main
    • v0.7.1
    • v0.6.1
  • Getting Started
  • Statements
    • Executing CQL Statements - Best Practices
    • Unprepared Statements
    • Batch Statements
    • Parameterized queries
  • Fetching Large Result Sets
  • Schema Metadata
  • Topology
  • Replicas
  • Query Tracing
  • Logging
  • Policies
    • Load Balancing
    • Retry Policies
  • Authentication
  • Client Routes (Private Networking)
  • Shutdown
  • Migration Guide
  • API Reference
    • Modules
      • auth
        • AuthProvider
        • Authenticator
        • PlainTextAuthProvider
      • datastax
        • graph
        • search
      • errors
        • ArgumentError
        • AuthenticationError
        • BusyConnectionError
        • DriverInternalError
        • NoHostAvailableError
        • NotSupportedError
        • OperationTimedOutError
        • ResponseError
      • geometry
      • mapping
        • DefaultTableMappings
        • Mapper
        • ModelBatchItem
        • ModelMapper
        • Result
        • UnderscoreCqlToCamelCaseMappings
        • TableMappings
      • metrics
        • DefaultMetrics
        • ClientMetrics
      • policies
        • addressResolution
          • AddressTranslator
          • EC2MultiRegionTranslator
          • MappingAddressTranslator
        • loadBalancing
          • AllowListPolicy
          • DCAwareRoundRobinPolicy
          • DefaultLoadBalancingPolicy
          • LegacyDefaultLoadBalancingPolicy
          • LoadBalancingConfig
          • LoadBalancingPolicy
          • RoundRobinPolicy
          • TokenAwarePolicy
        • reconnection
          • ConstantReconnectionPolicy
          • ExponentialReconnectionPolicy
          • ReconnectionPolicy
        • retry
          • FallthroughRetryPolicy
          • RetryPolicy
        • timestampGeneration
          • MonotonicTimestampGenerator
          • TimestampGenerator
      • tracker
        • RequestLogger
        • RequestTracker
      • types
        • BigDecimal
        • Duration
        • InetAddress
        • Integer
        • LocalDate
        • ResultStream
        • Row
        • TimeUuid
        • Tuple
        • Uuid
    • Classes
      • Client
      • ColumnInfo
      • ConstantSpeculativeExecutionPolicy
      • DateRange
      • DateRangeBound
      • DseGssapiAuthProvider
      • DsePlainTextAuthProvider
      • Edge
      • Element
      • Encoder
      • EncoderMembers
      • ExecutionOptions
      • ExecutionProfile
      • FrameReader
      • FrameWriter
      • GraphResultSet
      • HashSet
      • LineString
      • NoSpeculativeExecutionPolicy
      • Path
      • Point
      • Polygon
      • PreparedInfo
      • Property
      • ResultColumnsCache
      • ResultSet
      • RustResult
      • RustSession
      • SpeculativeExecutionPolicy
      • SslOptions
      • Token
      • TokenRange
      • Vertex
      • VertexProperty
      • module-metadata-LocalStrategy
    • Interfaces
    • Events
    • Global Functions and Constants
Docs Tutorials University Contact Us About Us
© 2026 ScyllaDB | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 23 Oct 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.3