Support for quoted identifiers#1307
Conversation
059f5d6 to
a19d05f
Compare
| def asSql: String = if (quoted) s"\"${value.replace("\"", "\"\"")}\"" else value | ||
| override def toString: String = asSql | ||
|
|
||
| override def equals(other: Any): Boolean = other match { |
There was a problem hiding this comment.
Not sure if this can break anything?
There was a problem hiding this comment.
why not add quoted as a constructor parameter instead and rely on the default one?
There was a problem hiding this comment.
it's a sealed class, it should be fine...
(but maybe it's not)
| val identifier: SCodec[Identifier] = | ||
| utf8z.exmap( | ||
| s => Attempt.fromEither(Identifier.fromString(s).leftMap(Err(_))), | ||
| s => Attempt.fromEither(Identifier.fromString(s).orElse(Identifier.fromStringQuoted(s)).leftMap(Err(_))), |
There was a problem hiding this comment.
Any idea if there is a better solution?
a19d05f to
214acdf
Compare
|
It's a much bigger change than I originally thought 🤷 |
| Identifier.fromStringQuoted(part) match { | ||
| case Right(Identifier(s)) => '{ Identifier.fromStringQuoted(${Expr(s)}).fold(sys.error, identity) } | ||
| case Left(s) => | ||
| report.error(s) |
There was a problem hiding this comment.
there's a variant that aborts and returns Nothing, so you don't have to do '{???} - errorAndAbort
There was a problem hiding this comment.
I mirrored the identifier_impl implementation
| def asSql: String = if (quoted) s"\"${value.replace("\"", "\"\"")}\"" else value | ||
| override def toString: String = asSql | ||
|
|
||
| override def equals(other: Any): Boolean = other match { |
There was a problem hiding this comment.
why not add quoted as a constructor parameter instead and rely on the default one?
214acdf to
88a1522
Compare
implements #1276