Conversation
Co-authored-by: mathiasrw <[email protected]>
Co-authored-by: mathiasrw <[email protected]>
Co-authored-by: mathiasrw <[email protected]>
Co-authored-by: mathiasrw <[email protected]>
There was a problem hiding this comment.
Please use deepequal to confirm the full object returned.
There was a problem hiding this comment.
Updated tests to use assert.deepEqual for comprehensive validation of Range objects. This now checks all properties (lower, upper, lowerInc, upperInc) in a single assertion. Commit: b27778c
There was a problem hiding this comment.
Is this really the best way to do it?
There was a problem hiding this comment.
Simplified the comparison helper functions. The original approach explicitly handled Date objects with getTime(), but JavaScript's comparison operators already work correctly with Date objects via valueOf(). The new implementation is simpler and more idiomatic while maintaining the same functionality. Commit: b27778c
Co-authored-by: mathiasrw <[email protected]>
Description
Implements PostgreSQL-style range types for AlaSQL, enabling temporal and numeric interval operations requested in #55.
Changes
Core Implementation (
src/60range.js):alasql.Rangeclass with inclusive/exclusive bounds[lower, upper)int4range,int8range,numrange,daterange,tsrange,tstzrangerange_union,range_intersection,range_differencerange_overlaps,range_contains,range_is_subset,range_is_superset,range_is_disjointBuild Integration:
src/60range.jsto build pipeline inbuild.shTest Coverage (
test/test055-B.js):assert.deepEqualfor comprehensive validationExample Usage
Notes
All range types use a unified
alasql.Rangeclass rather than PostgreSQL's six distinct implementations. Default bounds follow PostgreSQL convention: inclusive lower, exclusive upper[lower, upper).Comparison logic leverages JavaScript's built-in valueOf() behavior, making it compatible with Date objects and numeric types without explicit type checking.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.