Skip to content

Commit

Permalink
Remove unused noParensExp
Browse files Browse the repository at this point in the history
  • Loading branch information
hlubek committed Sep 20, 2023
1 parent e35117e commit 0af6ddb
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 33 deletions.
6 changes: 2 additions & 4 deletions builder/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ type argExp struct {
argument any
}

func (a argExp) IsExp() {}
func (a argExp) NoParensExp() {}
func (a argExp) IsExp() {}

func (a argExp) WriteSQL(sb *SQLBuilder) {
p := sb.CreatePlaceholder(a.argument)
Expand Down Expand Up @@ -62,8 +61,7 @@ type bindExp struct {
name string
}

func (b bindExp) IsExp() {}
func (b bindExp) NoParensExp() {}
func (b bindExp) IsExp() {}

func (b bindExp) WriteSQL(sb *SQLBuilder) {
p := sb.BindPlaceholder(b.name)
Expand Down
6 changes: 0 additions & 6 deletions builder/exp.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,3 @@ type ExpBase struct {
}

func (ExpBase) IsExp() {}

// noParensExp is a marker interface for expressions that do not need to be wrapped in parentheses (again) e.g. when combined via other operators (e.g. cast).
type noParensExp interface {
Exp
NoParensExp()
}
1 change: 0 additions & 1 deletion builder/func_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ type funcColumnDefinition struct {
func (b FuncBuilder) IsExp() {}
func (b FuncBuilder) isFromExp() {}
func (b FuncBuilder) isFromLateralExp() {}
func (b FuncBuilder) NoParensExp() {}

func (b FuncBuilder) WithOrdinality() FuncBuilder {
newBuilder := b
Expand Down
5 changes: 2 additions & 3 deletions builder/ident.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ type IdentExp struct {
ident string
}

func (i IdentExp) IsExp() {}
func (i IdentExp) isFromExp() {}
func (i IdentExp) NoParensExp() {}
func (i IdentExp) IsExp() {}
func (i IdentExp) isFromExp() {}

func (i IdentExp) Ident() string {
return i.ident
Expand Down
3 changes: 1 addition & 2 deletions builder/json_build_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ type JsonBuildObjectBuilder struct {

var _ Exp = JsonBuildObjectBuilder{}

func (b JsonBuildObjectBuilder) IsExp() {}
func (b JsonBuildObjectBuilder) NoParensExp() {}
func (b JsonBuildObjectBuilder) IsExp() {}

func (b JsonBuildObjectBuilder) WriteSQL(sb *SQLBuilder) {
if b.isJsonB {
Expand Down
21 changes: 7 additions & 14 deletions builder/literals.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ func String(s string) Exp {

type expStr string

func (e expStr) IsExp() {}
func (e expStr) NoParensExp() {}
func (e expStr) IsExp() {}

func (e expStr) WriteSQL(sb *SQLBuilder) {
sb.WriteString(pqQuoteLiteral(string(e)))
Expand All @@ -21,8 +20,7 @@ func Float(f float64) Exp {

type expFloat float64

func (e expFloat) IsExp() {}
func (e expFloat) NoParensExp() {}
func (e expFloat) IsExp() {}

func (e expFloat) WriteSQL(sb *SQLBuilder) {
sb.WriteString(strconv.FormatFloat(float64(e), 'f', -1, 64))
Expand All @@ -34,8 +32,7 @@ func Int(s int) Exp {

type expInt int

func (e expInt) IsExp() {}
func (e expInt) NoParensExp() {}
func (e expInt) IsExp() {}

func (e expInt) WriteSQL(sb *SQLBuilder) {
sb.WriteString(strconv.Itoa(int(e)))
Expand All @@ -47,8 +44,7 @@ func Bool(b bool) Exp {

type expBool bool

func (e expBool) IsExp() {}
func (e expBool) NoParensExp() {}
func (e expBool) IsExp() {}

func (e expBool) WriteSQL(sb *SQLBuilder) {
sb.WriteString(strconv.FormatBool(bool(e)))
Expand All @@ -63,8 +59,7 @@ func Array(elems ...Exp) Exp {

type expArray []Exp

func (e expArray) IsExp() {}
func (e expArray) NoParensExp() {}
func (e expArray) IsExp() {}

func (e expArray) WriteSQL(sb *SQLBuilder) {
sb.WriteString("ARRAY[")
Expand All @@ -84,8 +79,7 @@ func Null() Exp {

type expNull struct{}

func (e expNull) IsExp() {}
func (e expNull) NoParensExp() {}
func (e expNull) IsExp() {}

func (e expNull) WriteSQL(sb *SQLBuilder) {
sb.WriteString("NULL")
Expand All @@ -98,8 +92,7 @@ func Default() Exp {

type expDefault struct{}

func (e expDefault) IsExp() {}
func (e expDefault) NoParensExp() {}
func (e expDefault) IsExp() {}

func (e expDefault) WriteSQL(sb *SQLBuilder) {
sb.WriteString("DEFAULT")
Expand Down
1 change: 0 additions & 1 deletion builder/select_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func (b SelectBuilder) isFromLateralExp() {}
func (b SelectBuilder) isSelect() {}
func (b SelectBuilder) isWithQuery() {}
func (b SelectBuilder) isSelectOrExpressions() {}
func (b SelectBuilder) NoParensExp() {}

type SelectExp interface {
Exp
Expand Down
3 changes: 1 addition & 2 deletions fn/functions_datetime.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ type extractExp struct {
from builder.Exp
}

func (c extractExp) IsExp() {}
func (c extractExp) NoParensExp() {}
func (c extractExp) IsExp() {}

func (c extractExp) WriteSQL(sb *builder.SQLBuilder) {
sb.WriteString("EXTRACT(")
Expand Down

0 comments on commit 0af6ddb

Please sign in to comment.