@claroscuro/this-is-a-test-987
v1.6.0
Published
this is a test so I can learn how to deploy to npm
Downloads
5
Readme
OQLBuilder Library
Introduction
OQLBuilder
is a flexible library designed to simplify the construction of Object Query Language (OQL) queries. It aims to reduce the complexity of writing long queries, prevent syntax errors, and make code more maintainable and testable.
Features
- Handles various comparison operators like
contains
,equals
,greaterThan
, etc. - Support for logical operators
AND
andOR
. - Escapes values to prevent OQL injection.
- Extensible for future enhancements.
Installation
npm install @company/OQL-Builder
Usage
Here's a quick example to get you started:
import { OQLBuilder } from '@company/OQL-Builder';
const query = OQLBuilder.create()
.equals({ column: "column1", value: "value1" })
.contains({ column: "column2", value: "value2", logicalOperator: "OR })
.in({column: "column3, value: ["value3", "value4"]}})
.build();
console.log(query); // column1 EQUALS "value1" AND column2 CONTAINS "value2" OR column3 IN ("value3", "value4")
API Reference
create()
Initializes a new instance of the query builder.
equals({ column, value }, options?)
Adds an 'equals' condition to the query.
contains({ column, value }, options?)
Adds a 'contains' condition to the query.
Advanced Usage
Grouping Conditions
const subQuery = OQLBuilder.create()
.equals({ column: "subColumn", value: "subValue" })
.build();
const query = OQLBuilder.create()
.createGroup(() => subQuery)
.build();
Development
- Clone the repository
git clone
- Install dependencies
npm install
Contributing
- Create a new branch
- Make and Commit your changes
- Run
npx changeset
to generate a new changeset and version bump - Push your changes and open a pull request
- Once approved, merge your changes to
main
and delete your branch - A new PR will be created automatically to merge
your_branch
intomain
- Once merged, the new version will be published to NPM