Registry / database / bs-sql-composer

bs-sql-composer

JSON →
library4.0.0jsnpmunverified

A library for SQL composition in BuckleScript (ReasonML/OCaml). Current stable version is 4.0.0. It provides a fluent API for building SQL SELECT queries with fields, joins, where clauses, ordering, grouping, and distinct modifiers. It automatically adds 'WHERE 1=1' to simplify compound conditions. The library is designed for compile-to-JS environments like ReasonML and BuckleScript, not for plain JavaScript or TypeScript. Releases appear infrequent, with v4 being the latest major version.

npm install bs-sql-composer
INSTALL
IMPORT
SIG · BS-SQL-COMPOSER
B
bs-sql-composer
databasejavascriptv4.0.0
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.

SqlComposer.Select
open SqlComposer.Select; make() |> field("*") |> from("test") |> toSql
require('bs-sql-composer').Select.make()
BuckleScript/ReasonML module system; use open or fully qualified names
SqlComposer.Select.make
SqlComposer.Select.make()
import { Select } from 'bs-sql-composer'
Not ESM/CommonJS; BuckleScript modules
SqlComposer.Select.toSql
SqlComposer.Select.toSql
SqlComposer.Select.toSql()
toSql is a value, not a function; no parentheses

Shows building a SELECT query with field, from, where, orderBy, and converting to SQL string.

open SqlComposer.Select; let query = make() |> field("*") |> from("users") |> where("AND age > ?") |> orderBy(`Asc("name")) |> toSql; Js.log(query); /* Output: SELECT * FROM users WHERE 1=1 AND age > ? ORDER BY name ASC */
Debug
Known issues
breakingAutomatic 'WHERE 1=1' added to all queries
fix
Ensure your WHERE clauses start with AND/OR; if you need a bare WHERE, manually handle query building.
affects: >=1.0.0
gotchatoSql is a value, not a function - no parentheses
fix
Use '|> toSql' without ()
affects: >=1.0.0
gotchaLibrary is for BuckleScript/ReasonML only, not plain JavaScript
fix
Use in ReasonML/OCaml project with bsconfig.json; not importable via npm in JS/TS
affects: >=1.0.0
Errors
Common errors & fixes
Module not found: Can't resolve 'bs-sql-composer'
Missing bs-dependencies in bsconfig.json
fix
Add 'bs-sql-composer' to 'bs-dependencies' array in bsconfig.json
Uncaught Error: toSql is not a function
Using toSql() with parentheses incorrectly
fix
Use toSql without parentheses: |. toSql
Upgrade
Version history
4.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
bs-sql-composer — npm install bs-sql-composer · libregistry