UNPKG

rawsql-ts

Version:

High-performance SQL parser and AST analyzer written in TypeScript. Provides fast parsing and advanced transformation capabilities.

37 lines 1.07 kB
import { SqlComponent } from "./SqlComponent"; /** * Represents a SQL hint clause */ export class HintClause extends SqlComponent { constructor(hintContent) { super(); this.hintContent = hintContent; } /** * Returns the full hint clause with delimiters */ getFullHint() { return '/*+ ' + this.hintContent + ' */'; } /** * Checks if a string is a hint clause */ static isHintClause(value) { const trimmed = value.trim(); return trimmed.length >= 5 && trimmed.substring(0, 3) === '/*+' && trimmed.substring(trimmed.length - 2) === '*/'; } /** * Extracts hint content from a hint clause string */ static extractHintContent(hintClause) { const trimmed = hintClause.trim(); if (!this.isHintClause(trimmed)) { throw new Error('Not a valid hint clause: ' + hintClause); } return trimmed.slice(3, -2).trim(); } } HintClause.kind = Symbol('HintClause'); //# sourceMappingURL=HintClause.js.map