2019-08-11 14:29:03 +02:00
|
|
|
package postgres
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/go-jet/jet/internal/jet"
|
|
|
|
|
)
|
|
|
|
|
|
2019-08-17 14:49:35 +02:00
|
|
|
type clauseReturning struct {
|
2019-08-11 14:29:03 +02:00
|
|
|
Projections []jet.Projection
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-17 18:32:01 +02:00
|
|
|
func (r *clauseReturning) Serialize(statementType jet.StatementType, out *jet.SQLBuilder) {
|
2019-08-11 14:29:03 +02:00
|
|
|
if len(r.Projections) == 0 {
|
2019-08-13 13:57:26 +02:00
|
|
|
return
|
2019-08-11 14:29:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
out.NewLine()
|
|
|
|
|
out.WriteString("RETURNING")
|
|
|
|
|
out.IncreaseIdent()
|
2019-08-13 13:57:26 +02:00
|
|
|
out.WriteProjections(statementType, r.Projections)
|
2019-08-11 14:29:03 +02:00
|
|
|
}
|