From 3915f62c7e2bb198e7c26dca613ad4ebe98c9404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Nieto?= <jose.carlos@menteslibres.net> Date: Sat, 2 Apr 2016 12:04:28 -0600 Subject: [PATCH] Renaming Append into Insert. Closes #159 --- builder/interfaces.go | 6 ++-- builder/sqlbuilder/update.go | 4 +-- builder/sqlgen/column_value.go | 4 +-- db.go | 4 +-- db_test.go | 10 +++--- internal/adapter/nonexistent.go | 4 +-- internal/testing/adapter.go.tpl | 40 +++++++++++------------ internal/testing/adapter_benchmark.go.tpl | 22 ++++++------- mongo/benchmark_test.go | 14 ++++---- mongo/collection.go | 4 +-- mongo/database_test.go | 34 +++++++++---------- mysql/collection.go | 4 +-- mysql/connection.go | 2 +- postgresql/adapter_test.go | 12 +++---- postgresql/collection.go | 4 +-- ql/collection.go | 4 +-- sqlite/collection.go | 4 +-- 17 files changed, 88 insertions(+), 88 deletions(-) diff --git a/builder/interfaces.go b/builder/interfaces.go index 9f349b6c..7fce3206 100644 --- a/builder/interfaces.go +++ b/builder/interfaces.go @@ -556,7 +556,7 @@ func (c *C) Sentences() []Compound { return c.conds } -func (c *C) Append(a ...Compound) *C { +func (c *C) Insert(a ...Compound) *C { c.conds = append(c.conds, a...) return c } @@ -582,7 +582,7 @@ func Or(conds ...Compound) *Union { // Or adds more terms to the compound. func (o *Union) Or(conds ...Compound) *Union { - o.C.Append(conds...) + o.C.Insert(conds...) return o } @@ -603,7 +603,7 @@ func And(conds ...Compound) *Intersection { // And adds more terms to the compound. func (a *Intersection) And(conds ...Compound) *Intersection { - a.C.Append(conds...) + a.C.Insert(conds...) return a } diff --git a/builder/sqlbuilder/update.go b/builder/sqlbuilder/update.go index 00aa0e0a..b1d688e4 100644 --- a/builder/sqlbuilder/update.go +++ b/builder/sqlbuilder/update.go @@ -30,11 +30,11 @@ func (qu *updater) Set(terms ...interface{}) builder.Updater { Value: sqlPlaceholder, } } - qu.columnValues.Append(cvs...) + qu.columnValues.Insert(cvs...) qu.arguments = append(qu.arguments, vv...) } else if len(terms) > 1 { cv, arguments := qu.builder.t.ToColumnValues(terms) - qu.columnValues.Append(cv.ColumnValues...) + qu.columnValues.Insert(cv.ColumnValues...) qu.arguments = append(qu.arguments, arguments...) } diff --git a/builder/sqlgen/column_value.go b/builder/sqlgen/column_value.go index 991e0028..6f34ab3d 100644 --- a/builder/sqlgen/column_value.go +++ b/builder/sqlgen/column_value.go @@ -54,8 +54,8 @@ func JoinColumnValues(values ...Fragment) *ColumnValues { return &ColumnValues{ColumnValues: values} } -// Append adds a column to the columns array. -func (c *ColumnValues) Append(values ...Fragment) *ColumnValues { +// Insert adds a column to the columns array. +func (c *ColumnValues) Insert(values ...Fragment) *ColumnValues { for _, f := range values { c.ColumnValues = append(c.ColumnValues, f) } diff --git a/db.go b/db.go index 985998cf..adedf73d 100644 --- a/db.go +++ b/db.go @@ -244,9 +244,9 @@ type Tx interface { // sources or tables. type Collection interface { - // Append inserts a new item into the collection. Accepts a map or a struct + // Insert inserts a new item into the collection. Accepts a map or a struct // as argument. - Append(interface{}) (interface{}, error) + Insert(interface{}) (interface{}, error) // Exists returns true if the collection exists. Exists() bool diff --git a/db_test.go b/db_test.go index fdaac5b1..e44efb03 100644 --- a/db_test.go +++ b/db_test.go @@ -552,7 +552,7 @@ func TestSimpleCRUD(t *testing.T) { col := sess.Collection(`birthdays`) var id interface{} - if id, err = col.Append(controlItem); err != nil { + if id, err = col.Insert(controlItem); err != nil { t.Fatalf(`Could not append item with wrapper %s: %q`, wrapper, err) } @@ -690,7 +690,7 @@ func TestFibonacci(t *testing.T) { var i uint64 for i = 0; i < 10; i++ { item := fibonacci{Input: i, Output: fib(i)} - _, err = col.Append(item) + _, err = col.Insert(item) if err != nil { t.Fatalf(`Could not append item with wrapper %s: %q`, wrapper, err) } @@ -950,7 +950,7 @@ func TestEven(t *testing.T) { var i int for i = 1; i < 100; i++ { item := oddEven{Input: i, IsEven: even(i)} - _, err = col.Append(item) + _, err = col.Insert(item) if err != nil { t.Fatalf(`Could not append item with wrapper %s: %q`, wrapper, err) } @@ -1074,7 +1074,7 @@ func TestExplicitAndDefaultMapping(t *testing.T) { CaseTest: "Hello!", } - if _, err = col.Append(testE); err != nil { + if _, err = col.Insert(testE); err != nil { t.Fatal(err) } @@ -1103,7 +1103,7 @@ func TestExplicitAndDefaultMapping(t *testing.T) { Case_TEST: "World!", } - if _, err = col.Append(testN); err != nil { + if _, err = col.Insert(testN); err != nil { t.Fatal(err) } diff --git a/internal/adapter/nonexistent.go b/internal/adapter/nonexistent.go index be4dc808..94e02e05 100644 --- a/internal/adapter/nonexistent.go +++ b/internal/adapter/nonexistent.go @@ -50,8 +50,8 @@ type NonExistentResult struct { Err error } -// Append returns error. -func (c *NonExistentCollection) Append(interface{}) (interface{}, error) { +// Insert returns error. +func (c *NonExistentCollection) Insert(interface{}) (interface{}, error) { return nil, err(c.Err) } diff --git a/internal/testing/adapter.go.tpl b/internal/testing/adapter.go.tpl index 3bf88f4a..d1a0f773 100644 --- a/internal/testing/adapter.go.tpl +++ b/internal/testing/adapter.go.tpl @@ -121,7 +121,7 @@ func TestExpectCursorError(t *testing.T) { assert.Error(t, err) } -func TestAppendToArtistsTable(t *testing.T) { +func TestInsertIntoArtistsTable(t *testing.T) { sess := mustOpen() defer sess.Close() @@ -131,7 +131,7 @@ func TestAppendToArtistsTable(t *testing.T) { "name": "Ozzie", } - id, err := artist.Append(itemMap) + id, err := artist.Insert(itemMap) assert.NoError(t, err) assert.NotNil(t, id) @@ -146,7 +146,7 @@ func TestAppendToArtistsTable(t *testing.T) { "Flea", } - id, err = artist.Append(itemStruct) + id, err = artist.Insert(itemStruct) assert.NoError(t, err) assert.NotNil(t, id) @@ -161,7 +161,7 @@ func TestAppendToArtistsTable(t *testing.T) { "Slash", } - id, err = artist.Append(itemStruct2) + id, err = artist.Insert(itemStruct2) assert.NoError(t, err) assert.NotNil(t, id) @@ -174,7 +174,7 @@ func TestAppendToArtistsTable(t *testing.T) { Name: "Janus", } - _, err = artist.Append(&itemStruct3) + _, err = artist.Insert(&itemStruct3) assert.NoError(t, err) if Adapter != "ql" { assert.NotZero(t, itemStruct3.id) @@ -418,7 +418,7 @@ func TestInlineStructs(t *testing.T) { rec.Details.Created = time.Date(2016, time.January, 1, 2, 3, 4, 0, time.UTC) } - id, err := review.Append(rec) + id, err := review.Insert(rec) assert.NoError(t, err) assert.NotZero(t, id.(int64)) @@ -608,7 +608,7 @@ func TestNullableFields(t *testing.T) { NullBoolTest: sql.NullBool{false, false}, } - id, err := col.Append(testType{}) + id, err := col.Insert(testType{}) assert.NoError(t, err) // Testing fetching of invalid nulls. @@ -631,7 +631,7 @@ func TestNullableFields(t *testing.T) { NullBoolTest: sql.NullBool{false, true}, } - id, err = col.Append(test) + id, err = col.Insert(test) assert.NoError(t, err) // Testing fetching of valid nulls. @@ -664,7 +664,7 @@ func TestGroup(t *testing.T) { // Adding row append. for i := 0; i < 100; i++ { numeric, value := rand.Intn(5), rand.Intn(100) - _, err := stats.Append(statsType{numeric, value}) + _, err := stats.Insert(statsType{numeric, value}) assert.NoError(t, err) } @@ -726,7 +726,7 @@ func TestCompositeKeys(t *testing.T) { "Some value", } - _, err := compositeKeys.Append(&item) + _, err := compositeKeys.Insert(&item) assert.NoError(t, err) // Using constrainer interface. @@ -759,7 +759,7 @@ func TestTransactionsAndRollback(t *testing.T) { assert.NoError(t, err) // Simple transaction - _, err = artist.Append(artistType{1, "First"}) + _, err = artist.Insert(artistType{1, "First"}) assert.NoError(t, err) err = tx.Commit() @@ -777,15 +777,15 @@ func TestTransactionsAndRollback(t *testing.T) { artist = tx.Collection("artist") - _, err = artist.Append(artistType{2, "Second"}) + _, err = artist.Insert(artistType{2, "Second"}) assert.NoError(t, err) // Won't fail. - _, err = artist.Append(artistType{3, "Third"}) + _, err = artist.Insert(artistType{3, "Third"}) assert.NoError(t, err) // Will fail. - _, err = artist.Append(artistType{1, "Duplicated"}) + _, err = artist.Insert(artistType{1, "Duplicated"}) assert.Error(t, err) err = tx.Rollback() @@ -811,11 +811,11 @@ func TestTransactionsAndRollback(t *testing.T) { artist = tx.Collection("artist") // Won't fail. - _, err = artist.Append(artistType{2, "Second"}) + _, err = artist.Insert(artistType{2, "Second"}) assert.NoError(t, err) // Won't fail. - _, err = artist.Append(artistType{3, "Third"}) + _, err = artist.Insert(artistType{3, "Third"}) assert.NoError(t, err) // Then rollback for no reason. @@ -842,11 +842,11 @@ func TestTransactionsAndRollback(t *testing.T) { artist = tx.Collection("artist") // Won't fail. - _, err = artist.Append(artistType{2, "Second"}) + _, err = artist.Insert(artistType{2, "Second"}) assert.NoError(t, err) // Won't fail. - _, err = artist.Append(artistType{3, "Third"}) + _, err = artist.Insert(artistType{3, "Third"}) assert.NoError(t, err) err = tx.Commit() @@ -905,7 +905,7 @@ func TestDataTypes(t *testing.T) { err := dataTypes.Truncate() assert.NoError(t, err) - // Appending our test subject. + // Inserting our test subject. loc, err := time.LoadLocation(testTimeZone) assert.NoError(t, err) @@ -930,7 +930,7 @@ func TestDataTypes(t *testing.T) { nil, int64(time.Second * time.Duration(7331)), } - id, err := dataTypes.Append(testValues) + id, err := dataTypes.Insert(testValues) assert.NoError(t, err) assert.NotNil(t, id) diff --git a/internal/testing/adapter_benchmark.go.tpl b/internal/testing/adapter_benchmark.go.tpl index d1314a9b..9e18e054 100644 --- a/internal/testing/adapter_benchmark.go.tpl +++ b/internal/testing/adapter_benchmark.go.tpl @@ -44,7 +44,7 @@ func connectAndAddFakeRows() (db.Database, error) { for i := 0; i < testRows; i++ { value := valueT{artistN(i)} - if _, err := sess.Collection("artist").Append(value); err != nil { + if _, err := sess.Collection("artist").Insert(value); err != nil { return nil, err } } @@ -52,7 +52,7 @@ func connectAndAddFakeRows() (db.Database, error) { return sess, nil } -func BenchmarkUpperAppend(b *testing.B) { +func BenchmarkUpperInsert(b *testing.B) { sess := mustOpen() defer sess.Close() @@ -65,13 +65,13 @@ func BenchmarkUpperAppend(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { - if _, err := artist.Append(item); err != nil { + if _, err := artist.Insert(item); err != nil { b.Fatal(err) } } } -func BenchmarkUpperAppendVariableArgs(b *testing.B) { +func BenchmarkUpperInsertVariableArgs(b *testing.B) { sess := mustOpen() defer sess.Close() @@ -83,13 +83,13 @@ func BenchmarkUpperAppendVariableArgs(b *testing.B) { item := struct { Name string `db:"name"` }{fmt.Sprintf("Hayao Miyazaki %d", rand.Int())} - if _, err := artist.Append(item); err != nil { + if _, err := artist.Insert(item); err != nil { b.Fatal(err) } } } -func BenchmarkUpperAppendTransaction(b *testing.B) { +func BenchmarkUpperInsertTransaction(b *testing.B) { sess := mustOpen() defer sess.Close() @@ -111,7 +111,7 @@ func BenchmarkUpperAppendTransaction(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { - if _, err = artist.Append(item); err != nil { + if _, err = artist.Insert(item); err != nil { b.Fatal(err) } } @@ -121,7 +121,7 @@ func BenchmarkUpperAppendTransaction(b *testing.B) { } } -func BenchmarkUpperAppendTransactionWithMap(b *testing.B) { +func BenchmarkUpperInsertTransactionWithMap(b *testing.B) { sess := mustOpen() defer sess.Close() @@ -143,7 +143,7 @@ func BenchmarkUpperAppendTransactionWithMap(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { - if _, err = artist.Append(item); err != nil { + if _, err = artist.Insert(item); err != nil { b.Fatal(err) } } @@ -291,7 +291,7 @@ func BenchmarkUpperCommitManyTransactions(b *testing.B) { Name string `db:"name"` }{"Hayao Miyazaki"} - if _, err = artist.Append(item); err != nil { + if _, err = artist.Insert(item); err != nil { b.Fatal(err) } @@ -329,7 +329,7 @@ func BenchmarkUpperRollbackManyTransactions(b *testing.B) { Name string `db:"name"` }{"Hayao Miyazaki"} - if _, err = artist.Append(item); err != nil { + if _, err = artist.Insert(item); err != nil { b.Fatal(err) } diff --git a/mongo/benchmark_test.go b/mongo/benchmark_test.go index ca6d3a81..f6da03e6 100644 --- a/mongo/benchmark_test.go +++ b/mongo/benchmark_test.go @@ -46,7 +46,7 @@ func connectAndAddFakeRows() (db.Database, error) { return sess, nil } -func BenchmarkMgoAppend(b *testing.B) { +func BenchmarkMgoInsert(b *testing.B) { var err error var sess db.Database @@ -70,8 +70,8 @@ func BenchmarkMgoAppend(b *testing.B) { } } -// BenchmarkUpperAppend benchmarks an insertion by upper.io/db.v2. -func BenchmarkUpperAppend(b *testing.B) { +// BenchmarkUpperInsert benchmarks an insertion by upper.io/db.v2. +func BenchmarkUpperInsert(b *testing.B) { sess, err := db.Open(Adapter, settings) if err != nil { @@ -90,15 +90,15 @@ func BenchmarkUpperAppend(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { - if _, err = artist.Append(item); err != nil { + if _, err = artist.Insert(item); err != nil { b.Fatal(err) } } } -// BenchmarkUpperAppendVariableArgs benchmarks an insertion by upper.io/db.v2 +// BenchmarkUpperInsertVariableArgs benchmarks an insertion by upper.io/db.v2 // with variable parameters. -func BenchmarkUpperAppendVariableArgs(b *testing.B) { +func BenchmarkUpperInsertVariableArgs(b *testing.B) { sess, err := db.Open(Adapter, settings) if err != nil { @@ -116,7 +116,7 @@ func BenchmarkUpperAppendVariableArgs(b *testing.B) { item := struct { Name string `bson:"name"` }{fmt.Sprintf("Hayao Miyazaki %d", rand.Int())} - if _, err = artist.Append(item); err != nil { + if _, err = artist.Insert(item); err != nil { b.Fatal(err) } } diff --git a/mongo/collection.go b/mongo/collection.go index 78783588..984a77b0 100644 --- a/mongo/collection.go +++ b/mongo/collection.go @@ -209,8 +209,8 @@ func (col *Collection) Truncate() error { return nil } -// Append inserts an item (map or struct) into the collection. -func (col *Collection) Append(item interface{}) (interface{}, error) { +// Insert inserts an item (map or struct) into the collection. +func (col *Collection) Insert(item interface{}) (interface{}, error) { var err error id := getID(item) diff --git a/mongo/database_test.go b/mongo/database_test.go index 7052b39d..87a2fcd3 100644 --- a/mongo/database_test.go +++ b/mongo/database_test.go @@ -238,7 +238,7 @@ func TestTruncate(t *testing.T) { } // This test appends some data into the "artist" table. -func TestAppend(t *testing.T) { +func TestInsert(t *testing.T) { var err error var id interface{} @@ -256,13 +256,13 @@ func TestAppend(t *testing.T) { // Getting a pointer to the "artist" collection. artist := sess.Collection("artist") - // Appending a map. - id, err = artist.Append(map[string]string{ + // Inserting a map. + id, err = artist.Insert(map[string]string{ "name": "Ozzie", }) if err != nil { - t.Fatalf("Append(): %s", err.Error()) + t.Fatalf("Insert(): %s", err.Error()) } if id == nil { @@ -277,8 +277,8 @@ func TestAppend(t *testing.T) { t.Fatalf("Expecting a valid bson.ObjectId.") } - // Appending a struct. - id, err = artist.Append(struct { + // Inserting a struct. + id, err = artist.Insert(struct { Name string }{ "Flea", @@ -296,8 +296,8 @@ func TestAppend(t *testing.T) { t.Fatalf("Expecting a valid bson.ObjectId.") } - // Appending a struct (using tags to specify the field name). - id, err = artist.Append(struct { + // Inserting a struct (using tags to specify the field name). + id, err = artist.Insert(struct { ArtistName string `bson:"name"` }{ "Slash", @@ -315,8 +315,8 @@ func TestAppend(t *testing.T) { t.Fatalf("Expecting a valid bson.ObjectId.") } - // Appending a pointer to a struct - id, err = artist.Append(&struct { + // Inserting a pointer to a struct + id, err = artist.Insert(&struct { ArtistName string `bson:"name"` }{ "Metallica", @@ -334,8 +334,8 @@ func TestAppend(t *testing.T) { t.Fatalf("Expecting a valid bson.ObjectId.") } - // Appending a pointer to a map - id, err = artist.Append(&map[string]string{ + // Inserting a pointer to a map + id, err = artist.Insert(&map[string]string{ "name": "Freddie", }) @@ -356,7 +356,7 @@ func TestAppend(t *testing.T) { Name: "Janus", } - if _, err = artist.Append(&itemStruct3); err != nil { + if _, err = artist.Insert(&itemStruct3); err != nil { t.Fatal(err) } @@ -436,7 +436,7 @@ func TestGroup(t *testing.T) { // Adding row append. for i := 0; i < 1000; i++ { numeric, value := rand.Intn(10), rand.Intn(100) - if _, err = stats.Append(statsT{numeric, value}); err != nil { + if _, err = stats.Insert(statsT{numeric, value}); err != nil { t.Fatal(err) } } @@ -846,7 +846,7 @@ func TestSetterAndConstrainer(t *testing.T) { SomeVal: "Some value", } - if id, err = compositeKeys.Append(&item); err != nil { + if id, err = compositeKeys.Insert(&item); err != nil { t.Fatal(err) } @@ -898,8 +898,8 @@ func TestDataTypes(t *testing.T) { // Getting a pointer to the "data_types" collection. dataTypes := sess.Collection("data_types") - // Appending our test subject. - id, err := dataTypes.Append(testValues) + // Inserting our test subject. + id, err := dataTypes.Insert(testValues) if err != nil { t.Fatal(err) diff --git a/mysql/collection.go b/mysql/collection.go index 2a1337b9..804f529e 100644 --- a/mysql/collection.go +++ b/mysql/collection.go @@ -49,8 +49,8 @@ func (t *table) Truncate() error { return nil } -// Append inserts an item (map or struct) into the collection. -func (t *table) Append(item interface{}) (interface{}, error) { +// Insert inserts an item (map or struct) into the collection. +func (t *table) Insert(item interface{}) (interface{}, error) { columnNames, columnValues, err := sqlbuilder.Map(item) if err != nil { return nil, err diff --git a/mysql/connection.go b/mysql/connection.go index 8418f5eb..583f721d 100644 --- a/mysql/connection.go +++ b/mysql/connection.go @@ -108,7 +108,7 @@ func (c ConnectionURL) String() (s string) { vv.Set(k, v) } - // Appending options. + // Inserting options. if p := vv.Encode(); p != "" { s = s + "?" + p } diff --git a/postgresql/adapter_test.go b/postgresql/adapter_test.go index 47fd8a1c..96de3d51 100644 --- a/postgresql/adapter_test.go +++ b/postgresql/adapter_test.go @@ -168,7 +168,7 @@ func TestOptionTypes(t *testing.T) { Settings: map[string]interface{}{"a": 1, "b": 2}, } - id, err := optionTypes.Append(item1) + id, err := optionTypes.Insert(item1) assert.NoError(t, err) if pk, ok := id.(int64); !ok || pk == 0 { @@ -189,7 +189,7 @@ func TestOptionTypes(t *testing.T) { Settings: map[string]interface{}{"go": 1, "lang": 2}, } - id, err = optionTypes.Append(item1b) + id, err = optionTypes.Insert(item1b) assert.NoError(t, err) if pk, ok := id.(int64); !ok || pk == 0 { @@ -208,7 +208,7 @@ func TestOptionTypes(t *testing.T) { Name: "Sup", Tags: []string{}, Settings: map[string]interface{}{}, } - id, err = optionTypes.Append(item1c) + id, err = optionTypes.Insert(item1c) assert.NoError(t, err) if pk, ok := id.(int64); !ok || pk == 0 { @@ -234,7 +234,7 @@ func TestOptionTypes(t *testing.T) { Name: "JS", Tags: []string{"hi", "bye"}, Settings: nil, } - id, err = optionTypes.Append(item2) + id, err = optionTypes.Insert(item2) assert.NoError(t, err) if pk, ok := id.(int64); !ok || pk == 0 { @@ -282,7 +282,7 @@ func TestOptionTypes(t *testing.T) { Settings: map[string]interface{}{"girl": true, "lang": true}, } - id, err = optionTypes.Append(item3) + id, err = optionTypes.Insert(item3) assert.NoError(t, err) if pk, ok := id.(int64); !ok || pk == 0 { @@ -323,7 +323,7 @@ func TestOptionTypeJsonbStruct(t *testing.T) { Settings: Settings{Name: "a", Num: 123}, } - id, err := optionTypes.Append(item1) + id, err := optionTypes.Insert(item1) assert.NoError(t, err) if pk, ok := id.(int64); !ok || pk == 0 { diff --git a/postgresql/collection.go b/postgresql/collection.go index 229096f5..9bef1e9c 100644 --- a/postgresql/collection.go +++ b/postgresql/collection.go @@ -49,8 +49,8 @@ func (t *table) Truncate() error { return nil } -// Append inserts an item (map or struct) into the collection. -func (t *table) Append(item interface{}) (interface{}, error) { +// Insert inserts an item (map or struct) into the collection. +func (t *table) Insert(item interface{}) (interface{}, error) { columnNames, columnValues, err := sqlbuilder.Map(item) if err != nil { return nil, err diff --git a/ql/collection.go b/ql/collection.go index 2b224227..a853b0a5 100644 --- a/ql/collection.go +++ b/ql/collection.go @@ -49,8 +49,8 @@ func (t *table) Truncate() error { return nil } -// Append inserts an item (map or struct) into the collection. -func (t *table) Append(item interface{}) (interface{}, error) { +// Insert inserts an item (map or struct) into the collection. +func (t *table) Insert(item interface{}) (interface{}, error) { columnNames, columnValues, err := sqlbuilder.Map(item) if err != nil { return nil, err diff --git a/sqlite/collection.go b/sqlite/collection.go index 81c2d397..603f0c82 100644 --- a/sqlite/collection.go +++ b/sqlite/collection.go @@ -49,8 +49,8 @@ func (t *table) Truncate() error { return nil } -// Append inserts an item (map or struct) into the collection. -func (t *table) Append(item interface{}) (interface{}, error) { +// Insert inserts an item (map or struct) into the collection. +func (t *table) Insert(item interface{}) (interface{}, error) { columnNames, columnValues, err := sqlbuilder.Map(item) if err != nil { return nil, err -- GitLab