From 737281d462d33ab80d5c59593f8d9d998e5c0277 Mon Sep 17 00:00:00 2001 From: zachmu Date: Thu, 17 Oct 2024 17:49:59 +0000 Subject: [PATCH] [ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/update.sh --- go/libraries/doltcore/doltdb/foreign_key_serialization.go | 4 ++-- go/libraries/doltcore/doltdb/foreign_key_test.go | 2 +- go/libraries/doltcore/doltdb/root_val_storage.go | 8 ++++---- go/libraries/doltcore/sqle/sqlfmt/row_fmt.go | 2 +- go/libraries/doltcore/sqle/sqlfmt/schema_fmt.go | 2 +- go/libraries/doltcore/sqle/tables.go | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/go/libraries/doltcore/doltdb/foreign_key_serialization.go b/go/libraries/doltcore/doltdb/foreign_key_serialization.go index 43ca919588..97e7c8f875 100644 --- a/go/libraries/doltcore/doltdb/foreign_key_serialization.go +++ b/go/libraries/doltcore/doltdb/foreign_key_serialization.go @@ -135,12 +135,12 @@ func deserializeFlatbufferForeignKeys(msg types.SerialMessage) (*ForeignKeyColle if !ok { return nil, fmt.Errorf("could not decode table name: %s", string(fk.ChildTableName())) } - + parentTableName, ok := decodeTableNameFromSerialization(string(fk.ParentTableName())) if !ok { return nil, fmt.Errorf("could not decode table name: %s", string(fk.ParentTableName())) } - + err := collection.AddKeys(ForeignKey{ Name: string(fk.Name()), TableName: tableName, diff --git a/go/libraries/doltcore/doltdb/foreign_key_test.go b/go/libraries/doltcore/doltdb/foreign_key_test.go index ec962571c9..8f8d8044b8 100644 --- a/go/libraries/doltcore/doltdb/foreign_key_test.go +++ b/go/libraries/doltcore/doltdb/foreign_key_test.go @@ -336,7 +336,7 @@ var foreignKeyTests = []foreignKeyTest{ }, { Name: "fk2", - TableName: doltdb.TableName{Name: "child"}, + TableName: doltdb.TableName{Name: "child"}, TableIndex: "v2_idx", TableColumns: []uint64{8734}, ReferencedTableName: doltdb.TableName{Name: "parent"}, diff --git a/go/libraries/doltcore/doltdb/root_val_storage.go b/go/libraries/doltcore/doltdb/root_val_storage.go index 6bf411afca..b8d8e66e58 100755 --- a/go/libraries/doltcore/doltdb/root_val_storage.go +++ b/go/libraries/doltcore/doltdb/root_val_storage.go @@ -455,8 +455,8 @@ func serializeDatabaseSchemas(b *flatbuffers.Builder, dbSchemas []schema.Databas return b.EndVector(len(offsets)) } -// encodeTableNameForSerialization encodes a table name for serialization. Table names with no schema are encoded as -// just the bare table name. Table names with schemas are encoded by surrounding the schema name with null bytes and +// encodeTableNameForSerialization encodes a table name for serialization. Table names with no schema are encoded as +// just the bare table name. Table names with schemas are encoded by surrounding the schema name with null bytes and // appending the table name. func encodeTableNameForSerialization(name TableName) string { if name.Schema == "" { @@ -477,13 +477,13 @@ func decodeTableNameFromSerialization(encodedName string) (TableName, bool) { Name: encodedName[schemaEnd+1:], }, true } - + // invalid encoding return TableName{}, false } // decodeTableNameForAddressMap decodes a table name from an address map key, expecting a particular schema name. See -// notes on serialization in |encodeTableNameForSerialization| +// notes on serialization in |encodeTableNameForSerialization| func decodeTableNameForAddressMap(encodedName, schemaName string) (string, bool) { if schemaName == "" && encodedName[0] != 0 { return encodedName, true diff --git a/go/libraries/doltcore/sqle/sqlfmt/row_fmt.go b/go/libraries/doltcore/sqle/sqlfmt/row_fmt.go index ec9520d575..696271feef 100644 --- a/go/libraries/doltcore/sqle/sqlfmt/row_fmt.go +++ b/go/libraries/doltcore/sqle/sqlfmt/row_fmt.go @@ -20,11 +20,11 @@ import ( "fmt" "strings" - "github.com/dolthub/dolt/go/libraries/doltcore/doltdb" "github.com/dolthub/go-mysql-server/sql" "github.com/dolthub/vitess/go/sqltypes" "github.com/dolthub/vitess/go/vt/sqlparser" + "github.com/dolthub/dolt/go/libraries/doltcore/doltdb" "github.com/dolthub/dolt/go/libraries/doltcore/row" "github.com/dolthub/dolt/go/libraries/doltcore/schema" "github.com/dolthub/dolt/go/libraries/doltcore/schema/typeinfo" diff --git a/go/libraries/doltcore/sqle/sqlfmt/schema_fmt.go b/go/libraries/doltcore/sqle/sqlfmt/schema_fmt.go index d8c0ced6f0..6de16a1624 100644 --- a/go/libraries/doltcore/sqle/sqlfmt/schema_fmt.go +++ b/go/libraries/doltcore/sqle/sqlfmt/schema_fmt.go @@ -256,7 +256,7 @@ func GenerateCreateTableForeignKeyDefinition(fk doltdb.ForeignKey, sch, parentSc if fk.OnUpdate != doltdb.ForeignKeyReferentialAction_DefaultAction { onUpdate = fk.OnUpdate.String() } - + // TODO: schema name return sql.GenerateCreateTableForiegnKeyDefinition(fk.Name, fkCols, fk.ReferencedTableName.Name, parentCols, onDelete, onUpdate) } diff --git a/go/libraries/doltcore/sqle/tables.go b/go/libraries/doltcore/sqle/tables.go index e883fe58c7..40cbcd7b9a 100644 --- a/go/libraries/doltcore/sqle/tables.go +++ b/go/libraries/doltcore/sqle/tables.go @@ -2630,7 +2630,7 @@ func (t *WritableDoltTable) createForeignKey( tbl *doltdb.Table, sqlFk sql.ForeignKeyConstraint, onUpdateRefAction, onDeleteRefAction doltdb.ForeignKeyReferentialAction) (doltdb.ForeignKey, error) { - + if !sqlFk.IsResolved { // TODO: schema should be part of the foreign key defn return doltdb.ForeignKey{ @@ -2707,7 +2707,7 @@ func (t *WritableDoltTable) createForeignKey( if ok { refTableIndexName = refTableIndex.Name() } - + // TODO: foreign key defn should include schema names return doltdb.ForeignKey{ Name: sqlFk.Name, @@ -2835,7 +2835,7 @@ func (t *WritableDoltTable) UpdateForeignKey(ctx *sql.Context, fkName string, sq } fkc.RemoveKeyByName(doltFk.Name) doltFk.Name = sqlFk.Name - + // TODO: need schema name in foreign key defn doltFk.TableName = doltdb.TableName{Name: sqlFk.Table, Schema: t.db.SchemaName()} doltFk.ReferencedTableName = doltdb.TableName{Name: sqlFk.ParentTable, Schema: t.db.SchemaName()} @@ -2917,7 +2917,7 @@ func (t *AlterableDoltTable) CreateIndexForForeignKey(ctx *sql.Context, idx sql. // toForeignKeyConstraint converts a Dolt resolved foreign key to a GMS foreign key. If the key is unresolved, then this // function should not be used. func toForeignKeyConstraint(fk doltdb.ForeignKey, dbName string, childSch, parentSch schema.Schema) (cst sql.ForeignKeyConstraint, err error) { - // TODO: foreign key defn should include schema name + // TODO: foreign key defn should include schema name cst = sql.ForeignKeyConstraint{ Name: fk.Name, Database: dbName,