Skip to content

Add Fluent API for Query Functions in Jakarta NoSQL (e.g., LEFT, UPPER, ABS, etc.) #204

@otaviojava

Description

@otaviojava

The Jakarta Query specification defines support for function expressions such as ABS(), LENGTH(), LOWER(), UPPER(), LEFT(), and RIGHT().

Currently, Jakarta NoSQL does not expose these functions in its fluent query API. This proposal introduces a structured way to represent and use these functions in queries using the fluent API.

💡 Motivation

Adding function support at the fluent level will:

  • Allow users to express richer queries without string-based parsing
  • Improve type safety
  • Increase developer productivity
  • Support use cases already defined in Jakarta Query

This allows Jakarta NoSQL to integrate more deeply with the Jakarta Query grammar while providing an intuitive developer experience.

✅ Example Usage

template.select(Word.class)
        .where(Function.left("term", 2))
        .eq("Ja")
        .result();

template.select(Word.class)
        .where(Function.upper("meaning"))
        .eq("COFFEE")
        .result();

template.select(Product.class)
        .where(Function.abs("price"))
        .gt(10)
        .result();

📌 Tasks

  • Design the Function API class (e.g., static factory methods)

  • Integrate Function into WhereClause expressions

  • Update the Template.select() fluent chain to accept function expressions

  • Add examples and usage documentation in the specification

  • Implement TCK tests for:

    • LEFT()
    • RIGHT()
    • UPPER()
    • LOWER()
    • LENGTH()
    • ABS()

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions