MySQL linter errors.

This commit is contained in:
go-jet 2019-08-17 10:43:16 +02:00
parent 5e76355275
commit 46a3dc7dfb
31 changed files with 254 additions and 136 deletions

View file

@ -4,89 +4,89 @@ import "github.com/go-jet/jet/internal/jet"
// UNION effectively appends the result of sub-queries(select statements) into single query.
// It eliminates duplicate rows from its result.
func UNION(lhs, rhs jet.StatementWithProjections, selects ...jet.StatementWithProjections) SetStatement {
return newSetStatementImpl(Union, false, toSelectList(lhs, rhs, selects...))
func UNION(lhs, rhs jet.StatementWithProjections, selects ...jet.StatementWithProjections) setStatement {
return newSetStatementImpl(union, false, toSelectList(lhs, rhs, selects...))
}
// UNION_ALL effectively appends the result of sub-queries(select statements) into single query.
// It does not eliminates duplicate rows from its result.
func UNION_ALL(lhs, rhs jet.StatementWithProjections, selects ...jet.StatementWithProjections) SetStatement {
return newSetStatementImpl(Union, true, toSelectList(lhs, rhs, selects...))
func UNION_ALL(lhs, rhs jet.StatementWithProjections, selects ...jet.StatementWithProjections) setStatement {
return newSetStatementImpl(union, true, toSelectList(lhs, rhs, selects...))
}
// INTERSECT returns all rows that are in query results.
// It eliminates duplicate rows from its result.
func INTERSECT(lhs, rhs jet.StatementWithProjections, selects ...jet.StatementWithProjections) SetStatement {
return newSetStatementImpl(Intersect, false, toSelectList(lhs, rhs, selects...))
func INTERSECT(lhs, rhs jet.StatementWithProjections, selects ...jet.StatementWithProjections) setStatement {
return newSetStatementImpl(intersect, false, toSelectList(lhs, rhs, selects...))
}
// INTERSECT_ALL returns all rows that are in query results.
// It does not eliminates duplicate rows from its result.
func INTERSECT_ALL(lhs, rhs jet.StatementWithProjections, selects ...jet.StatementWithProjections) SetStatement {
return newSetStatementImpl(Intersect, true, toSelectList(lhs, rhs, selects...))
func INTERSECT_ALL(lhs, rhs jet.StatementWithProjections, selects ...jet.StatementWithProjections) setStatement {
return newSetStatementImpl(intersect, true, toSelectList(lhs, rhs, selects...))
}
// EXCEPT returns all rows that are in the result of query lhs but not in the result of query rhs.
// It eliminates duplicate rows from its result.
func EXCEPT(lhs, rhs jet.StatementWithProjections) SetStatement {
return newSetStatementImpl(Except, false, toSelectList(lhs, rhs))
func EXCEPT(lhs, rhs jet.StatementWithProjections) setStatement {
return newSetStatementImpl(except, false, toSelectList(lhs, rhs))
}
// EXCEPT_ALL returns all rows that are in the result of query lhs but not in the result of query rhs.
// It does not eliminates duplicate rows from its result.
func EXCEPT_ALL(lhs, rhs jet.StatementWithProjections) SetStatement {
return newSetStatementImpl(Except, true, toSelectList(lhs, rhs))
func EXCEPT_ALL(lhs, rhs jet.StatementWithProjections) setStatement {
return newSetStatementImpl(except, true, toSelectList(lhs, rhs))
}
type SetStatement interface {
SetOperators
type setStatement interface {
setOperators
ORDER_BY(orderByClauses ...jet.OrderByClause) SetStatement
ORDER_BY(orderByClauses ...jet.OrderByClause) setStatement
LIMIT(limit int64) SetStatement
OFFSET(offset int64) SetStatement
LIMIT(limit int64) setStatement
OFFSET(offset int64) setStatement
AsTable(alias string) SelectTable
}
type SetOperators interface {
jet.Statement
type setOperators interface {
Statement
jet.HasProjections
jet.Expression
Expression
UNION(rhs SelectStatement) SetStatement
UNION_ALL(rhs SelectStatement) SetStatement
INTERSECT(rhs SelectStatement) SetStatement
INTERSECT_ALL(rhs SelectStatement) SetStatement
EXCEPT(rhs SelectStatement) SetStatement
EXCEPT_ALL(rhs SelectStatement) SetStatement
UNION(rhs SelectStatement) setStatement
UNION_ALL(rhs SelectStatement) setStatement
INTERSECT(rhs SelectStatement) setStatement
INTERSECT_ALL(rhs SelectStatement) setStatement
EXCEPT(rhs SelectStatement) setStatement
EXCEPT_ALL(rhs SelectStatement) setStatement
}
type setOperatorsImpl struct {
parent SetOperators
parent setOperators
}
func (s *setOperatorsImpl) UNION(rhs SelectStatement) SetStatement {
func (s *setOperatorsImpl) UNION(rhs SelectStatement) setStatement {
return UNION(s.parent, rhs)
}
func (s *setOperatorsImpl) UNION_ALL(rhs SelectStatement) SetStatement {
func (s *setOperatorsImpl) UNION_ALL(rhs SelectStatement) setStatement {
return UNION_ALL(s.parent, rhs)
}
func (s *setOperatorsImpl) INTERSECT(rhs SelectStatement) SetStatement {
func (s *setOperatorsImpl) INTERSECT(rhs SelectStatement) setStatement {
return INTERSECT(s.parent, rhs)
}
func (s *setOperatorsImpl) INTERSECT_ALL(rhs SelectStatement) SetStatement {
func (s *setOperatorsImpl) INTERSECT_ALL(rhs SelectStatement) setStatement {
return INTERSECT_ALL(s.parent, rhs)
}
func (s *setOperatorsImpl) EXCEPT(rhs SelectStatement) SetStatement {
func (s *setOperatorsImpl) EXCEPT(rhs SelectStatement) setStatement {
return EXCEPT(s.parent, rhs)
}
func (s *setOperatorsImpl) EXCEPT_ALL(rhs SelectStatement) SetStatement {
func (s *setOperatorsImpl) EXCEPT_ALL(rhs SelectStatement) setStatement {
return EXCEPT_ALL(s.parent, rhs)
}
@ -98,7 +98,7 @@ type setStatementImpl struct {
setOperator jet.ClauseSetStmtOperator
}
func newSetStatementImpl(operator string, all bool, selects []jet.StatementWithProjections) SetStatement {
func newSetStatementImpl(operator string, all bool, selects []jet.StatementWithProjections) setStatement {
newSetStatement := &setStatementImpl{}
newSetStatement.ExpressionStatementImpl.StatementImpl = jet.NewStatementImpl(Dialect, jet.SetStatementType, newSetStatement,
&newSetStatement.setOperator)
@ -117,17 +117,17 @@ func newSetStatementImpl(operator string, all bool, selects []jet.StatementWithP
return newSetStatement
}
func (s *setStatementImpl) ORDER_BY(orderByClauses ...jet.OrderByClause) SetStatement {
func (s *setStatementImpl) ORDER_BY(orderByClauses ...jet.OrderByClause) setStatement {
s.setOperator.OrderBy.List = orderByClauses
return s
}
func (s *setStatementImpl) LIMIT(limit int64) SetStatement {
func (s *setStatementImpl) LIMIT(limit int64) setStatement {
s.setOperator.Limit.Count = limit
return s
}
func (s *setStatementImpl) OFFSET(offset int64) SetStatement {
func (s *setStatementImpl) OFFSET(offset int64) setStatement {
s.setOperator.Offset.Count = offset
return s
}
@ -137,9 +137,9 @@ func (s *setStatementImpl) AsTable(alias string) SelectTable {
}
const (
Union = "UNION"
Intersect = "INTERSECT"
Except = "EXCEPT"
union = "UNION"
intersect = "INTERSECT"
except = "EXCEPT"
)
func toSelectList(lhs, rhs jet.StatementWithProjections, selects ...jet.StatementWithProjections) []jet.StatementWithProjections {