From 1f7dd164bc1d92a00c87e5d120b58cd9ee9a75c7 Mon Sep 17 00:00:00 2001 From: Janos Guljas Date: Fri, 23 Nov 2018 10:38:30 +0100 Subject: [PATCH] swarm/shed: rename StructField.Unmarshal to StructField.Get --- swarm/shed/field_struct.go | 4 ++-- swarm/shed/field_struct_test.go | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/swarm/shed/field_struct.go b/swarm/shed/field_struct.go index 07b9454811..90daee7fc4 100644 --- a/swarm/shed/field_struct.go +++ b/swarm/shed/field_struct.go @@ -41,9 +41,9 @@ func (db *DB) NewStructField(name string) (f StructField, err error) { }, nil } -// Unmarshal unmarshals data fromt the database to a provided val. +// Get unmarshals data from the database to a provided val. // If the data is not found leveldb.ErrNotFound is returned. -func (f StructField) Unmarshal(val interface{}) (err error) { +func (f StructField) Get(val interface{}) (err error) { b, err := f.db.Get(f.key) if err != nil { return err diff --git a/swarm/shed/field_struct_test.go b/swarm/shed/field_struct_test.go index 137ac3a0ed..cc0be01863 100644 --- a/swarm/shed/field_struct_test.go +++ b/swarm/shed/field_struct_test.go @@ -22,7 +22,7 @@ import ( "github.com/syndtr/goleveldb/leveldb" ) -// TestStructField validates put and unmarshal operations +// TestStructField validates put and get operations // of the StructField. func TestStructField(t *testing.T) { db, cleanupFunc := newTestDB(t) @@ -37,9 +37,9 @@ func TestStructField(t *testing.T) { A string } - t.Run("unmarshal empty", func(t *testing.T) { + t.Run("get empty", func(t *testing.T) { var s complexStructure - err := complexField.Unmarshal(&s) + err := complexField.Get(&s) if err != leveldb.ErrNotFound { t.Fatalf("got error %v, want %v", err, leveldb.ErrNotFound) } @@ -58,7 +58,7 @@ func TestStructField(t *testing.T) { t.Fatal(err) } var got complexStructure - err = complexField.Unmarshal(&got) + err = complexField.Get(&got) if err != nil { t.Fatal(err) } @@ -75,7 +75,7 @@ func TestStructField(t *testing.T) { t.Fatal(err) } var got complexStructure - err = complexField.Unmarshal(&got) + err = complexField.Get(&got) if err != nil { t.Fatal(err) } @@ -96,7 +96,7 @@ func TestStructField(t *testing.T) { t.Fatal(err) } var got complexStructure - err := complexField.Unmarshal(&got) + err := complexField.Get(&got) if err != nil { t.Fatal(err) } @@ -115,7 +115,7 @@ func TestStructField(t *testing.T) { t.Fatal(err) } var got complexStructure - err := complexField.Unmarshal(&got) + err := complexField.Get(&got) if err != nil { t.Fatal(err) }