mirror of
https://github.com/minio/minio.git
synced 2025-11-09 21:49:46 -05:00
Use new gofumpt (#21613)
Update tinylib. Should fix CI. `gofumpt -w .&&go generate ./...`
This commit is contained in:
@@ -79,7 +79,7 @@ func (e *SelectExpression) analyze(s *Select) (result qProp) {
|
||||
for _, ex := range e.Expressions {
|
||||
result.combine(ex.analyze(s))
|
||||
}
|
||||
return
|
||||
return result
|
||||
}
|
||||
|
||||
func (e *AliasedExpression) analyze(s *Select) qProp {
|
||||
@@ -90,14 +90,14 @@ func (e *Expression) analyze(s *Select) (result qProp) {
|
||||
for _, ac := range e.And {
|
||||
result.combine(ac.analyze(s))
|
||||
}
|
||||
return
|
||||
return result
|
||||
}
|
||||
|
||||
func (e *AndCondition) analyze(s *Select) (result qProp) {
|
||||
for _, ac := range e.Condition {
|
||||
result.combine(ac.analyze(s))
|
||||
}
|
||||
return
|
||||
return result
|
||||
}
|
||||
|
||||
func (e *Condition) analyze(s *Select) (result qProp) {
|
||||
@@ -106,14 +106,14 @@ func (e *Condition) analyze(s *Select) (result qProp) {
|
||||
} else {
|
||||
result = e.Not.analyze(s)
|
||||
}
|
||||
return
|
||||
return result
|
||||
}
|
||||
|
||||
func (e *ListExpr) analyze(s *Select) (result qProp) {
|
||||
for _, ac := range e.Elements {
|
||||
result.combine(ac.analyze(s))
|
||||
}
|
||||
return
|
||||
return result
|
||||
}
|
||||
|
||||
func (e *ConditionOperand) analyze(s *Select) (result qProp) {
|
||||
@@ -123,7 +123,7 @@ func (e *ConditionOperand) analyze(s *Select) (result qProp) {
|
||||
result.combine(e.Operand.analyze(s))
|
||||
result.combine(e.ConditionRHS.analyze(s))
|
||||
}
|
||||
return
|
||||
return result
|
||||
}
|
||||
|
||||
func (e *ConditionRHS) analyze(s *Select) (result qProp) {
|
||||
@@ -143,7 +143,7 @@ func (e *ConditionRHS) analyze(s *Select) (result qProp) {
|
||||
default:
|
||||
result = qProp{err: errUnexpectedInvalidNode}
|
||||
}
|
||||
return
|
||||
return result
|
||||
}
|
||||
|
||||
func (e *In) analyze(s *Select) (result qProp) {
|
||||
@@ -153,7 +153,7 @@ func (e *In) analyze(s *Select) (result qProp) {
|
||||
if len(e.JPathExpr.PathExpr) > 0 {
|
||||
if e.JPathExpr.BaseKey.String() != s.From.As && !strings.EqualFold(e.JPathExpr.BaseKey.String(), baseTableName) {
|
||||
result = qProp{err: errInvalidKeypath}
|
||||
return
|
||||
return result
|
||||
}
|
||||
}
|
||||
result = qProp{isRowFunc: true}
|
||||
@@ -162,7 +162,7 @@ func (e *In) analyze(s *Select) (result qProp) {
|
||||
default:
|
||||
result = qProp{err: errUnexpectedInvalidNode}
|
||||
}
|
||||
return
|
||||
return result
|
||||
}
|
||||
|
||||
func (e *Operand) analyze(s *Select) (result qProp) {
|
||||
@@ -170,7 +170,7 @@ func (e *Operand) analyze(s *Select) (result qProp) {
|
||||
for _, r := range e.Right {
|
||||
result.combine(r.Right.analyze(s))
|
||||
}
|
||||
return
|
||||
return result
|
||||
}
|
||||
|
||||
func (e *MultOp) analyze(s *Select) (result qProp) {
|
||||
@@ -178,7 +178,7 @@ func (e *MultOp) analyze(s *Select) (result qProp) {
|
||||
for _, r := range e.Right {
|
||||
result.combine(r.Right.analyze(s))
|
||||
}
|
||||
return
|
||||
return result
|
||||
}
|
||||
|
||||
func (e *UnaryTerm) analyze(s *Select) (result qProp) {
|
||||
@@ -187,7 +187,7 @@ func (e *UnaryTerm) analyze(s *Select) (result qProp) {
|
||||
} else {
|
||||
result = e.Primary.analyze(s)
|
||||
}
|
||||
return
|
||||
return result
|
||||
}
|
||||
|
||||
func (e *PrimaryTerm) analyze(s *Select) (result qProp) {
|
||||
@@ -200,7 +200,7 @@ func (e *PrimaryTerm) analyze(s *Select) (result qProp) {
|
||||
if len(e.JPathExpr.PathExpr) > 0 {
|
||||
if e.JPathExpr.BaseKey.String() != s.From.As && !strings.EqualFold(e.JPathExpr.BaseKey.String(), baseTableName) {
|
||||
result = qProp{err: errInvalidKeypath}
|
||||
return
|
||||
return result
|
||||
}
|
||||
}
|
||||
result = qProp{isRowFunc: true}
|
||||
@@ -217,7 +217,7 @@ func (e *PrimaryTerm) analyze(s *Select) (result qProp) {
|
||||
default:
|
||||
result = qProp{err: errUnexpectedInvalidNode}
|
||||
}
|
||||
return
|
||||
return result
|
||||
}
|
||||
|
||||
func (e *FuncExpr) analyze(s *Select) (result qProp) {
|
||||
|
||||
@@ -91,7 +91,7 @@ func (e *FuncExpr) evalSQLFnNode(r Record, tableAlias string) (res *Value, err e
|
||||
case sqlFnCast:
|
||||
expr := e.Cast.Expr
|
||||
res, err = expr.castTo(r, strings.ToUpper(e.Cast.CastType), tableAlias)
|
||||
return
|
||||
return res, err
|
||||
|
||||
case sqlFnSubstring:
|
||||
return handleSQLSubstring(r, e.Substring, tableAlias)
|
||||
|
||||
@@ -57,7 +57,7 @@ func ParseSelectStatement(s string) (stmt SelectStatement, err error) {
|
||||
err = SQLParser.ParseString(s, &selectAST)
|
||||
if err != nil {
|
||||
err = errQueryParseFailure(err)
|
||||
return
|
||||
return stmt, err
|
||||
}
|
||||
|
||||
// Check if select is "SELECT s.* from S3Object s"
|
||||
@@ -80,7 +80,7 @@ func ParseSelectStatement(s string) (stmt SelectStatement, err error) {
|
||||
stmt.limitValue, err = parseLimit(selectAST.Limit)
|
||||
if err != nil {
|
||||
err = errQueryAnalysisFailure(err)
|
||||
return
|
||||
return stmt, err
|
||||
}
|
||||
|
||||
// Analyze where clause
|
||||
@@ -88,19 +88,19 @@ func ParseSelectStatement(s string) (stmt SelectStatement, err error) {
|
||||
whereQProp := selectAST.Where.analyze(&selectAST)
|
||||
if whereQProp.err != nil {
|
||||
err = errQueryAnalysisFailure(fmt.Errorf("Where clause error: %w", whereQProp.err))
|
||||
return
|
||||
return stmt, err
|
||||
}
|
||||
|
||||
if whereQProp.isAggregation {
|
||||
err = errQueryAnalysisFailure(errors.New("WHERE clause cannot have an aggregation"))
|
||||
return
|
||||
return stmt, err
|
||||
}
|
||||
}
|
||||
|
||||
// Validate table name
|
||||
err = validateTableName(selectAST.From)
|
||||
if err != nil {
|
||||
return
|
||||
return stmt, err
|
||||
}
|
||||
|
||||
// Analyze main select expression
|
||||
@@ -120,7 +120,7 @@ func ParseSelectStatement(s string) (stmt SelectStatement, err error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
return stmt, err
|
||||
}
|
||||
|
||||
func validateTableName(from *TableExpression) error {
|
||||
|
||||
@@ -46,7 +46,7 @@ func parseSQLTimestamp(s string) (t time.Time, err error) {
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
return t, err
|
||||
}
|
||||
|
||||
// FormatSQLTimestamp - returns the a string representation of the
|
||||
|
||||
@@ -175,13 +175,13 @@ func (v Value) ToFloat() (val float64, ok bool) {
|
||||
// ToInt returns the value if int.
|
||||
func (v Value) ToInt() (val int64, ok bool) {
|
||||
val, ok = v.value.(int64)
|
||||
return
|
||||
return val, ok
|
||||
}
|
||||
|
||||
// ToString returns the value if string.
|
||||
func (v Value) ToString() (val string, ok bool) {
|
||||
val, ok = v.value.(string)
|
||||
return
|
||||
return val, ok
|
||||
}
|
||||
|
||||
// Equals returns whether the values strictly match.
|
||||
@@ -220,25 +220,25 @@ func (v Value) SameTypeAs(b Value) (ok bool) {
|
||||
// conversion succeeded.
|
||||
func (v Value) ToBool() (val bool, ok bool) {
|
||||
val, ok = v.value.(bool)
|
||||
return
|
||||
return val, ok
|
||||
}
|
||||
|
||||
// ToTimestamp returns the timestamp value if present.
|
||||
func (v Value) ToTimestamp() (t time.Time, ok bool) {
|
||||
t, ok = v.value.(time.Time)
|
||||
return
|
||||
return t, ok
|
||||
}
|
||||
|
||||
// ToBytes returns the value if byte-slice.
|
||||
func (v Value) ToBytes() (val []byte, ok bool) {
|
||||
val, ok = v.value.([]byte)
|
||||
return
|
||||
return val, ok
|
||||
}
|
||||
|
||||
// ToArray returns the value if it is a slice of values.
|
||||
func (v Value) ToArray() (val []Value, ok bool) {
|
||||
val, ok = v.value.([]Value)
|
||||
return
|
||||
return val, ok
|
||||
}
|
||||
|
||||
// IsNull - checks if value is missing.
|
||||
@@ -393,7 +393,7 @@ func (v *Value) InferBytesType() (err error) {
|
||||
}
|
||||
// Fallback to string
|
||||
v.setString(asString)
|
||||
return
|
||||
return err
|
||||
}
|
||||
|
||||
// When numeric types are compared, type promotions could happen. If
|
||||
|
||||
Reference in New Issue
Block a user