Skip to content

Commit

Permalink
add default literal option to SQLDialect
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner0101 committed Aug 14, 2019
1 parent 435a3ac commit 354c843
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/SQLKit/Query/SQLLiteral.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public enum SQLLiteral: SQLExpression {
case .null:
serializer.write("NULL")
case .default:
serializer.write("DEFAULT")
serializer.dialect.literalDefault.serialize(to: &serializer)
case .boolean(let bool):
serializer.dialect.literalBoolean(bool).serialize(to: &serializer)
}
Expand Down
8 changes: 8 additions & 0 deletions Sources/SQLKit/SQLDialect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,12 @@ public protocol SQLDialect {
mutating func nextBindPlaceholder() -> SQLExpression

func literalBoolean(_ value: Bool) -> SQLExpression

var literalDefault: SQLExpression { get }
}

extension SQLDialect {
public var literalDefault: SQLExpression {
return SQLRaw("DEFAULT")
}
}

0 comments on commit 354c843

Please sign in to comment.