Registry / database / zol-math

zol-math

JSON →
library0.5.1jsnpmunverified

zol-math provides SQL math functions (e.g., sum, avg, count, min, max) for use with the Zol ORM for PostgreSQL/MySQL. Current stable version 0.5.1, release cadence follows Zol core. Key differentiator: compile-time type-safe SQL math expressions integrated with Zol query builder, avoiding raw SQL injection. Requires peer dependency zol ^0.5.1.

npm install zol-math
INSTALL
IMPORT
SIG · ZOL-MATH
Z
zol-math
databasejavascriptv0.5.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sum
import { sum } from 'zol-math'
const { sum } = require('zol-math')
ESM only; TypeScript types included
avg
import { avg } from 'zol-math'
import { average } from 'zol-math'
Exact name is 'avg', not 'average'
count
import { count } from 'zol-math'
import count from 'zol-math'
count is a named export, not default

Shows how to import and use basic math functions (sum, avg, count) in a Zol query.

import { sum, avg, count } from 'zol-math'; import { zol } from 'zol'; const query = zol.select({ total: sum('price'), average: avg('price'), count: count('id') }).from('products'); query.execute().then(console.log);
Debug
Known issues
breakingRequires zol ^0.5.1 as peer dependency; incompatible with earlier versions of Zol.
fix
Ensure zol version is 0.5.1 or compatible.
affects: >=0.5.0
deprecatedIn version 0.5.0, the import path was 'zol-math/dist/index' which is now deprecated.
fix
Use 'zol-math' directly.
affects: >=0.5.0 <0.5.1
gotchaFunction names are case-sensitive and must be all lowercase (e.g., 'sum', not 'SUM').
fix
Use exact lowercase names as exported.
affects: >=0.5.0
Errors
Common errors & fixes
Cannot find module 'zol-math' or its corresponding type declarations.
Missing peer dependency 'zol' or incorrect import path.
fix
Install both zol and zol-math: npm install zol zol-math
Property 'sum' does not exist on type 'typeof import("zol-math")'.
Using default import instead of named import.
fix
Use named import: import { sum } from 'zol-math'
Cannot use import statement outside a module.
Running in CommonJS environment; need ESM.
fix
Set type: 'module' in package.json or use .mjs extension.
Upgrade
Version history
0.5.1latest on npm
Audit
Dependencies
zolrequiredpeer dependency, core ORM package required to use zol-math
Agent activity
40 hits · last 30 days
node
36
OpenAI (training)
1
Resources
zol-math — npm install zol-math · libregistry