Skip to content
# Class: LiteralValue

Defined in: packages/core/src/models/ValueComponent.ts:224

Represents a literal expression in the SQL AST.

Extends ​

Constructors ​

Constructor ​

new LiteralValue(value, _deprecated, isStringLiteral, options): LiteralValue

Defined in: packages/core/src/models/ValueComponent.ts:237

Creates a single-quoted string literal. The escape state must be explicit.

Parameters ​

value ​

string

_deprecated ​

boolean | undefined

isStringLiteral ​

true

options ​

StringLiteralOptions

Use isEscaped: false for plain data or isEscaped: true for SQL literal text.

Returns ​

LiteralValue

Overrides ​

SqlComponent.constructor

Constructor ​

new LiteralValue(value, _deprecated?, isStringLiteral?): LiteralValue

Defined in: packages/core/src/models/ValueComponent.ts:239

Creates a literal that does not use single-quoted string formatting.

Parameters ​

value ​

string | number | boolean | null

_deprecated? ​

boolean

isStringLiteral? ​

false

Returns ​

LiteralValue

Overrides ​

SqlComponent.constructor

Properties ​

comments ​

comments: string[] | null = null

Defined in: packages/core/src/models/SqlComponent.ts:29

Inherited from ​

SqlComponent.comments


positionedComments ​

positionedComments: PositionedComment[] | null = null

Defined in: packages/core/src/models/SqlComponent.ts:32

Inherited from ​

SqlComponent.positionedComments


kind ​

static kind: symbol

Defined in: packages/core/src/models/ValueComponent.ts:225

Overrides ​

SqlComponent.kind


value ​

value: string | number | boolean | null

Defined in: packages/core/src/models/ValueComponent.ts:227

For a single-quoted string, the text inside the quotes. Edit it with setStringValue.


isStringLiteral? ​

readonly optional isStringLiteral: boolean

Defined in: packages/core/src/models/ValueComponent.ts:229

Indicates that the formatter should enclose the value in single quotes.


isEscaped? ​

readonly optional isEscaped: boolean

Defined in: packages/core/src/models/ValueComponent.ts:231

True for SQL literal text and false for plain string data. Parsed single-quoted strings have this set to true.

Methods ​

getKind() ​

getKind(): symbol

Defined in: packages/core/src/models/SqlComponent.ts:15

Returns ​

symbol

Inherited from ​

SqlComponent.getKind


accept() ​

accept<T&gt;(visitor): T

Defined in: packages/core/src/models/SqlComponent.ts:19

Type Parameters ​

T ​

T

Parameters ​

visitor ​

SqlComponentVisitor<T&gt;

Returns ​

T

Inherited from ​

SqlComponent.accept


toSqlString() ​

toSqlString(formatter): string

Defined in: packages/core/src/models/SqlComponent.ts:23

Parameters ​

formatter ​

SqlComponentVisitor<string&gt;

Returns ​

string

Inherited from ​

SqlComponent.toSqlString


addPositionedComments() ​

addPositionedComments(position, comments): void

Defined in: packages/core/src/models/SqlComponent.ts:37

Add comments at a specific position

Parameters ​

position ​

"before" | "after"

comments ​

string[]

Returns ​

void

Inherited from ​

SqlComponent.addPositionedComments


getPositionedComments() ​

getPositionedComments(position): string[]

Defined in: packages/core/src/models/SqlComponent.ts:56

Get comments for a specific position

Parameters ​

position ​

"before" | "after"

Returns ​

string[]

Inherited from ​

SqlComponent.getPositionedComments


getAllPositionedComments() ​

getAllPositionedComments(): string[]

Defined in: packages/core/src/models/SqlComponent.ts:66

Get all positioned comments as a flat array in order (before, after)

Returns ​

string[]

Inherited from ​

SqlComponent.getAllPositionedComments


setStringValue() ​

setStringValue(value, options): void

Defined in: packages/core/src/models/ValueComponent.ts:255

Replaces the text and escape state of an existing single-quoted string literal.

Parameters ​

value ​

string

The text to store inside the quotes.

options ​

StringLiteralOptions

Use isEscaped: false for plain data or isEscaped: true for SQL literal text.

Returns ​

void

Throws ​

TypeError if the literal is not single-quoted or the escape state is missing.

Released under the MIT License.