From 887ed96de969e6b7f11e6129b8cb8429caa48e24 Mon Sep 17 00:00:00 2001 From: Zach Musgrave Date: Wed, 22 Nov 2023 15:55:32 -0800 Subject: [PATCH] Formatting --- postgres/messages/bind.go | 5 +++-- postgres/messages/describe.go | 3 ++- postgres/messages/execute.go | 4 ++-- postgres/messages/parse.go | 6 +++--- postgres/messages/query.go | 3 ++- postgres/messages/sync.go | 3 ++- postgres/parser/sem/tree/expr.go | 6 +++--- server/converted_query.go | 1 - server/listener.go | 4 ++-- testing/go/prepared_statement_test.go | 4 ++-- testing/logictest/harness/doltgres_harness.go | 6 +++--- 11 files changed, 24 insertions(+), 21 deletions(-) diff --git a/postgres/messages/bind.go b/postgres/messages/bind.go index 5b8c84308e..ead726075b 100644 --- a/postgres/messages/bind.go +++ b/postgres/messages/bind.go @@ -18,8 +18,9 @@ import ( "fmt" "strings" - "github.com/dolthub/doltgresql/postgres/connection" "github.com/dolthub/go-mysql-server/sql" + + "github.com/dolthub/doltgresql/postgres/connection" ) func init() { @@ -222,4 +223,4 @@ func (m Bind) DebugString() string { builder.WriteString("}") return builder.String() -} \ No newline at end of file +} diff --git a/postgres/messages/describe.go b/postgres/messages/describe.go index 4c536e6e6a..740369359b 100644 --- a/postgres/messages/describe.go +++ b/postgres/messages/describe.go @@ -17,8 +17,9 @@ package messages import ( "fmt" - "github.com/dolthub/doltgresql/postgres/connection" "github.com/dolthub/go-mysql-server/sql" + + "github.com/dolthub/doltgresql/postgres/connection" ) func init() { diff --git a/postgres/messages/execute.go b/postgres/messages/execute.go index 97525ff89b..158b8bfad3 100644 --- a/postgres/messages/execute.go +++ b/postgres/messages/execute.go @@ -17,8 +17,9 @@ package messages import ( "fmt" - "github.com/dolthub/doltgresql/postgres/connection" "github.com/dolthub/go-mysql-server/sql" + + "github.com/dolthub/doltgresql/postgres/connection" ) func init() { @@ -91,4 +92,3 @@ func (m Execute) DefaultMessage() *connection.MessageFormat { func (m Execute) DebugString() string { return fmt.Sprintf("Execute {\n Portal: %s\n RowMax: %d\n}", m.Portal, m.RowMax) } - diff --git a/postgres/messages/parse.go b/postgres/messages/parse.go index f4314772f8..95d392eead 100644 --- a/postgres/messages/parse.go +++ b/postgres/messages/parse.go @@ -18,8 +18,9 @@ import ( "fmt" "strings" - "github.com/dolthub/doltgresql/postgres/connection" "github.com/dolthub/go-mysql-server/sql" + + "github.com/dolthub/doltgresql/postgres/connection" ) func init() { @@ -113,7 +114,6 @@ func (m Parse) DefaultMessage() *connection.MessageFormat { return &parseDefault } - // DebugString returns a debug representation of the Parse message. func (m Parse) DebugString() string { var builder strings.Builder @@ -129,4 +129,4 @@ func (m Parse) DebugString() string { builder.WriteString("}") return builder.String() -} \ No newline at end of file +} diff --git a/postgres/messages/query.go b/postgres/messages/query.go index 6936fd8cb4..c92e9caa78 100644 --- a/postgres/messages/query.go +++ b/postgres/messages/query.go @@ -17,8 +17,9 @@ package messages import ( "fmt" - "github.com/dolthub/doltgresql/postgres/connection" "github.com/dolthub/go-mysql-server/sql" + + "github.com/dolthub/doltgresql/postgres/connection" ) func init() { diff --git a/postgres/messages/sync.go b/postgres/messages/sync.go index 823ce127e4..db60579048 100644 --- a/postgres/messages/sync.go +++ b/postgres/messages/sync.go @@ -15,8 +15,9 @@ package messages import ( - "github.com/dolthub/doltgresql/postgres/connection" "github.com/dolthub/go-mysql-server/sql" + + "github.com/dolthub/doltgresql/postgres/connection" ) func init() { diff --git a/postgres/parser/sem/tree/expr.go b/postgres/parser/sem/tree/expr.go index 7c87d68560..ce8b646b3b 100644 --- a/postgres/parser/sem/tree/expr.go +++ b/postgres/parser/sem/tree/expr.go @@ -1775,6 +1775,6 @@ func (node *UnaryExpr) String() string { return AsString(node) } func (node DefaultVal) String() string { return AsString(node) } func (node PartitionMaxVal) String() string { return AsString(node) } func (node PartitionMinVal) String() string { return AsString(node) } -func (node *Placeholder) String() string { return AsString(node) } -func (d NullLiteral) String() string { return AsString(d) } -func (list *NameList) String() string { return AsString(list) } +func (node *Placeholder) String() string { return AsString(node) } +func (d NullLiteral) String() string { return AsString(d) } +func (list *NameList) String() string { return AsString(list) } diff --git a/server/converted_query.go b/server/converted_query.go index ad40d24fa5..437713e5dd 100644 --- a/server/converted_query.go +++ b/server/converted_query.go @@ -24,4 +24,3 @@ type ConvertedQuery struct { String string AST vitess.Statement } - diff --git a/server/listener.go b/server/listener.go index 6f772e61b1..5bf6ffbc2e 100644 --- a/server/listener.go +++ b/server/listener.go @@ -148,7 +148,7 @@ func (l *Listener) HandleConnection(conn net.Conn) { returnErr = err return } - + if ds, ok := message.(sql.DebugStringer); ok { if logrus.IsLevelEnabled(logrus.DebugLevel) { logrus.Debugf("Received message: %s", ds.DebugString()) @@ -430,7 +430,7 @@ func (l *Listener) execute(conn net.Conn, mysqlConn *mysql.Conn, query Converted // describe handles the description of the given query. This will post the ParameterDescription and RowDescription messages. func (l *Listener) describe(conn net.Conn, mysqlConn *mysql.Conn, message messages.Describe, statement ConvertedQuery) (err error) { logrus.Tracef("describing statement %v", statement) - + //TODO: fully support prepared statements if err := connection.Send(conn, messages.ParameterDescription{ ObjectIDs: nil, diff --git a/testing/go/prepared_statement_test.go b/testing/go/prepared_statement_test.go index e52a4fa64e..6b9fad365e 100755 --- a/testing/go/prepared_statement_test.go +++ b/testing/go/prepared_statement_test.go @@ -31,7 +31,7 @@ func TestPreparedStatements(t *testing.T) { }, Assertions: []ScriptTestAssertion{ { - Query: "select v1 from doesNotExist where pk = 1;", + Query: "select v1 from doesNotExist where pk = 1;", ExpectedErr: true, }, { @@ -104,7 +104,7 @@ func RunScriptN(t *testing.T, script ScriptTest, n int) { } else { require.NoError(t, err) } - + defer rows.Close() foundRows, err := ReadRows(rows) assert.Equal(t, NormalizeRows(assertion.Expected), foundRows) diff --git a/testing/logictest/harness/doltgres_harness.go b/testing/logictest/harness/doltgres_harness.go index 16b53561d4..b78875b2cb 100755 --- a/testing/logictest/harness/doltgres_harness.go +++ b/testing/logictest/harness/doltgres_harness.go @@ -34,7 +34,7 @@ const ( // sqllogictest harness for postgres databases. type PostgresqlServerHarness struct { dsn string - db *sql.DB + db *sql.DB } // compile check for interface compliance @@ -49,7 +49,7 @@ func NewPostgresqlHarness(dsn string) *PostgresqlServerHarness { } return &PostgresqlServerHarness{ dsn: dsn, - db: db, + db: db, } } @@ -83,7 +83,7 @@ func (h *PostgresqlServerHarness) ExecuteQuery(statement string) (schema string, if rows != nil { defer rows.Close() } - + if err != nil { return "", nil, err }