From 0af6ddb4f77e6a132d8512abf328419317e9b055 Mon Sep 17 00:00:00 2001 From: Christopher Hlubek Date: Wed, 20 Sep 2023 16:02:32 +0200 Subject: [PATCH] Remove unused noParensExp --- builder/args.go | 6 ++---- builder/exp.go | 6 ------ builder/func_builder.go | 1 - builder/ident.go | 5 ++--- builder/json_build_object.go | 3 +-- builder/literals.go | 21 +++++++-------------- builder/select_builder.go | 1 - fn/functions_datetime.go | 3 +-- 8 files changed, 13 insertions(+), 33 deletions(-) diff --git a/builder/args.go b/builder/args.go index 6870c8c..a4882f3 100644 --- a/builder/args.go +++ b/builder/args.go @@ -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) @@ -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) diff --git a/builder/exp.go b/builder/exp.go index 206bc2e..d7e914f 100644 --- a/builder/exp.go +++ b/builder/exp.go @@ -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() -} diff --git a/builder/func_builder.go b/builder/func_builder.go index 3ea5679..f18ba11 100644 --- a/builder/func_builder.go +++ b/builder/func_builder.go @@ -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 diff --git a/builder/ident.go b/builder/ident.go index 4a6c206..513b3ca 100644 --- a/builder/ident.go +++ b/builder/ident.go @@ -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 diff --git a/builder/json_build_object.go b/builder/json_build_object.go index b7a85ce..69be6f7 100644 --- a/builder/json_build_object.go +++ b/builder/json_build_object.go @@ -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 { diff --git a/builder/literals.go b/builder/literals.go index 5c7736c..46db450 100644 --- a/builder/literals.go +++ b/builder/literals.go @@ -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))) @@ -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)) @@ -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))) @@ -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))) @@ -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[") @@ -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") @@ -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") diff --git a/builder/select_builder.go b/builder/select_builder.go index 74f17b9..84715cd 100644 --- a/builder/select_builder.go +++ b/builder/select_builder.go @@ -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 diff --git a/fn/functions_datetime.go b/fn/functions_datetime.go index c118173..2e0ad3c 100644 --- a/fn/functions_datetime.go +++ b/fn/functions_datetime.go @@ -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(")