Skip to content

Commit 09248db

Browse files
committed
add TypedLiteral for postgres
1 parent 6bbab74 commit 09248db

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

literals.go

+17
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,20 @@ func (l *LiteralExpr) AsExpr(s *Serializer) {
1515
func (e *LiteralExpr) As(alias string) *ColumnAlias {
1616
return AliasColumn(e, alias)
1717
}
18+
19+
func TypedLiteral(typ, text string) *TypedLiteralExpr {
20+
return &TypedLiteralExpr{typ: typ, text: text}
21+
}
22+
23+
type TypedLiteralExpr struct {
24+
typ string
25+
text string
26+
}
27+
28+
func (l *TypedLiteralExpr) AsExpr(s *Serializer) {
29+
s.D(l.typ).D(" ").D(l.text)
30+
}
31+
32+
func (e *TypedLiteralExpr) As(alias string) *ColumnAlias {
33+
return AliasColumn(e, alias)
34+
}

0 commit comments

Comments
 (0)