1.6.0 • Published 4 months ago

@claroscuro/this-is-a-test-987 v1.6.0

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
4 months ago

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 and OR.
  • 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

  1. Clone the repository
git clone
  1. Install dependencies
npm install

Contributing

  1. Create a new branch
  2. Make and Commit your changes
  3. Run npx changeset to generate a new changeset and version bump
  4. Push your changes and open a pull request
  5. Once approved, merge your changes to main and delete your branch
  6. A new PR will be created automatically to merge your_branch into main
  7. Once merged, the new version will be published to NPM
1.6.0

4 months ago

1.5.2

4 months ago

1.5.1

4 months ago

1.5.0

4 months ago

1.4.1

4 months ago

1.4.0

4 months ago

1.3.1

4 months ago

1.2.2

4 months ago

1.3.0

4 months ago

1.2.0

4 months ago

1.1.9

4 months ago

1.2.1

4 months ago

1.1.8

4 months ago

1.1.7

4 months ago

1.1.6

5 months ago

1.1.5

5 months ago

1.1.4

5 months ago

1.1.2

5 months ago

1.1.1

5 months ago

1.1.0

5 months ago

1.0.0

5 months ago