MySQL linter errors.
This commit is contained in:
parent
5e76355275
commit
46a3dc7dfb
31 changed files with 254 additions and 136 deletions
|
|
@ -105,9 +105,9 @@ func (b *castImpl) AS_TEXT() StringExpression {
|
|||
return StringExp(b.AS("text"))
|
||||
}
|
||||
|
||||
func (b *castImpl) AS_CHAR(lenght ...int) StringExpression {
|
||||
if len(lenght) > 0 {
|
||||
return StringExp(b.AS("char(" + strconv.Itoa(lenght[0]) + ")"))
|
||||
func (b *castImpl) AS_CHAR(length ...int) StringExpression {
|
||||
if len(length) > 0 {
|
||||
return StringExp(b.AS("char(" + strconv.Itoa(length[0]) + ")"))
|
||||
}
|
||||
|
||||
return StringExp(b.AS("char"))
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package postgres
|
|||
import "github.com/go-jet/jet/internal/jet"
|
||||
|
||||
type DeleteStatement interface {
|
||||
jet.Statement
|
||||
Statement
|
||||
|
||||
WHERE(expression BoolExpression) DeleteStatement
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import "github.com/go-jet/jet/internal/jet"
|
|||
|
||||
// InsertStatement is interface for SQL INSERT statements
|
||||
type InsertStatement interface {
|
||||
jet.Statement
|
||||
Statement
|
||||
|
||||
// Insert row of values
|
||||
VALUES(value interface{}, values ...interface{}) InsertStatement
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ const (
|
|||
)
|
||||
|
||||
type LockStatement interface {
|
||||
jet.Statement
|
||||
Statement
|
||||
|
||||
IN(lockMode TableLockMode) LockStatement
|
||||
NOWAIT() LockStatement
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package postgres
|
|||
|
||||
import "github.com/go-jet/jet/internal/jet"
|
||||
|
||||
type SelectLock = jet.SelectLock
|
||||
type RowLock = jet.RowLock
|
||||
|
||||
var (
|
||||
UPDATE = jet.NewSelectLock("UPDATE")
|
||||
|
|
@ -12,9 +12,9 @@ var (
|
|||
)
|
||||
|
||||
type SelectStatement interface {
|
||||
jet.Statement
|
||||
Statement
|
||||
jet.HasProjections
|
||||
jet.Expression
|
||||
Expression
|
||||
|
||||
DISTINCT() SelectStatement
|
||||
FROM(table ReadableTable) SelectStatement
|
||||
|
|
@ -24,14 +24,14 @@ type SelectStatement interface {
|
|||
ORDER_BY(orderByClauses ...jet.OrderByClause) SelectStatement
|
||||
LIMIT(limit int64) SelectStatement
|
||||
OFFSET(offset int64) SelectStatement
|
||||
FOR(lock SelectLock) SelectStatement
|
||||
FOR(lock RowLock) SelectStatement
|
||||
|
||||
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
|
||||
|
||||
AsTable(alias string) SelectTable
|
||||
}
|
||||
|
|
@ -114,7 +114,7 @@ func (s *selectStatementImpl) OFFSET(offset int64) SelectStatement {
|
|||
return s
|
||||
}
|
||||
|
||||
func (s *selectStatementImpl) FOR(lock SelectLock) SelectStatement {
|
||||
func (s *selectStatementImpl) FOR(lock RowLock) SelectStatement {
|
||||
s.For.Lock = lock
|
||||
return s
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package postgres
|
|||
|
||||
import "github.com/go-jet/jet/internal/jet"
|
||||
|
||||
// SelectTable is interface for MySQL sub-queries
|
||||
type SelectTable interface {
|
||||
ReadableTable
|
||||
jet.SelectTable
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ type ReadableTable interface {
|
|||
}
|
||||
|
||||
type WritableTable interface {
|
||||
jet.TableInterface
|
||||
jet.Table
|
||||
writableTable
|
||||
jet.Serializer
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
// UpdateStatement is interface of SQL UPDATE statement
|
||||
type UpdateStatement interface {
|
||||
jet.Statement
|
||||
Statement
|
||||
|
||||
SET(value interface{}, values ...interface{}) UpdateStatement
|
||||
MODEL(data interface{}) UpdateStatement
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue