2019-06-21 13:56:57 +02:00
|
|
|
package jet
|
2019-04-03 11:03:07 +02:00
|
|
|
|
2019-05-07 19:06:21 +02:00
|
|
|
type projection interface {
|
2019-07-08 10:48:03 +02:00
|
|
|
serializeForProjection(statement statementType, out *sqlBuilder) error
|
2019-07-18 17:43:11 +02:00
|
|
|
from(subQuery SelectTable) projection
|
2019-06-18 14:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
2019-07-18 17:43:11 +02:00
|
|
|
// ProjectionList is a redefined type, so that ProjectionList can be used as a projection.
|
2019-06-18 14:35:32 +02:00
|
|
|
type ProjectionList []projection
|
|
|
|
|
|
2019-07-18 17:43:11 +02:00
|
|
|
func (cl ProjectionList) from(subQuery SelectTable) projection {
|
2019-06-18 14:35:32 +02:00
|
|
|
newProjectionList := ProjectionList{}
|
|
|
|
|
|
|
|
|
|
for _, projection := range cl {
|
|
|
|
|
newProjectionList = append(newProjectionList, projection.from(subQuery))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return newProjectionList
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-08 10:48:03 +02:00
|
|
|
func (cl ProjectionList) serializeForProjection(statement statementType, out *sqlBuilder) error {
|
2019-06-18 14:35:32 +02:00
|
|
|
err := serializeProjectionList(statement, cl, out)
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
2019-04-03 11:03:07 +02:00
|
|
|
}
|