NamedParameterParser class
Parser and extractor for named parameters in SQL.
Supports syntaxes: @name, :name Converts to positional parameters with deterministic order.
Example:
final (cleanedSql, paramNames) = NamedParameterParser.extract(
'SELECT * FROM t WHERE id = @id AND name = :name',
);
// cleanedSql: 'SELECT * FROM t WHERE id = ? AND name = ?'
// paramNames: ['id', 'name']
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
extract(
String sql) → ({String cleanedSql, List< String> paramNames}) - Extracts named parameters and returns SQL with positional placeholders.
-
toPositionalParams(
{required Map< String, Object?> namedParams, required List<String> paramNames}) → List<Object?> -
Converts
namedParamsto positional list followingparamNamesorder.