Commit 71af26d
committed
refactor: organize Math functions into namespace matching PostgreSQL Chapter 9.3
Restructured mathematical functions to follow PostgreSQL documentation organization
with Math namespace and one-type-per-file pattern, matching Window and Array refactoring.
Structure changes:
- Created Math namespace (Math.swift) with comprehensive documentation
- Split BasicMath.swift into focused files matching PostgreSQL Tables 9.5-9.8:
- Math+Rounding.swift: ceil, floor, round, trunc
- Math+Sign.swift: abs, sign
- Math+Division.swift: mod, div
- Math+NumberTheory.swift: gcd, lcm, factorial, minScale, trimScale
- Math+Comparison.swift: min, max (with @_disfavoredOverload)
- Math+Random.swift: random, setseed (extracted from Exponential)
- Renamed Exponential.swift → Math+Exponential.swift
- Renamed Trigonometric.swift → Math+Trigonometric.swift
API patterns:
- Dual API: Math.abs($0.value) OR $0.value.abs()
- Namespace style for explicit calls
- Method style for fluent chaining
- Maintains @_disfavoredOverload for stdlib conflicts
Benefits:
- Clear organization matching PostgreSQL documentation structure
- One type per file for easier navigation
- Consistent with Window and Array function patterns
- Better discoverability via Math namespace
- All 860 tests passing1 parent 689781d commit 71af26d
File tree
10 files changed
+830
-428
lines changed- Sources/StructuredQueriesPostgres/Functions/Mathematical
10 files changed
+830
-428
lines changedLines changed: 0 additions & 338 deletions
This file was deleted.
0 commit comments