From afb89f55b6dcf2ecb2a429ad31da93ac93587c3e Mon Sep 17 00:00:00 2001 From: yanosea Date: Tue, 8 Oct 2024 13:30:35 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8test:=20update=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactor 'Jrp' slice to pointer slice in 'repository', 'generator', 'jrpwriter', and 'commands' for better performance and memory management. Update mocks accordingly. --- .../jrp/repository/repository_test.go | 715 ++++++++++-------- app/library/jrpwriter/jrpwriter_test.go | 24 +- cmd/favorite_add_test.go | 124 +-- cmd/favorite_clear_test.go | 24 +- cmd/favorite_remove_test.go | 192 ++--- cmd/favorite_search_test.go | 64 +- cmd/favorite_show_test.go | 40 +- cmd/favorite_test.go | 40 +- cmd/generate_test.go | 36 +- cmd/history_clear_test.go | 56 +- cmd/history_remove_test.go | 268 +++---- cmd/history_search_test.go | 184 ++--- cmd/history_show_test.go | 159 ++-- cmd/history_test.go | 38 +- cmd/root_test.go | 120 +-- docs/coverage.html | 156 ++-- test/testutility/jrpchecker_test.go | 54 +- 17 files changed, 1187 insertions(+), 1107 deletions(-) diff --git a/app/database/jrp/repository/repository_test.go b/app/database/jrp/repository/repository_test.go index 48ec623e..24c373c4 100644 --- a/app/database/jrp/repository/repository_test.go +++ b/app/database/jrp/repository/repository_test.go @@ -102,14 +102,14 @@ func TestJrpRepository_SaveHistory(t *testing.T) { } type args struct { jrpDBFilePath string - jrps []model.Jrp + jrps []*model.Jrp } tests := []struct { name string fields fields args args wantStatus SaveStatus - wantJrps []model.Jrp + wantJrps []*model.Jrp wantErr bool setup func(mockCtrl *gomock.Controller, tt *fields) cleanup func() @@ -150,7 +150,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{}, + jrps: []*model.Jrp{}, }, wantStatus: SavedNone, wantJrps: nil, @@ -176,7 +176,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -187,7 +187,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { }, }, wantStatus: SavedSuccessfully, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -219,7 +219,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -237,7 +237,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { }, }, wantStatus: SavedSuccessfully, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -277,7 +277,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test2", Prefix: sqlProxy.StringToNullString(""), @@ -288,7 +288,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { }, }, wantStatus: SavedSuccessfully, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -313,7 +313,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -343,7 +343,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test2", Prefix: sqlProxy.StringToNullString(""), @@ -361,7 +361,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { }, }, wantStatus: SavedSuccessfully, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -394,7 +394,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -423,7 +423,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { StringsProxy: stringsproxy.New(), }, args: args{ - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -459,7 +459,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { StringsProxy: stringsproxy.New(), }, args: args{ - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -498,7 +498,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { StringsProxy: stringsproxy.New(), }, args: args{ - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -538,7 +538,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { StringsProxy: stringsproxy.New(), }, args: args{ - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -581,7 +581,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { StringsProxy: stringsproxy.New(), }, args: args{ - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -627,7 +627,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { StringsProxy: stringsproxy.New(), }, args: args{ - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -666,6 +666,55 @@ func TestJrpRepository_SaveHistory(t *testing.T) { } }, }, + { + name: "negative testing (res.LastInsertId() failed)", + fields: fields{ + FmtProxy: fmtproxy.New(), + SortProxy: sortproxy.New(), + SqlProxy: nil, + StringsProxy: stringsproxy.New(), + }, + args: args{ + jrps: []*model.Jrp{ + { + Phrase: "test1", + Prefix: sqlProxy.StringToNullString(""), + Suffix: sqlProxy.StringToNullString(""), + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + }, + }, + wantStatus: SavedFailed, + wantJrps: nil, + wantErr: true, + setup: func(mockCtrl *gomock.Controller, tt *fields) { + if err := osProxy.RemoveAll(jrpDBFilePath); err != nil { + t.Errorf("Os.RemoveAll() : error =\n%v", err) + } + mockResultInstance := mocksqlproxy.NewMockResultInstanceInterface(mockCtrl) + mockResultInstance.EXPECT().RowsAffected().Return(int64(0), nil) + mockResultInstance.EXPECT().LastInsertId().Return(int64(0), errors.New("ResultInstance.LastInsertId() failed")) + mockStmtInstance := mocksqlproxy.NewMockStmtInstanceInterface(mockCtrl) + mockStmtInstance.EXPECT().Exec(gomock.Any()).Return(mockResultInstance, nil) + mockStmtInstance.EXPECT().Close().Return(nil) + mockTxInstance := mocksqlproxy.NewMockTxInstanceInterface(mockCtrl) + mockTxInstance.EXPECT().Rollback().Return(nil) + mockDBInstance := mocksqlproxy.NewMockDBInstanceInterface(mockCtrl) + mockDBInstance.EXPECT().Exec(gomock.Any()).Return(&sqlproxy.ResultInstance{}, nil) + mockDBInstance.EXPECT().Begin().Return(mockTxInstance, nil) + mockDBInstance.EXPECT().Prepare(gomock.Any()).Return(mockStmtInstance, nil) + mockDBInstance.EXPECT().Close().Return(nil) + mockSqlProxy := mocksqlproxy.NewMockSql(mockCtrl) + mockSqlProxy.EXPECT().Open(gomock.Any(), gomock.Any()).Return(mockDBInstance, nil) + tt.SqlProxy = mockSqlProxy + }, + cleanup: func() { + if err := osProxy.RemoveAll(jrpDBFilePath); err != nil { + t.Errorf("Os.RemoveAll() : error =\n%v", err) + } + }, + }, { name: "negative testing (tx.Commit() failed)", fields: fields{ @@ -675,7 +724,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { StringsProxy: stringsproxy.New(), }, args: args{ - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -694,6 +743,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { } mockResultInstance := mocksqlproxy.NewMockResultInstanceInterface(mockCtrl) mockResultInstance.EXPECT().RowsAffected().Return(int64(0), nil) + mockResultInstance.EXPECT().LastInsertId().Return(int64(0), nil) mockStmtInstance := mocksqlproxy.NewMockStmtInstanceInterface(mockCtrl) mockStmtInstance.EXPECT().Exec(gomock.Any()).Return(mockResultInstance, nil) mockStmtInstance.EXPECT().Close().Return(nil) @@ -724,7 +774,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { StringsProxy: stringsproxy.New(), }, args: args{ - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -743,6 +793,7 @@ func TestJrpRepository_SaveHistory(t *testing.T) { } mockResultInstance := mocksqlproxy.NewMockResultInstanceInterface(mockCtrl) mockResultInstance.EXPECT().RowsAffected().Return(int64(10), nil) + mockResultInstance.EXPECT().LastInsertId().Return(int64(0), nil) mockStmtInstance := mocksqlproxy.NewMockStmtInstanceInterface(mockCtrl) mockStmtInstance.EXPECT().Exec(gomock.Any()).Return(mockResultInstance, nil) mockStmtInstance.EXPECT().Close().Return(nil) @@ -842,7 +893,7 @@ func TestJrpRepository_GetAllHistory(t *testing.T) { name string fields fields args args - want []model.Jrp + want []*model.Jrp wantErr bool setup func(mockCtrl *gomock.Controller, tt *fields) cleanup func() @@ -884,7 +935,7 @@ func TestJrpRepository_GetAllHistory(t *testing.T) { args: args{ jrpDBFilePath: jrpDBFilePath, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -901,7 +952,7 @@ func TestJrpRepository_GetAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -932,7 +983,7 @@ func TestJrpRepository_GetAllHistory(t *testing.T) { args: args{ jrpDBFilePath: jrpDBFilePath, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -957,7 +1008,7 @@ func TestJrpRepository_GetAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1003,7 +1054,7 @@ func TestJrpRepository_GetAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1045,7 +1096,7 @@ func TestJrpRepository_GetAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1090,7 +1141,7 @@ func TestJrpRepository_GetAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1136,7 +1187,7 @@ func TestJrpRepository_GetAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1237,7 +1288,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { name string fields fields args args - want []model.Jrp + want []*model.Jrp wantErr bool setup func(mockCtrl *gomock.Controller, tt *fields) cleanup func() @@ -1362,7 +1413,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1401,7 +1452,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1432,7 +1483,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { jrpDBFilePath: jrpDBFilePath, number: 1, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1449,7 +1500,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1480,7 +1531,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { jrpDBFilePath: jrpDBFilePath, number: 2, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1497,7 +1548,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1536,7 +1587,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1582,7 +1633,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1620,7 +1671,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { jrpDBFilePath: jrpDBFilePath, number: 1, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 2, Phrase: "test2", @@ -1637,7 +1688,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1675,7 +1726,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { jrpDBFilePath: jrpDBFilePath, number: 2, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1700,7 +1751,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1746,7 +1797,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1788,7 +1839,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1833,7 +1884,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1879,7 +1930,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1928,7 +1979,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1973,7 +2024,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { jrpDBFilePath: jrpDBFilePath, number: 2, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 2, Phrase: "test2", @@ -1998,7 +2049,7 @@ func TestJrpRepository_GetHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2099,7 +2150,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { name string fields fields args args - want []model.Jrp + want []*model.Jrp wantErr bool setup func(mockCtrl *gomock.Controller, tt *fields) cleanup func() @@ -2125,7 +2176,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2165,7 +2216,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2205,7 +2256,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2245,7 +2296,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2285,7 +2336,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2325,7 +2376,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2357,7 +2408,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { keywords: []string{"test"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2374,7 +2425,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2406,7 +2457,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { keywords: []string{"test"}, and: true, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2423,7 +2474,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2455,7 +2506,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { keywords: []string{"test"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2480,7 +2531,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2519,7 +2570,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { keywords: []string{"test"}, and: true, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2544,7 +2595,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2583,7 +2634,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛", @@ -2600,7 +2651,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -2639,7 +2690,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛として時雨", @@ -2656,7 +2707,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨", Prefix: sqlProxy.StringToNullString(""), @@ -2695,7 +2746,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛", @@ -2720,7 +2771,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -2766,7 +2817,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛として時雨1", @@ -2791,7 +2842,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨1", Prefix: sqlProxy.StringToNullString(""), @@ -2845,7 +2896,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2888,7 +2939,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2933,7 +2984,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2980,7 +3031,7 @@ func TestJrpRepository_SearchAllHistory(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3083,7 +3134,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { name string fields fields args args - want []model.Jrp + want []*model.Jrp wantErr bool setup func(*gomock.Controller, *fields) cleanup func() @@ -3110,7 +3161,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3151,7 +3202,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3192,7 +3243,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3233,7 +3284,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3274,7 +3325,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3315,7 +3366,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3356,7 +3407,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3389,7 +3440,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { keywords: []string{"test"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -3406,7 +3457,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3439,7 +3490,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { keywords: []string{"test"}, and: true, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -3456,7 +3507,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3489,7 +3540,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { keywords: []string{"test"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -3514,7 +3565,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3554,7 +3605,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { keywords: []string{"test"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 2, Phrase: "test2", @@ -3571,7 +3622,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3611,7 +3662,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { keywords: []string{"test"}, and: true, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -3636,7 +3687,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3676,7 +3727,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { keywords: []string{"test"}, and: true, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 2, Phrase: "test2", @@ -3693,7 +3744,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3733,7 +3784,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛", @@ -3750,7 +3801,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -3790,7 +3841,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛として時雨", @@ -3807,7 +3858,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨", Prefix: sqlProxy.StringToNullString(""), @@ -3847,7 +3898,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛", @@ -3872,7 +3923,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -3919,7 +3970,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 2, Phrase: "時雨", @@ -3936,7 +3987,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -3983,7 +4034,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛として時雨1", @@ -4008,7 +4059,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨1", Prefix: sqlProxy.StringToNullString(""), @@ -4055,7 +4106,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 2, Phrase: "凛として時雨2", @@ -4072,7 +4123,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨1", Prefix: sqlProxy.StringToNullString(""), @@ -4127,7 +4178,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4171,7 +4222,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4218,7 +4269,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4266,7 +4317,7 @@ func TestJrpRepository_SearchHistoryWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4394,7 +4445,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4434,7 +4485,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4474,7 +4525,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4514,7 +4565,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4554,7 +4605,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4597,7 +4648,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4637,7 +4688,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4680,7 +4731,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4720,7 +4771,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4767,7 +4818,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4817,7 +4868,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4867,7 +4918,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4914,7 +4965,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4964,7 +5015,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5014,7 +5065,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5057,7 +5108,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5103,7 +5154,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5150,7 +5201,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5200,7 +5251,7 @@ func TestJrpRepository_RemoveHistoryByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5375,7 +5426,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5416,7 +5467,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5460,7 +5511,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5508,7 +5559,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5559,7 +5610,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5637,7 +5688,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5678,7 +5729,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5722,7 +5773,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5770,7 +5821,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5821,7 +5872,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5872,7 +5923,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5916,7 +5967,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5963,7 +6014,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -6011,7 +6062,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -6062,7 +6113,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -6117,7 +6168,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -6173,7 +6224,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -6230,7 +6281,7 @@ func TestJrpRepository_RemoveHistoryAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -6350,7 +6401,7 @@ func TestJrpRepository_GetAllFavorite(t *testing.T) { name string fields fields args args - want []model.Jrp + want []*model.Jrp wantErr bool setup func(mockCtrl *gomock.Controller, tt *fields) cleanup func() @@ -6398,7 +6449,7 @@ func TestJrpRepository_GetAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -6428,7 +6479,7 @@ func TestJrpRepository_GetAllFavorite(t *testing.T) { args: args{ jrpDBFilePath: jrpDBFilePath, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -6446,7 +6497,7 @@ func TestJrpRepository_GetAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -6487,7 +6538,7 @@ func TestJrpRepository_GetAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -6524,7 +6575,7 @@ func TestJrpRepository_GetAllFavorite(t *testing.T) { args: args{ jrpDBFilePath: jrpDBFilePath, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -6551,7 +6602,7 @@ func TestJrpRepository_GetAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -6591,7 +6642,7 @@ func TestJrpRepository_GetAllFavorite(t *testing.T) { args: args{ jrpDBFilePath: jrpDBFilePath, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -6609,7 +6660,7 @@ func TestJrpRepository_GetAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -6657,7 +6708,7 @@ func TestJrpRepository_GetAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -6701,7 +6752,7 @@ func TestJrpRepository_GetAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -6745,7 +6796,7 @@ func TestJrpRepository_GetAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -6790,7 +6841,7 @@ func TestJrpRepository_GetAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -6891,7 +6942,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { name string fields fields args args - want []model.Jrp + want []*model.Jrp wantErr bool setup func(mockCtrl *gomock.Controller, tt *fields) cleanup func() @@ -7016,7 +7067,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7058,7 +7109,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7100,7 +7151,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7131,7 +7182,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { jrpDBFilePath: jrpDBFilePath, number: 1, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -7149,7 +7200,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7191,7 +7242,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7222,7 +7273,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { jrpDBFilePath: jrpDBFilePath, number: 2, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -7240,7 +7291,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7282,7 +7333,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7331,7 +7382,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7369,7 +7420,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { jrpDBFilePath: jrpDBFilePath, number: 1, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -7387,7 +7438,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7436,7 +7487,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7474,7 +7525,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { jrpDBFilePath: jrpDBFilePath, number: 2, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -7501,7 +7552,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7542,7 +7593,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { jrpDBFilePath: jrpDBFilePath, number: 2, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -7560,7 +7611,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7609,7 +7660,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7654,7 +7705,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7702,7 +7753,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7751,7 +7802,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7803,7 +7854,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7851,7 +7902,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { jrpDBFilePath: jrpDBFilePath, number: 2, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 2, Phrase: "test2", @@ -7878,7 +7929,7 @@ func TestJrpRepository_GetFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -7982,7 +8033,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { name string fields fields args args - want []model.Jrp + want []*model.Jrp wantErr bool setup func(mockCtrl *gomock.Controller, tt *fields) cleanup func() @@ -8008,7 +8059,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -8051,7 +8102,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -8094,7 +8145,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -8137,7 +8188,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -8180,7 +8231,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -8223,7 +8274,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -8266,7 +8317,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -8298,7 +8349,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { keywords: []string{"test"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -8316,7 +8367,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -8359,7 +8410,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -8391,7 +8442,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { keywords: []string{"test"}, and: true, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -8409,7 +8460,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -8452,7 +8503,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -8491,7 +8542,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { keywords: []string{"test"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -8518,7 +8569,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -8560,7 +8611,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { keywords: []string{"test"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -8578,7 +8629,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -8628,7 +8679,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -8667,7 +8718,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { keywords: []string{"test"}, and: true, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -8694,7 +8745,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -8736,7 +8787,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { keywords: []string{"test"}, and: true, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -8754,7 +8805,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -8804,7 +8855,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -8851,7 +8902,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -8890,7 +8941,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛", @@ -8908,7 +8959,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -8958,7 +9009,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨", Prefix: sqlProxy.StringToNullString(""), @@ -8997,7 +9048,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛として時雨", @@ -9015,7 +9066,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨", Prefix: sqlProxy.StringToNullString(""), @@ -9065,7 +9116,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -9111,7 +9162,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛", @@ -9138,7 +9189,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -9195,7 +9246,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨1", Prefix: sqlProxy.StringToNullString(""), @@ -9241,7 +9292,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛として時雨1", @@ -9268,7 +9319,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨1", Prefix: sqlProxy.StringToNullString(""), @@ -9317,7 +9368,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛として時雨1", @@ -9335,7 +9386,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨1", Prefix: sqlProxy.StringToNullString(""), @@ -9392,7 +9443,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -9438,7 +9489,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -9487,7 +9538,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -9537,7 +9588,7 @@ func TestJrpRepository_SearchAllFavorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -9643,7 +9694,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { name string fields fields args args - want []model.Jrp + want []*model.Jrp wantErr bool setup func(*gomock.Controller, *fields) cleanup func() @@ -9670,7 +9721,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -9714,7 +9765,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -9758,7 +9809,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -9802,7 +9853,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -9846,7 +9897,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -9890,7 +9941,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -9934,7 +9985,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -9978,7 +10029,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -10011,7 +10062,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"test"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -10029,7 +10080,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -10073,7 +10124,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -10106,7 +10157,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"test"}, and: true, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -10124,7 +10175,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -10168,7 +10219,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -10208,7 +10259,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"test"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -10235,7 +10286,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -10278,7 +10329,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"test"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -10296,7 +10347,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -10347,7 +10398,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -10387,7 +10438,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"test"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 2, Phrase: "test2", @@ -10405,7 +10456,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -10448,7 +10499,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"test"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -10466,7 +10517,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -10517,7 +10568,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -10557,7 +10608,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"test"}, and: true, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -10584,7 +10635,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -10627,7 +10678,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"test"}, and: true, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -10645,7 +10696,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -10696,7 +10747,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -10736,7 +10787,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"test"}, and: true, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 2, Phrase: "test2", @@ -10754,7 +10805,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -10797,7 +10848,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"test"}, and: true, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -10815,7 +10866,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -10866,7 +10917,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -10906,7 +10957,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛", @@ -10924,7 +10975,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -10975,7 +11026,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨", Prefix: sqlProxy.StringToNullString(""), @@ -11015,7 +11066,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛として時雨", @@ -11033,7 +11084,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨", Prefix: sqlProxy.StringToNullString(""), @@ -11084,7 +11135,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -11131,7 +11182,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛", @@ -11158,7 +11209,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -11208,7 +11259,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛", @@ -11226,7 +11277,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -11284,7 +11335,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -11331,7 +11382,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 2, Phrase: "時雨", @@ -11349,7 +11400,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -11399,7 +11450,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛", @@ -11417,7 +11468,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛", Prefix: sqlProxy.StringToNullString(""), @@ -11475,7 +11526,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨1", Prefix: sqlProxy.StringToNullString(""), @@ -11522,7 +11573,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛として時雨1", @@ -11549,7 +11600,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨1", Prefix: sqlProxy.StringToNullString(""), @@ -11599,7 +11650,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛として時雨1", @@ -11617,7 +11668,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨1", Prefix: sqlProxy.StringToNullString(""), @@ -11675,7 +11726,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨1", Prefix: sqlProxy.StringToNullString(""), @@ -11722,7 +11773,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 2, Phrase: "凛として時雨2", @@ -11740,7 +11791,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨1", Prefix: sqlProxy.StringToNullString(""), @@ -11790,7 +11841,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { keywords: []string{"凛", "時雨"}, and: false, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "凛として時雨1", @@ -11808,7 +11859,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "凛として時雨1", Prefix: sqlProxy.StringToNullString(""), @@ -11866,7 +11917,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -11913,7 +11964,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -11963,7 +12014,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12014,7 +12065,7 @@ func TestJrpRepository_SearchFavoriteWithNumber(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12143,7 +12194,7 @@ func TestJrpRepository_AddFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12182,7 +12233,7 @@ func TestJrpRepository_AddFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12221,7 +12272,7 @@ func TestJrpRepository_AddFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12260,7 +12311,7 @@ func TestJrpRepository_AddFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12299,7 +12350,7 @@ func TestJrpRepository_AddFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12341,7 +12392,7 @@ func TestJrpRepository_AddFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12380,7 +12431,7 @@ func TestJrpRepository_AddFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12426,7 +12477,7 @@ func TestJrpRepository_AddFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12475,7 +12526,7 @@ func TestJrpRepository_AddFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12517,7 +12568,7 @@ func TestJrpRepository_AddFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12562,7 +12613,7 @@ func TestJrpRepository_AddFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12608,7 +12659,7 @@ func TestJrpRepository_AddFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12656,7 +12707,7 @@ func TestJrpRepository_AddFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12799,7 +12850,7 @@ func TestJrpRepository_RemoveFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12841,7 +12892,7 @@ func TestJrpRepository_RemoveFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12883,7 +12934,7 @@ func TestJrpRepository_RemoveFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12925,7 +12976,7 @@ func TestJrpRepository_RemoveFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -12964,7 +13015,7 @@ func TestJrpRepository_RemoveFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13006,7 +13057,7 @@ func TestJrpRepository_RemoveFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13048,7 +13099,7 @@ func TestJrpRepository_RemoveFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13094,7 +13145,7 @@ func TestJrpRepository_RemoveFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13143,7 +13194,7 @@ func TestJrpRepository_RemoveFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13192,7 +13243,7 @@ func TestJrpRepository_RemoveFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13237,7 +13288,7 @@ func TestJrpRepository_RemoveFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13285,7 +13336,7 @@ func TestJrpRepository_RemoveFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13334,7 +13385,7 @@ func TestJrpRepository_RemoveFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13386,7 +13437,7 @@ func TestJrpRepository_RemoveFavoriteByIDs(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13554,7 +13605,7 @@ func TestJrpRepository_RemoveFavoriteAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13594,7 +13645,7 @@ func TestJrpRepository_RemoveFavoriteAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13637,7 +13688,7 @@ func TestJrpRepository_RemoveFavoriteAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13684,7 +13735,7 @@ func TestJrpRepository_RemoveFavoriteAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13734,7 +13785,7 @@ func TestJrpRepository_RemoveFavoriteAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13784,7 +13835,7 @@ func TestJrpRepository_RemoveFavoriteAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13830,7 +13881,7 @@ func TestJrpRepository_RemoveFavoriteAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13877,7 +13928,7 @@ func TestJrpRepository_RemoveFavoriteAll(t *testing.T) { if err := osProxy.RemoveAll(jrpDBFilePath); err != nil { t.Errorf("Os.RemoveAll() : error =\n%v", err) } - if _, err := jrpRepository.SaveHistory(jrpDBFilePath, []model.Jrp{ + if _, err := jrpRepository.SaveHistory(jrpDBFilePath, []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13927,7 +13978,7 @@ func TestJrpRepository_RemoveFavoriteAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -13980,7 +14031,7 @@ func TestJrpRepository_RemoveFavoriteAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -14035,7 +14086,7 @@ func TestJrpRepository_RemoveFavoriteAll(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), diff --git a/app/library/jrpwriter/jrpwriter_test.go b/app/library/jrpwriter/jrpwriter_test.go index d5dd6355..84eaadb7 100644 --- a/app/library/jrpwriter/jrpwriter_test.go +++ b/app/library/jrpwriter/jrpwriter_test.go @@ -93,7 +93,7 @@ func TestJrpWriter_WriteGenerateResultAsTable(t *testing.T) { fields: fields{ t: t, fnc: func() { - jrpWriter.WriteGenerateResultAsTable(osproxy.Stdout, []model.Jrp{}) + jrpWriter.WriteGenerateResultAsTable(osproxy.Stdout, []*model.Jrp{}) }, capturer: capturer, }, @@ -106,7 +106,7 @@ func TestJrpWriter_WriteGenerateResultAsTable(t *testing.T) { fields: fields{ t: t, fnc: func() { - jrps := []model.Jrp{ + jrps := []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString("prefix"), @@ -118,7 +118,7 @@ func TestJrpWriter_WriteGenerateResultAsTable(t *testing.T) { }, capturer: capturer, }, - wantStdOut: "PHRASE\tPREFIX\tSUFFIX\tCREATED AT\ntest\tprefix\tsuffix\t9999-12-31 00:00:00\n\t\t\t\nTOTAL : 1\t\t\t\n", + wantStdOut: "ID\tPHRASE\tPREFIX\tSUFFIX\tCREATED AT\n0\ttest\tprefix\tsuffix\t9999-12-31 00:00:00\n\t\t\t\nTOTAL : 1\t\t\t\n", wantStdErr: "", wantErr: false, }, @@ -127,7 +127,7 @@ func TestJrpWriter_WriteGenerateResultAsTable(t *testing.T) { fields: fields{ t: t, fnc: func() { - jrps := []model.Jrp{ + jrps := []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString("prefix1"), @@ -145,7 +145,7 @@ func TestJrpWriter_WriteGenerateResultAsTable(t *testing.T) { }, capturer: capturer, }, - wantStdOut: "PHRASE\tPREFIX\tSUFFIX\tCREATED AT\ntest1\tprefix1\tsuffix1\t9999-12-31 00:00:00\ntest2\tprefix2\tsuffix2\t9999-12-31 00:00:00\n\t\t\t\nTOTAL : 2\t\t\t\n", + wantStdOut: "ID\tPHRASE\tPREFIX\tSUFFIX\tCREATED AT\n0\ttest1\tprefix1\tsuffix1\t9999-12-31 00:00:00\n0\ttest2\tprefix2\tsuffix2\t9999-12-31 00:00:00\n\t\t\t\nTOTAL : 2\t\t\t\n", wantStdErr: "", wantErr: false, }, @@ -216,7 +216,7 @@ func TestJrpWriter_WriteAsTable(t *testing.T) { fields: fields{ t: t, fnc: func() { - jrpWriter.WriteAsTable(osproxy.Stdout, []model.Jrp{}) + jrpWriter.WriteAsTable(osproxy.Stdout, []*model.Jrp{}) }, capturer: capturer, }, @@ -229,7 +229,7 @@ func TestJrpWriter_WriteAsTable(t *testing.T) { fields: fields{ t: t, fnc: func() { - jrps := []model.Jrp{ + jrps := []*model.Jrp{ { ID: 1, Phrase: "test", @@ -252,7 +252,7 @@ func TestJrpWriter_WriteAsTable(t *testing.T) { fields: fields{ t: t, fnc: func() { - jrps := []model.Jrp{ + jrps := []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -315,7 +315,7 @@ func TestJrpWriter_writeTable(t *testing.T) { tablewriterproxy.New(), ) headers := []string{"phrase"} - rowFunc := func(jrp model.Jrp) []string { + rowFunc := func(jrp *model.Jrp) []string { return []string{ jrp.Phrase, } @@ -350,7 +350,7 @@ func TestJrpWriter_writeTable(t *testing.T) { fields: fields{ t: t, fnc: func() { - jrpWriter.writeTable(osproxy.Stdout, []model.Jrp{}, headers, rowFunc) + jrpWriter.writeTable(osproxy.Stdout, []*model.Jrp{}, headers, rowFunc) }, capturer: capturer, }, @@ -362,7 +362,7 @@ func TestJrpWriter_writeTable(t *testing.T) { fields: fields{ t: t, fnc: func() { - jrps := []model.Jrp{ + jrps := []*model.Jrp{ { Phrase: "test", }, @@ -378,7 +378,7 @@ func TestJrpWriter_writeTable(t *testing.T) { fields: fields{ t: t, fnc: func() { - jrps := []model.Jrp{ + jrps := []*model.Jrp{ { Phrase: "test1", }, { diff --git a/cmd/favorite_add_test.go b/cmd/favorite_add_test.go index 879d87ab..294135ce 100644 --- a/cmd/favorite_add_test.go +++ b/cmd/favorite_add_test.go @@ -116,7 +116,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { fields fields wantStdOut string wantStdErr string - wantJrps []model.Jrp + wantJrps []*model.Jrp wantErr bool setup func() cleanup func() @@ -218,7 +218,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -266,7 +266,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -314,7 +314,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -354,7 +354,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { }, wantStdOut: colorProxy.GreenString(constant.FAVORITE_ADD_MESSAGE_ADDED_SUCCESSFULLY) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -372,7 +372,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -412,7 +412,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NOT_ALL) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -430,7 +430,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -478,7 +478,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -533,7 +533,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -588,7 +588,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -635,7 +635,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { }, wantStdOut: colorProxy.GreenString(constant.FAVORITE_ADD_MESSAGE_ADDED_SUCCESSFULLY) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -662,7 +662,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -709,7 +709,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NOT_ALL) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 2, Phrase: "test2", @@ -727,7 +727,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -774,7 +774,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -792,7 +792,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -835,7 +835,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -853,7 +853,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -896,7 +896,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -914,7 +914,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -957,7 +957,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -984,7 +984,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1034,7 +1034,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1061,7 +1061,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1111,7 +1111,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1138,7 +1138,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1188,7 +1188,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1215,7 +1215,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1265,7 +1265,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1291,7 +1291,7 @@ func Test_favoriteAddOption_favoriteAddRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1472,7 +1472,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { fields fields wantStdOut string wantStdErr string - wantJrps []model.Jrp + wantJrps []*model.Jrp wantErr bool setup func() cleanup func() @@ -1574,7 +1574,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1622,7 +1622,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1670,7 +1670,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1710,7 +1710,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { }, wantStdOut: colorProxy.GreenString(constant.FAVORITE_ADD_MESSAGE_ADDED_SUCCESSFULLY) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1728,7 +1728,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1768,7 +1768,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NOT_ALL) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1786,7 +1786,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1834,7 +1834,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1889,7 +1889,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1944,7 +1944,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1991,7 +1991,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { }, wantStdOut: colorProxy.GreenString(constant.FAVORITE_ADD_MESSAGE_ADDED_SUCCESSFULLY) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2018,7 +2018,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2065,7 +2065,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NOT_ALL) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 2, Phrase: "test2", @@ -2083,7 +2083,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2130,7 +2130,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -2148,7 +2148,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -2191,7 +2191,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -2209,7 +2209,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -2252,7 +2252,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -2270,7 +2270,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -2313,7 +2313,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2340,7 +2340,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2390,7 +2390,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2417,7 +2417,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2467,7 +2467,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2494,7 +2494,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2544,7 +2544,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2571,7 +2571,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2621,7 +2621,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_ADD_MESSAGE_ADDED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2647,7 +2647,7 @@ func Test_favoriteAddOption_favoriteAdd(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), diff --git a/cmd/favorite_clear_test.go b/cmd/favorite_clear_test.go index d337ed89..c5f667a1 100644 --- a/cmd/favorite_clear_test.go +++ b/cmd/favorite_clear_test.go @@ -151,7 +151,7 @@ func Test_favoriteClearOption_favoriteClearRunE(t *testing.T) { fields fields wantStdOut string wantStdErr string - wantJrps []model.Jrp + wantJrps []*model.Jrp wantErr bool setup func() cleanup func() @@ -295,7 +295,7 @@ func Test_favoriteClearOption_favoriteClearRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -345,7 +345,7 @@ func Test_favoriteClearOption_favoriteClearRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -398,7 +398,7 @@ func Test_favoriteClearOption_favoriteClearRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -455,7 +455,7 @@ func Test_favoriteClearOption_favoriteClearRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -515,7 +515,7 @@ func Test_favoriteClearOption_favoriteClearRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -744,7 +744,7 @@ func Test_favoriteClearOption_favoriteClear(t *testing.T) { name string fields fields args args - wantJrps []model.Jrp + wantJrps []*model.Jrp wantErr bool setup func(*gomock.Controller, *fields) cleanup func() @@ -800,7 +800,7 @@ func Test_favoriteClearOption_favoriteClear(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -842,7 +842,7 @@ func Test_favoriteClearOption_favoriteClear(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -887,7 +887,7 @@ func Test_favoriteClearOption_favoriteClear(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -936,7 +936,7 @@ func Test_favoriteClearOption_favoriteClear(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -988,7 +988,7 @@ func Test_favoriteClearOption_favoriteClear(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), diff --git a/cmd/favorite_remove_test.go b/cmd/favorite_remove_test.go index c047217f..ee0abad6 100644 --- a/cmd/favorite_remove_test.go +++ b/cmd/favorite_remove_test.go @@ -144,7 +144,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { fields fields wantStdOut string wantStdErr string - wantJrps []model.Jrp + wantJrps []*model.Jrp wantErr bool setup func() cleanup func() @@ -329,7 +329,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -380,7 +380,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -431,7 +431,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -482,7 +482,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -533,7 +533,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -584,7 +584,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -642,7 +642,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -700,7 +700,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -758,7 +758,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -816,7 +816,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -866,7 +866,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_REMOVE_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -884,7 +884,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -930,7 +930,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_REMOVE_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -948,7 +948,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -994,7 +994,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1012,7 +1012,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1066,7 +1066,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1120,7 +1120,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1166,7 +1166,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_REMOVE_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1193,7 +1193,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1246,7 +1246,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_REMOVE_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1273,7 +1273,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1326,7 +1326,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1353,7 +1353,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1414,7 +1414,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1467,7 +1467,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_REMOVE_MESSAGE_REMOVED_NOT_ALL) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1485,7 +1485,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1546,7 +1546,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1597,7 +1597,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1648,7 +1648,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1699,7 +1699,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1750,7 +1750,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1801,7 +1801,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1859,7 +1859,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1917,7 +1917,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1975,7 +1975,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2033,7 +2033,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2091,7 +2091,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -2145,7 +2145,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -2199,7 +2199,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -2253,7 +2253,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -2307,7 +2307,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -2361,7 +2361,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2422,7 +2422,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2483,7 +2483,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2543,7 +2543,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2604,7 +2604,7 @@ func Test_favoriteRemoveOption_favoriteRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2835,7 +2835,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { fields fields wantStdOut string wantStdErr string - wantJrps []model.Jrp + wantJrps []*model.Jrp wantErr bool setup func() cleanup func() @@ -2946,7 +2946,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -2996,7 +2996,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -3047,7 +3047,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -3098,7 +3098,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -3149,7 +3149,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -3200,7 +3200,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3258,7 +3258,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3316,7 +3316,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3374,7 +3374,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3432,7 +3432,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3482,7 +3482,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -3500,7 +3500,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -3546,7 +3546,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -3564,7 +3564,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -3610,7 +3610,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -3628,7 +3628,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -3682,7 +3682,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -3736,7 +3736,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -3782,7 +3782,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -3809,7 +3809,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3862,7 +3862,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -3889,7 +3889,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3942,7 +3942,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -3969,7 +3969,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4030,7 +4030,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4083,7 +4083,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.FAVORITE_REMOVE_MESSAGE_REMOVED_NOT_ALL) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -4101,7 +4101,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4162,7 +4162,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4213,7 +4213,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4264,7 +4264,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4315,7 +4315,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4366,7 +4366,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4417,7 +4417,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4475,7 +4475,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4533,7 +4533,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4591,7 +4591,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4649,7 +4649,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4707,7 +4707,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4761,7 +4761,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4815,7 +4815,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4869,7 +4869,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4923,7 +4923,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4977,7 +4977,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5038,7 +5038,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5099,7 +5099,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5160,7 +5160,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5221,7 +5221,7 @@ func Test_favoriteRemoveOption_favoriteRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), diff --git a/cmd/favorite_search_test.go b/cmd/favorite_search_test.go index d9520e1a..9e26ab9e 100644 --- a/cmd/favorite_search_test.go +++ b/cmd/favorite_search_test.go @@ -229,7 +229,7 @@ func Test_favoriteSearchOption_favoriteSearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -284,7 +284,7 @@ func Test_favoriteSearchOption_favoriteSearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -339,7 +339,7 @@ func Test_favoriteSearchOption_favoriteSearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -394,7 +394,7 @@ func Test_favoriteSearchOption_favoriteSearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -449,7 +449,7 @@ func Test_favoriteSearchOption_favoriteSearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -504,7 +504,7 @@ func Test_favoriteSearchOption_favoriteSearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -559,7 +559,7 @@ func Test_favoriteSearchOption_favoriteSearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -614,7 +614,7 @@ func Test_favoriteSearchOption_favoriteSearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -739,7 +739,7 @@ func Test_favoriteSearchOption_favoriteSearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -864,7 +864,7 @@ func Test_favoriteSearchOption_favoriteSearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -989,7 +989,7 @@ func Test_favoriteSearchOption_favoriteSearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1114,7 +1114,7 @@ func Test_favoriteSearchOption_favoriteSearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1239,7 +1239,7 @@ func Test_favoriteSearchOption_favoriteSearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1294,7 +1294,7 @@ func Test_favoriteSearchOption_favoriteSearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1508,7 +1508,7 @@ func Test_favoriteSearchOption_favoriteSearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1563,7 +1563,7 @@ func Test_favoriteSearchOption_favoriteSearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1618,7 +1618,7 @@ func Test_favoriteSearchOption_favoriteSearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1673,7 +1673,7 @@ func Test_favoriteSearchOption_favoriteSearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1728,7 +1728,7 @@ func Test_favoriteSearchOption_favoriteSearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1783,7 +1783,7 @@ func Test_favoriteSearchOption_favoriteSearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1838,7 +1838,7 @@ func Test_favoriteSearchOption_favoriteSearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1893,7 +1893,7 @@ func Test_favoriteSearchOption_favoriteSearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2018,7 +2018,7 @@ func Test_favoriteSearchOption_favoriteSearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2143,7 +2143,7 @@ func Test_favoriteSearchOption_favoriteSearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2268,7 +2268,7 @@ func Test_favoriteSearchOption_favoriteSearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2393,7 +2393,7 @@ func Test_favoriteSearchOption_favoriteSearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2602,7 +2602,7 @@ func Test_favoriteSearchOption_writeFavoriteSearchResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - favoriteSearchOption.writeFavoriteSearchResult([]model.Jrp{}) + favoriteSearchOption.writeFavoriteSearchResult([]*model.Jrp{}) }, capturer: capturer, }, @@ -2628,7 +2628,7 @@ func Test_favoriteSearchOption_writeFavoriteSearchResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - favoriteSearchOption.writeFavoriteSearchResult([]model.Jrp{ + favoriteSearchOption.writeFavoriteSearchResult([]*model.Jrp{ { ID: 1, Phrase: "test", @@ -2664,7 +2664,7 @@ func Test_favoriteSearchOption_writeFavoriteSearchResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - favoriteSearchOption.writeFavoriteSearchResult([]model.Jrp{ + favoriteSearchOption.writeFavoriteSearchResult([]*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2735,7 +2735,7 @@ func Test_favoriteSearchOption_writeFavoriteSearchResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - favoriteSearchOption.writeFavoriteSearchResult([]model.Jrp{}) + favoriteSearchOption.writeFavoriteSearchResult([]*model.Jrp{}) }, capturer: capturer, }, @@ -2761,7 +2761,7 @@ func Test_favoriteSearchOption_writeFavoriteSearchResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - favoriteSearchOption.writeFavoriteSearchResult([]model.Jrp{ + favoriteSearchOption.writeFavoriteSearchResult([]*model.Jrp{ { ID: 1, Phrase: "test", @@ -2797,7 +2797,7 @@ func Test_favoriteSearchOption_writeFavoriteSearchResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - favoriteSearchOption.writeFavoriteSearchResult([]model.Jrp{ + favoriteSearchOption.writeFavoriteSearchResult([]*model.Jrp{ { ID: 1, Phrase: "test1", diff --git a/cmd/favorite_show_test.go b/cmd/favorite_show_test.go index 6b7afdd7..59cab900 100644 --- a/cmd/favorite_show_test.go +++ b/cmd/favorite_show_test.go @@ -189,7 +189,7 @@ func Test_favoriteShowOption_favoriteShowRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -243,7 +243,7 @@ func Test_favoriteShowOption_favoriteShowRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -304,7 +304,7 @@ func Test_favoriteShowOption_favoriteShowRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -365,7 +365,7 @@ func Test_favoriteShowOption_favoriteShowRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -419,7 +419,7 @@ func Test_favoriteShowOption_favoriteShowRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -473,7 +473,7 @@ func Test_favoriteShowOption_favoriteShowRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -527,7 +527,7 @@ func Test_favoriteShowOption_favoriteShowRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -701,7 +701,7 @@ func Test_favoriteShowShowShowOption_favoriteShowShowShow(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -755,7 +755,7 @@ func Test_favoriteShowShowShowOption_favoriteShowShowShow(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -816,7 +816,7 @@ func Test_favoriteShowShowShowOption_favoriteShowShowShow(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -940,7 +940,7 @@ func Test_favoriteShowShowShowOption_favoriteShowShowShow(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1064,7 +1064,7 @@ func Test_favoriteShowShowShowOption_favoriteShowShowShow(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1188,7 +1188,7 @@ func Test_favoriteShowShowShowOption_favoriteShowShowShow(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1312,7 +1312,7 @@ func Test_favoriteShowShowShowOption_favoriteShowShowShow(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1519,7 +1519,7 @@ func Test_favoriteShowShowOption_writeFavoriteShowResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - favoriteShowOption.writeFavoriteShowResult([]model.Jrp{}) + favoriteShowOption.writeFavoriteShowResult([]*model.Jrp{}) }, capturer: capturer, }, @@ -1544,7 +1544,7 @@ func Test_favoriteShowShowOption_writeFavoriteShowResult(t *testing.T) { Utility: util, } favoriteShowOption.writeFavoriteShowResult( - []model.Jrp{ + []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1580,7 +1580,7 @@ func Test_favoriteShowShowOption_writeFavoriteShowResult(t *testing.T) { Utility: util, } favoriteShowOption.writeFavoriteShowResult( - []model.Jrp{ + []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1648,7 +1648,7 @@ func Test_favoriteShowShowOption_writeFavoriteShowResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - favoriteShowOption.writeFavoriteShowResult([]model.Jrp{}) + favoriteShowOption.writeFavoriteShowResult([]*model.Jrp{}) }, capturer: capturer, }, @@ -1673,7 +1673,7 @@ func Test_favoriteShowShowOption_writeFavoriteShowResult(t *testing.T) { Utility: util, } favoriteShowOption.writeFavoriteShowResult( - []model.Jrp{ + []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1709,7 +1709,7 @@ func Test_favoriteShowShowOption_writeFavoriteShowResult(t *testing.T) { Utility: util, } favoriteShowOption.writeFavoriteShowResult( - []model.Jrp{ + []*model.Jrp{ { ID: 1, Phrase: "test1", diff --git a/cmd/favorite_test.go b/cmd/favorite_test.go index 45cef18f..db3032a8 100644 --- a/cmd/favorite_test.go +++ b/cmd/favorite_test.go @@ -189,7 +189,7 @@ func Test_favoriteOption_favoriteRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -243,7 +243,7 @@ func Test_favoriteOption_favoriteRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -304,7 +304,7 @@ func Test_favoriteOption_favoriteRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -365,7 +365,7 @@ func Test_favoriteOption_favoriteRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -419,7 +419,7 @@ func Test_favoriteOption_favoriteRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -473,7 +473,7 @@ func Test_favoriteOption_favoriteRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -527,7 +527,7 @@ func Test_favoriteOption_favoriteRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -701,7 +701,7 @@ func Test_favoriteOption_favorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -755,7 +755,7 @@ func Test_favoriteOption_favorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -816,7 +816,7 @@ func Test_favoriteOption_favorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -940,7 +940,7 @@ func Test_favoriteOption_favorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1064,7 +1064,7 @@ func Test_favoriteOption_favorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1188,7 +1188,7 @@ func Test_favoriteOption_favorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1312,7 +1312,7 @@ func Test_favoriteOption_favorite(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1519,7 +1519,7 @@ func Test_favoriteOption_writeFavoriteResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - favoriteOption.writeFavoriteResult([]model.Jrp{}) + favoriteOption.writeFavoriteResult([]*model.Jrp{}) }, capturer: capturer, }, @@ -1544,7 +1544,7 @@ func Test_favoriteOption_writeFavoriteResult(t *testing.T) { Utility: util, } favoriteOption.writeFavoriteResult( - []model.Jrp{ + []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1580,7 +1580,7 @@ func Test_favoriteOption_writeFavoriteResult(t *testing.T) { Utility: util, } favoriteOption.writeFavoriteResult( - []model.Jrp{ + []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1648,7 +1648,7 @@ func Test_favoriteOption_writeFavoriteResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - favoriteOption.writeFavoriteResult([]model.Jrp{}) + favoriteOption.writeFavoriteResult([]*model.Jrp{}) }, capturer: capturer, }, @@ -1673,7 +1673,7 @@ func Test_favoriteOption_writeFavoriteResult(t *testing.T) { Utility: util, } favoriteOption.writeFavoriteResult( - []model.Jrp{ + []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1709,7 +1709,7 @@ func Test_favoriteOption_writeFavoriteResult(t *testing.T) { Utility: util, } favoriteOption.writeFavoriteResult( - []model.Jrp{ + []*model.Jrp{ { ID: 1, Phrase: "test1", diff --git a/cmd/generate_test.go b/cmd/generate_test.go index d8b68d21..5747a517 100644 --- a/cmd/generate_test.go +++ b/cmd/generate_test.go @@ -1271,13 +1271,13 @@ func Test_generateOption_generateSave(t *testing.T) { } type args struct { jrpDBFilePath string - jrps []model.Jrp + jrps []*model.Jrp } tests := []struct { name string fields fields args args - wantJrps []model.Jrp + wantJrps []*model.Jrp wantErr bool setup func(mockCtrl *gomock.Controller, tt *fields) cleanup func() @@ -1337,7 +1337,7 @@ func Test_generateOption_generateSave(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{}, + jrps: []*model.Jrp{}, }, wantJrps: nil, wantErr: false, @@ -1372,7 +1372,7 @@ func Test_generateOption_generateSave(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1382,7 +1382,7 @@ func Test_generateOption_generateSave(t *testing.T) { }, }, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1424,7 +1424,7 @@ func Test_generateOption_generateSave(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1441,7 +1441,7 @@ func Test_generateOption_generateSave(t *testing.T) { }, }, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1526,7 +1526,7 @@ func Test_generateOption_generateSave(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{}, + jrps: []*model.Jrp{}, }, wantJrps: nil, wantErr: false, @@ -1561,7 +1561,7 @@ func Test_generateOption_generateSave(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1604,7 +1604,7 @@ func Test_generateOption_generateSave(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1969,7 +1969,7 @@ func Test_generateOption_writeGenerateResult(t *testing.T) { WNJpnRepository: wnJpnRepository, Utility: util, } - generateOption.writeGenerateResult([]model.Jrp{}) + generateOption.writeGenerateResult([]*model.Jrp{}) }, capturer: capturer, }, @@ -1998,7 +1998,7 @@ func Test_generateOption_writeGenerateResult(t *testing.T) { WNJpnRepository: wnJpnRepository, Utility: util, } - generateOption.writeGenerateResult([]model.Jrp{ + generateOption.writeGenerateResult([]*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString("prefix"), @@ -2009,7 +2009,7 @@ func Test_generateOption_writeGenerateResult(t *testing.T) { }, capturer: capturer, }, - wantStdOut: "PHRASE\tPREFIX\tSUFFIX\tCREATED AT\ntest\tprefix\tsuffix\t9999-12-31 00:00:00\n\t\t\t\nTOTAL : 1\t\t\t\n", + wantStdOut: "ID\tPHRASE\tPREFIX\tSUFFIX\tCREATED AT\n0\ttest\tprefix\tsuffix\t9999-12-31 00:00:00\n\t\t\t\nTOTAL : 1\t\t\t\n", wantStdErr: "", wantErr: false, }, @@ -2034,7 +2034,7 @@ func Test_generateOption_writeGenerateResult(t *testing.T) { WNJpnRepository: wnJpnRepository, Utility: util, } - generateOption.writeGenerateResult([]model.Jrp{ + generateOption.writeGenerateResult([]*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString("prefix1"), @@ -2051,7 +2051,7 @@ func Test_generateOption_writeGenerateResult(t *testing.T) { }, capturer: capturer, }, - wantStdOut: "PHRASE\tPREFIX\tSUFFIX\tCREATED AT\ntest1\tprefix1\tsuffix1\t9999-12-31 00:00:00\ntest2\tprefix2\tsuffix2\t9999-12-31 00:00:00\n\t\t\t\nTOTAL : 2\t\t\t\n", + wantStdOut: "ID\tPHRASE\tPREFIX\tSUFFIX\tCREATED AT\n0\ttest1\tprefix1\tsuffix1\t9999-12-31 00:00:00\n0\ttest2\tprefix2\tsuffix2\t9999-12-31 00:00:00\n\t\t\t\nTOTAL : 2\t\t\t\n", wantStdErr: "", wantErr: false, }, @@ -2105,7 +2105,7 @@ func Test_generateOption_writeGenerateResult(t *testing.T) { WNJpnRepository: wnJpnRepository, Utility: util, } - generateOption.writeGenerateResult([]model.Jrp{}) + generateOption.writeGenerateResult([]*model.Jrp{}) }, capturer: capturer, }, @@ -2134,7 +2134,7 @@ func Test_generateOption_writeGenerateResult(t *testing.T) { WNJpnRepository: wnJpnRepository, Utility: util, } - generateOption.writeGenerateResult([]model.Jrp{ + generateOption.writeGenerateResult([]*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString("prefix"), @@ -2170,7 +2170,7 @@ func Test_generateOption_writeGenerateResult(t *testing.T) { WNJpnRepository: wnJpnRepository, Utility: util, } - generateOption.writeGenerateResult([]model.Jrp{ + generateOption.writeGenerateResult([]*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString("prefix1"), diff --git a/cmd/history_clear_test.go b/cmd/history_clear_test.go index 2cc68cdb..0db2598e 100644 --- a/cmd/history_clear_test.go +++ b/cmd/history_clear_test.go @@ -151,7 +151,7 @@ func Test_historyClearOption_historyClearRunE(t *testing.T) { fields fields wantStdOut string wantStdErr string - wantJrps []model.Jrp + wantJrps []*model.Jrp wantErr bool setup func() cleanup func() @@ -299,7 +299,7 @@ func Test_historyClearOption_historyClearRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -350,7 +350,7 @@ func Test_historyClearOption_historyClearRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -393,7 +393,7 @@ func Test_historyClearOption_historyClearRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_CLEAR_MESSAGE_CLEARED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -411,7 +411,7 @@ func Test_historyClearOption_historyClearRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -465,7 +465,7 @@ func Test_historyClearOption_historyClearRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -519,7 +519,7 @@ func Test_historyClearOption_historyClearRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -577,7 +577,7 @@ func Test_historyClearOption_historyClearRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -627,7 +627,7 @@ func Test_historyClearOption_historyClearRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_CLEAR_MESSAGE_CLEARED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -654,7 +654,7 @@ func Test_historyClearOption_historyClearRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -715,7 +715,7 @@ func Test_historyClearOption_historyClearRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -768,7 +768,7 @@ func Test_historyClearOption_historyClearRunE(t *testing.T) { }, wantStdOut: colorProxy.GreenString(constant.HISTORY_CLEAR_MESSAGE_CLEARED_SUCCESSFULLY) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -786,7 +786,7 @@ func Test_historyClearOption_historyClearRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -847,7 +847,7 @@ func Test_historyClearOption_historyClearRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1080,7 +1080,7 @@ func Test_historyClearOption_historyClear(t *testing.T) { name string fields fields args args - wantJrps []model.Jrp + wantJrps []*model.Jrp wantErr bool setup func(*gomock.Controller, *fields) cleanup func() @@ -1138,7 +1138,7 @@ func Test_historyClearOption_historyClear(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1180,7 +1180,7 @@ func Test_historyClearOption_historyClear(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1215,7 +1215,7 @@ func Test_historyClearOption_historyClear(t *testing.T) { args: args{ jrpDBFilePath: jrpDBFilePath, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1233,7 +1233,7 @@ func Test_historyClearOption_historyClear(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1278,7 +1278,7 @@ func Test_historyClearOption_historyClear(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1324,7 +1324,7 @@ func Test_historyClearOption_historyClear(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1373,7 +1373,7 @@ func Test_historyClearOption_historyClear(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1415,7 +1415,7 @@ func Test_historyClearOption_historyClear(t *testing.T) { args: args{ jrpDBFilePath: jrpDBFilePath, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1442,7 +1442,7 @@ func Test_historyClearOption_historyClear(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1494,7 +1494,7 @@ func Test_historyClearOption_historyClear(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1539,7 +1539,7 @@ func Test_historyClearOption_historyClear(t *testing.T) { args: args{ jrpDBFilePath: jrpDBFilePath, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1557,7 +1557,7 @@ func Test_historyClearOption_historyClear(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1609,7 +1609,7 @@ func Test_historyClearOption_historyClear(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), diff --git a/cmd/history_remove_test.go b/cmd/history_remove_test.go index 0cda93ee..7f572021 100644 --- a/cmd/history_remove_test.go +++ b/cmd/history_remove_test.go @@ -145,7 +145,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { fields fields wantStdOut string wantStdErr string - wantJrps []model.Jrp + wantJrps []*model.Jrp wantErr bool setup func() cleanup func() @@ -327,7 +327,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -345,7 +345,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -389,7 +389,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -407,7 +407,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -451,7 +451,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -469,7 +469,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -521,7 +521,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -573,7 +573,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -617,7 +617,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -644,7 +644,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -695,7 +695,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -722,7 +722,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -773,7 +773,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -800,7 +800,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -859,7 +859,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -910,7 +910,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_REMOVED_NOT_ALL) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -928,7 +928,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -979,7 +979,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -997,7 +997,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1044,7 +1044,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1062,7 +1062,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1109,7 +1109,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1127,7 +1127,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1174,7 +1174,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1192,7 +1192,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1239,7 +1239,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1257,7 +1257,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1304,7 +1304,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1331,7 +1331,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1385,7 +1385,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1412,7 +1412,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1466,7 +1466,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1493,7 +1493,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1547,7 +1547,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1574,7 +1574,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1628,7 +1628,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1655,7 +1655,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1709,7 +1709,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1727,7 +1727,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1774,7 +1774,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1792,7 +1792,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1839,7 +1839,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1857,7 +1857,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1912,7 +1912,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1967,7 +1967,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -2014,7 +2014,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2041,7 +2041,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2095,7 +2095,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_NO_ID_SPECIFIED) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2122,7 +2122,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2176,7 +2176,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2203,7 +2203,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2265,7 +2265,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2319,7 +2319,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_REMOVED_NOT_ALL) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2337,7 +2337,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2437,7 +2437,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2481,7 +2481,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2499,7 +2499,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2554,7 +2554,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2609,7 +2609,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2660,7 +2660,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.GreenString(constant.HISTORY_REMOVE_MESSAGE_REMOVED_SUCCESSFULLY) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2678,7 +2678,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2732,7 +2732,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { }, wantStdOut: colorProxy.YellowString(constant.HISTORY_REMOVE_MESSAGE_REMOVED_NONE) + "\n", wantStdErr: "", - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -2759,7 +2759,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2821,7 +2821,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2880,7 +2880,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2942,7 +2942,7 @@ func Test_historyRemoveOption_historyRemoveRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3180,7 +3180,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { name string fields fields args args - wantJrps []model.Jrp + wantJrps []*model.Jrp wantErr bool setup func(*gomock.Controller, *fields) cleanup func() @@ -3265,7 +3265,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: nil, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -3283,7 +3283,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -3320,7 +3320,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -3338,7 +3338,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -3375,7 +3375,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{2}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -3393,7 +3393,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -3438,7 +3438,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -3483,7 +3483,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -3520,7 +3520,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: nil, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -3547,7 +3547,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3591,7 +3591,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -3618,7 +3618,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3662,7 +3662,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{3, 4}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -3689,7 +3689,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3741,7 +3741,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3785,7 +3785,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{2, 3}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -3803,7 +3803,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -3847,7 +3847,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: nil, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -3865,7 +3865,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -3905,7 +3905,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -3923,7 +3923,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -3963,7 +3963,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{2}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -3981,7 +3981,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4021,7 +4021,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{1}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -4039,7 +4039,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4079,7 +4079,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{1, 2}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -4097,7 +4097,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4137,7 +4137,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: nil, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -4164,7 +4164,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4211,7 +4211,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -4238,7 +4238,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4285,7 +4285,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{3, 4}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -4312,7 +4312,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4359,7 +4359,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{1, 2}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -4386,7 +4386,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4433,7 +4433,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{2, 3}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -4460,7 +4460,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4507,7 +4507,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: nil, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -4525,7 +4525,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4565,7 +4565,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -4583,7 +4583,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4623,7 +4623,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{2}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test", @@ -4641,7 +4641,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4689,7 +4689,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4737,7 +4737,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -4777,7 +4777,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: nil, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -4804,7 +4804,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4851,7 +4851,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -4878,7 +4878,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -4925,7 +4925,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{3, 4}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -4952,7 +4952,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5007,7 +5007,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5054,7 +5054,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{2, 3}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -5072,7 +5072,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5159,7 +5159,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5196,7 +5196,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -5214,7 +5214,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5262,7 +5262,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5310,7 +5310,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5354,7 +5354,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -5372,7 +5372,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5419,7 +5419,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { jrpDBFilePath: jrpDBFilePath, IDs: []int{}, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -5446,7 +5446,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5501,7 +5501,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5553,7 +5553,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -5608,7 +5608,7 @@ func Test_historyRemoveOption_historyRemove(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), diff --git a/cmd/history_search_test.go b/cmd/history_search_test.go index ab86ae4a..49a98e75 100644 --- a/cmd/history_search_test.go +++ b/cmd/history_search_test.go @@ -229,7 +229,7 @@ func Test_historySearchOption_historySearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -281,7 +281,7 @@ func Test_historySearchOption_historySearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -333,7 +333,7 @@ func Test_historySearchOption_historySearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -385,7 +385,7 @@ func Test_historySearchOption_historySearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -437,7 +437,7 @@ func Test_historySearchOption_historySearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -489,7 +489,7 @@ func Test_historySearchOption_historySearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -541,7 +541,7 @@ func Test_historySearchOption_historySearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -593,7 +593,7 @@ func Test_historySearchOption_historySearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -715,7 +715,7 @@ func Test_historySearchOption_historySearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -837,7 +837,7 @@ func Test_historySearchOption_historySearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -959,7 +959,7 @@ func Test_historySearchOption_historySearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1081,7 +1081,7 @@ func Test_historySearchOption_historySearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1203,7 +1203,7 @@ func Test_historySearchOption_historySearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1255,7 +1255,7 @@ func Test_historySearchOption_historySearchRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1466,7 +1466,7 @@ func Test_historySearchOption_historySearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1518,7 +1518,7 @@ func Test_historySearchOption_historySearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -1570,7 +1570,7 @@ func Test_historySearchOption_historySearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1622,7 +1622,7 @@ func Test_historySearchOption_historySearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1674,7 +1674,7 @@ func Test_historySearchOption_historySearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1726,7 +1726,7 @@ func Test_historySearchOption_historySearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1778,7 +1778,7 @@ func Test_historySearchOption_historySearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1830,7 +1830,7 @@ func Test_historySearchOption_historySearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1952,7 +1952,7 @@ func Test_historySearchOption_historySearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2074,7 +2074,7 @@ func Test_historySearchOption_historySearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2196,7 +2196,7 @@ func Test_historySearchOption_historySearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2318,7 +2318,7 @@ func Test_historySearchOption_historySearch(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2524,7 +2524,7 @@ func Test_historySearchOption_writeHistorySearchResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - historySearchOption.writeHistorySearchResult([]model.Jrp{}) + historySearchOption.writeHistorySearchResult([]*model.Jrp{}) }, capturer: capturer, }, @@ -2550,17 +2550,18 @@ func Test_historySearchOption_writeHistorySearchResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - historySearchOption.writeHistorySearchResult([]model.Jrp{ - { - ID: 1, - Phrase: "test", - Prefix: sqlProxy.StringToNullString("prefix"), - Suffix: sqlProxy.StringToNullString("suffix"), - IsFavorited: 0, - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - }) + historySearchOption.writeHistorySearchResult( + []*model.Jrp{ + { + ID: 1, + Phrase: "test", + Prefix: sqlProxy.StringToNullString("prefix"), + Suffix: sqlProxy.StringToNullString("suffix"), + IsFavorited: 0, + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + }) }, capturer: capturer, }, @@ -2586,26 +2587,27 @@ func Test_historySearchOption_writeHistorySearchResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - historySearchOption.writeHistorySearchResult([]model.Jrp{ - { - ID: 1, - Phrase: "test1", - Prefix: sqlProxy.StringToNullString("prefix1"), - Suffix: sqlProxy.StringToNullString("suffix1"), - IsFavorited: 0, - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - { - ID: 2, - Phrase: "test2", - Prefix: sqlProxy.StringToNullString("prefix2"), - Suffix: sqlProxy.StringToNullString("suffix2"), - IsFavorited: 1, - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - }) + historySearchOption.writeHistorySearchResult( + []*model.Jrp{ + { + ID: 1, + Phrase: "test1", + Prefix: sqlProxy.StringToNullString("prefix1"), + Suffix: sqlProxy.StringToNullString("suffix1"), + IsFavorited: 0, + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + { + ID: 2, + Phrase: "test2", + Prefix: sqlProxy.StringToNullString("prefix2"), + Suffix: sqlProxy.StringToNullString("suffix2"), + IsFavorited: 1, + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + }) }, capturer: capturer, }, @@ -2657,7 +2659,7 @@ func Test_historySearchOption_writeHistorySearchResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - historySearchOption.writeHistorySearchResult([]model.Jrp{}) + historySearchOption.writeHistorySearchResult([]*model.Jrp{}) }, capturer: capturer, }, @@ -2683,17 +2685,18 @@ func Test_historySearchOption_writeHistorySearchResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - historySearchOption.writeHistorySearchResult([]model.Jrp{ - { - ID: 1, - Phrase: "test", - Prefix: sqlProxy.StringToNullString("prefix"), - Suffix: sqlProxy.StringToNullString("suffix"), - IsFavorited: 0, - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - }) + historySearchOption.writeHistorySearchResult( + []*model.Jrp{ + { + ID: 1, + Phrase: "test", + Prefix: sqlProxy.StringToNullString("prefix"), + Suffix: sqlProxy.StringToNullString("suffix"), + IsFavorited: 0, + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + }) }, capturer: capturer, }, @@ -2719,26 +2722,27 @@ func Test_historySearchOption_writeHistorySearchResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - historySearchOption.writeHistorySearchResult([]model.Jrp{ - { - ID: 1, - Phrase: "test1", - Prefix: sqlProxy.StringToNullString("prefix1"), - Suffix: sqlProxy.StringToNullString("suffix1"), - IsFavorited: 0, - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - { - ID: 2, - Phrase: "test2", - Prefix: sqlProxy.StringToNullString("prefix2"), - Suffix: sqlProxy.StringToNullString("suffix2"), - IsFavorited: 1, - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - }) + historySearchOption.writeHistorySearchResult( + []*model.Jrp{ + { + ID: 1, + Phrase: "test1", + Prefix: sqlProxy.StringToNullString("prefix1"), + Suffix: sqlProxy.StringToNullString("suffix1"), + IsFavorited: 0, + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + { + ID: 2, + Phrase: "test2", + Prefix: sqlProxy.StringToNullString("prefix2"), + Suffix: sqlProxy.StringToNullString("suffix2"), + IsFavorited: 1, + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + }) }, capturer: capturer, }, diff --git a/cmd/history_show_test.go b/cmd/history_show_test.go index dc36909d..425a1b0e 100644 --- a/cmd/history_show_test.go +++ b/cmd/history_show_test.go @@ -189,7 +189,7 @@ func Test_historyShowOption_historyShowRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -240,7 +240,7 @@ func Test_historyShowOption_historyShowRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -298,7 +298,7 @@ func Test_historyShowOption_historyShowRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -349,7 +349,7 @@ func Test_historyShowOption_historyShowRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -400,7 +400,7 @@ func Test_historyShowOption_historyShowRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -451,7 +451,7 @@ func Test_historyShowOption_historyShowRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -622,7 +622,7 @@ func Test_historyShowOption_historyShow(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -673,7 +673,7 @@ func Test_historyShowOption_historyShow(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -731,7 +731,7 @@ func Test_historyShowOption_historyShow(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -852,7 +852,7 @@ func Test_historyShowOption_historyShow(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -973,7 +973,7 @@ func Test_historyShowOption_historyShow(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1094,7 +1094,7 @@ func Test_historyShowOption_historyShow(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1215,7 +1215,7 @@ func Test_historyShowOption_historyShow(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1419,7 +1419,7 @@ func Test_historyShowOption_writeHistoryShowResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - historyShowOption.writeHistoryShowResult([]model.Jrp{}) + historyShowOption.writeHistoryShowResult([]*model.Jrp{}) }, capturer: capturer, }, @@ -1443,17 +1443,18 @@ func Test_historyShowOption_writeHistoryShowResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - historyShowOption.writeHistoryShowResult([]model.Jrp{ - { - ID: 1, - Phrase: "test", - Prefix: sqlProxy.StringToNullString("prefix"), - Suffix: sqlProxy.StringToNullString("suffix"), - IsFavorited: 0, - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - }) + historyShowOption.writeHistoryShowResult( + []*model.Jrp{ + { + ID: 1, + Phrase: "test", + Prefix: sqlProxy.StringToNullString("prefix"), + Suffix: sqlProxy.StringToNullString("suffix"), + IsFavorited: 0, + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + }) }, capturer: capturer, }, @@ -1477,26 +1478,27 @@ func Test_historyShowOption_writeHistoryShowResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - historyShowOption.writeHistoryShowResult([]model.Jrp{ - { - ID: 1, - Phrase: "test1", - Prefix: sqlProxy.StringToNullString("prefix1"), - Suffix: sqlProxy.StringToNullString("suffix1"), - IsFavorited: 0, - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - { - ID: 2, - Phrase: "test2", - Prefix: sqlProxy.StringToNullString("prefix2"), - Suffix: sqlProxy.StringToNullString("suffix2"), - IsFavorited: 1, - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - }) + historyShowOption.writeHistoryShowResult( + []*model.Jrp{ + { + ID: 1, + Phrase: "test1", + Prefix: sqlProxy.StringToNullString("prefix1"), + Suffix: sqlProxy.StringToNullString("suffix1"), + IsFavorited: 0, + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + { + ID: 2, + Phrase: "test2", + Prefix: sqlProxy.StringToNullString("prefix2"), + Suffix: sqlProxy.StringToNullString("suffix2"), + IsFavorited: 1, + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + }) }, capturer: capturer, }, @@ -1544,7 +1546,8 @@ func Test_historyShowOption_writeHistoryShowResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - historyShowOption.writeHistoryShowResult([]model.Jrp{}) + historyShowOption.writeHistoryShowResult( + []*model.Jrp{}) }, capturer: capturer, }, @@ -1568,17 +1571,18 @@ func Test_historyShowOption_writeHistoryShowResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - historyShowOption.writeHistoryShowResult([]model.Jrp{ - { - ID: 1, - Phrase: "test", - Prefix: sqlProxy.StringToNullString("prefix"), - Suffix: sqlProxy.StringToNullString("suffix"), - IsFavorited: 0, - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - }) + historyShowOption.writeHistoryShowResult( + []*model.Jrp{ + { + ID: 1, + Phrase: "test", + Prefix: sqlProxy.StringToNullString("prefix"), + Suffix: sqlProxy.StringToNullString("suffix"), + IsFavorited: 0, + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + }) }, capturer: capturer, }, @@ -1602,26 +1606,27 @@ func Test_historyShowOption_writeHistoryShowResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - historyShowOption.writeHistoryShowResult([]model.Jrp{ - { - ID: 1, - Phrase: "test1", - Prefix: sqlProxy.StringToNullString("prefix1"), - Suffix: sqlProxy.StringToNullString("suffix1"), - IsFavorited: 0, - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - { - ID: 2, - Phrase: "test2", - Prefix: sqlProxy.StringToNullString("prefix2"), - Suffix: sqlProxy.StringToNullString("suffix2"), - IsFavorited: 1, - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - }) + historyShowOption.writeHistoryShowResult( + []*model.Jrp{ + { + ID: 1, + Phrase: "test1", + Prefix: sqlProxy.StringToNullString("prefix1"), + Suffix: sqlProxy.StringToNullString("suffix1"), + IsFavorited: 0, + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + { + ID: 2, + Phrase: "test2", + Prefix: sqlProxy.StringToNullString("prefix2"), + Suffix: sqlProxy.StringToNullString("suffix2"), + IsFavorited: 1, + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + }) }, capturer: capturer, }, diff --git a/cmd/history_test.go b/cmd/history_test.go index e74999ce..25d697e8 100644 --- a/cmd/history_test.go +++ b/cmd/history_test.go @@ -189,7 +189,7 @@ func Test_historyOption_historyRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -240,7 +240,7 @@ func Test_historyOption_historyRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -298,7 +298,7 @@ func Test_historyOption_historyRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -349,7 +349,7 @@ func Test_historyOption_historyRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -400,7 +400,7 @@ func Test_historyOption_historyRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -451,7 +451,7 @@ func Test_historyOption_historyRunE(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -622,7 +622,7 @@ func Test_historyOption_history(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test", Prefix: sqlProxy.StringToNullString(""), @@ -673,7 +673,7 @@ func Test_historyOption_history(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -731,7 +731,7 @@ func Test_historyOption_history(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -852,7 +852,7 @@ func Test_historyOption_history(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -973,7 +973,7 @@ func Test_historyOption_history(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1094,7 +1094,7 @@ func Test_historyOption_history(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1215,7 +1215,7 @@ func Test_historyOption_history(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1419,7 +1419,7 @@ func Test_historyOption_writeHistoryResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - historyOption.writeHistoryResult([]model.Jrp{}) + historyOption.writeHistoryResult([]*model.Jrp{}) }, capturer: capturer, }, @@ -1444,7 +1444,7 @@ func Test_historyOption_writeHistoryResult(t *testing.T) { Utility: util, } historyOption.writeHistoryResult( - []model.Jrp{ + []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1480,7 +1480,7 @@ func Test_historyOption_writeHistoryResult(t *testing.T) { Utility: util, } historyOption.writeHistoryResult( - []model.Jrp{ + []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1548,7 +1548,7 @@ func Test_historyOption_writeHistoryResult(t *testing.T) { JrpWriter: jrpWriter, Utility: util, } - historyOption.writeHistoryResult([]model.Jrp{}) + historyOption.writeHistoryResult([]*model.Jrp{}) }, capturer: capturer, }, @@ -1573,7 +1573,7 @@ func Test_historyOption_writeHistoryResult(t *testing.T) { Utility: util, } historyOption.writeHistoryResult( - []model.Jrp{ + []*model.Jrp{ { ID: 1, Phrase: "test", @@ -1609,7 +1609,7 @@ func Test_historyOption_writeHistoryResult(t *testing.T) { Utility: util, } historyOption.writeHistoryResult( - []model.Jrp{ + []*model.Jrp{ { ID: 1, Phrase: "test1", diff --git a/cmd/root_test.go b/cmd/root_test.go index 8ec580fc..7e2165aa 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -1378,13 +1378,13 @@ func Test_rootOption_rootSave(t *testing.T) { } type args struct { jrpDBFilePath string - jrps []model.Jrp + jrps []*model.Jrp } tests := []struct { name string fields fields args args - wantJrps []model.Jrp + wantJrps []*model.Jrp wantErr bool setup func(mockCtrl *gomock.Controller, tt *fields) cleanup func() @@ -1444,7 +1444,7 @@ func Test_rootOption_rootSave(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{}, + jrps: []*model.Jrp{}, }, wantJrps: nil, wantErr: false, @@ -1479,7 +1479,7 @@ func Test_rootOption_rootSave(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1489,7 +1489,7 @@ func Test_rootOption_rootSave(t *testing.T) { }, }, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1531,7 +1531,7 @@ func Test_rootOption_rootSave(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1548,7 +1548,7 @@ func Test_rootOption_rootSave(t *testing.T) { }, }, }, - wantJrps: []model.Jrp{ + wantJrps: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1633,7 +1633,7 @@ func Test_rootOption_rootSave(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{}, + jrps: []*model.Jrp{}, }, wantJrps: nil, wantErr: false, @@ -1668,7 +1668,7 @@ func Test_rootOption_rootSave(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -1711,7 +1711,7 @@ func Test_rootOption_rootSave(t *testing.T) { }, args: args{ jrpDBFilePath: jrpDBFilePath, - jrps: []model.Jrp{ + jrps: []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -2076,7 +2076,7 @@ func Test_rootOption_writeRootResult(t *testing.T) { WNJpnRepository: wnJpnRepository, Utility: util, } - rootOption.writeRootResult([]model.Jrp{}) + rootOption.writeRootResult([]*model.Jrp{}) }, capturer: capturer, }, @@ -2105,18 +2105,19 @@ func Test_rootOption_writeRootResult(t *testing.T) { WNJpnRepository: wnJpnRepository, Utility: util, } - rootOption.writeRootResult([]model.Jrp{ - { - Phrase: "test", - Prefix: sqlProxy.StringToNullString("prefix"), - Suffix: sqlProxy.StringToNullString("suffix"), - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - }) + rootOption.writeRootResult( + []*model.Jrp{ + { + Phrase: "test", + Prefix: sqlProxy.StringToNullString("prefix"), + Suffix: sqlProxy.StringToNullString("suffix"), + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + }) }, capturer: capturer, }, - wantStdOut: "PHRASE\tPREFIX\tSUFFIX\tCREATED AT\ntest\tprefix\tsuffix\t9999-12-31 00:00:00\n\t\t\t\nTOTAL : 1\t\t\t\n", + wantStdOut: "ID\tPHRASE\tPREFIX\tSUFFIX\tCREATED AT\n0\ttest\tprefix\tsuffix\t9999-12-31 00:00:00\n\t\t\t\nTOTAL : 1\t\t\t\n", wantStdErr: "", wantErr: false, }, @@ -2141,24 +2142,25 @@ func Test_rootOption_writeRootResult(t *testing.T) { WNJpnRepository: wnJpnRepository, Utility: util, } - rootOption.writeRootResult([]model.Jrp{ - { - Phrase: "test1", - Prefix: sqlProxy.StringToNullString("prefix1"), - Suffix: sqlProxy.StringToNullString("suffix1"), - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - { - Phrase: "test2", - Prefix: sqlProxy.StringToNullString("prefix2"), - Suffix: sqlProxy.StringToNullString("suffix2"), - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - }) + rootOption.writeRootResult( + []*model.Jrp{ + { + Phrase: "test1", + Prefix: sqlProxy.StringToNullString("prefix1"), + Suffix: sqlProxy.StringToNullString("suffix1"), + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + { + Phrase: "test2", + Prefix: sqlProxy.StringToNullString("prefix2"), + Suffix: sqlProxy.StringToNullString("suffix2"), + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + }) }, capturer: capturer, }, - wantStdOut: "PHRASE\tPREFIX\tSUFFIX\tCREATED AT\ntest1\tprefix1\tsuffix1\t9999-12-31 00:00:00\ntest2\tprefix2\tsuffix2\t9999-12-31 00:00:00\n\t\t\t\nTOTAL : 2\t\t\t\n", + wantStdOut: "ID\tPHRASE\tPREFIX\tSUFFIX\tCREATED AT\n0\ttest1\tprefix1\tsuffix1\t9999-12-31 00:00:00\n0\ttest2\tprefix2\tsuffix2\t9999-12-31 00:00:00\n\t\t\t\nTOTAL : 2\t\t\t\n", wantStdErr: "", wantErr: false, }, @@ -2212,7 +2214,7 @@ func Test_rootOption_writeRootResult(t *testing.T) { WNJpnRepository: wnJpnRepository, Utility: util, } - rootOption.writeRootResult([]model.Jrp{}) + rootOption.writeRootResult([]*model.Jrp{}) }, capturer: capturer, }, @@ -2241,14 +2243,15 @@ func Test_rootOption_writeRootResult(t *testing.T) { WNJpnRepository: wnJpnRepository, Utility: util, } - rootOption.writeRootResult([]model.Jrp{ - { - Phrase: "test", - Prefix: sqlProxy.StringToNullString("prefix"), - Suffix: sqlProxy.StringToNullString("suffix"), - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - }) + rootOption.writeRootResult( + []*model.Jrp{ + { + Phrase: "test", + Prefix: sqlProxy.StringToNullString("prefix"), + Suffix: sqlProxy.StringToNullString("suffix"), + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + }) }, capturer: capturer, }, @@ -2277,20 +2280,21 @@ func Test_rootOption_writeRootResult(t *testing.T) { WNJpnRepository: wnJpnRepository, Utility: util, } - rootOption.writeRootResult([]model.Jrp{ - { - Phrase: "test1", - Prefix: sqlProxy.StringToNullString("prefix1"), - Suffix: sqlProxy.StringToNullString("suffix1"), - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - { - Phrase: "test2", - Prefix: sqlProxy.StringToNullString("prefix2"), - Suffix: sqlProxy.StringToNullString("suffix2"), - CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), - }, - }) + rootOption.writeRootResult( + []*model.Jrp{ + { + Phrase: "test1", + Prefix: sqlProxy.StringToNullString("prefix1"), + Suffix: sqlProxy.StringToNullString("suffix1"), + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + { + Phrase: "test2", + Prefix: sqlProxy.StringToNullString("prefix2"), + Suffix: sqlProxy.StringToNullString("suffix2"), + CreatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), + }, + }) }, capturer: capturer, }, diff --git a/docs/coverage.html b/docs/coverage.html index 863436af..5608260e 100644 --- a/docs/coverage.html +++ b/docs/coverage.html @@ -238,17 +238,17 @@ // JrpRepositoryInterface is an interface for JrpRepository. type JrpRepositoryInterface interface { - SaveHistory(jrpDBFilePath string, jrps []model.Jrp) (SaveStatus, error) - GetAllHistory(jrpDBFilePath string) ([]model.Jrp, error) - GetHistoryWithNumber(jrpDBFilePath string, number int) ([]model.Jrp, error) - SearchHistoryWithNumber(jrpDBFilePath string, number int, keywords []string, and bool) ([]model.Jrp, error) - SearchAllHistory(jrpDBFilePath string, keywords []string, and bool) ([]model.Jrp, error) + SaveHistory(jrpDBFilePath string, jrps []*model.Jrp) (SaveStatus, error) + GetAllHistory(jrpDBFilePath string) ([]*model.Jrp, error) + GetHistoryWithNumber(jrpDBFilePath string, number int) ([]*model.Jrp, error) + SearchHistoryWithNumber(jrpDBFilePath string, number int, keywords []string, and bool) ([]*model.Jrp, error) + SearchAllHistory(jrpDBFilePath string, keywords []string, and bool) ([]*model.Jrp, error) RemoveHistoryByIDs(jrpDBFilePath string, ids []int, force bool) (RemoveStatus, error) RemoveHistoryAll(jrpDBFilePath string, force bool) (RemoveStatus, error) - GetAllFavorite(jrpDBFilePath string) ([]model.Jrp, error) - GetFavoriteWithNumber(jrpDBFilePath string, number int) ([]model.Jrp, error) - SearchAllFavorite(jrpDBFilePath string, keywords []string, and bool) ([]model.Jrp, error) - SearchFavoriteWithNumber(jrpDBFilePath string, number int, keywords []string, and bool) ([]model.Jrp, error) + GetAllFavorite(jrpDBFilePath string) ([]*model.Jrp, error) + GetFavoriteWithNumber(jrpDBFilePath string, number int) ([]*model.Jrp, error) + SearchAllFavorite(jrpDBFilePath string, keywords []string, and bool) ([]*model.Jrp, error) + SearchFavoriteWithNumber(jrpDBFilePath string, number int, keywords []string, and bool) ([]*model.Jrp, error) AddFavoriteByIDs(jrpDBFilePath string, ids []int) (AddStatus, error) RemoveFavoriteByIDs(jrpDBFilePath string, ids []int) (RemoveStatus, error) RemoveFavoriteAll(jrpDBFilePath string) (RemoveStatus, error) @@ -278,7 +278,7 @@ } // SaveHistory saves jrps as history. -func (j JrpRepository) SaveHistory(jrpDBFilePath string, jrps []model.Jrp) (SaveStatus, error) { +func (j JrpRepository) SaveHistory(jrpDBFilePath string, jrps []*model.Jrp) (SaveStatus, error) { var deferErr error // if jrps is nil or empty, return nil if jrps == nil || len(jrps) <= 0 { @@ -330,12 +330,21 @@ if err != nil { return SavedFailed, err } + + // get count c, err := res.RowsAffected() if err != nil { // failed to get rows affected return SavedFailed, err } - count += c + count += c + + // set ID + i, err := res.LastInsertId() + if err != nil { + return SavedFailed, err + } + jrp.ID = int(i) } // commit transaction @@ -352,7 +361,7 @@ } // GetAllHistory gets all jrps as history. -func (j JrpRepository) GetAllHistory(jrpDBFilePath string) ([]model.Jrp, error) { +func (j JrpRepository) GetAllHistory(jrpDBFilePath string) ([]*model.Jrp, error) { var deferErr error // connect to db db, err := j.SqlProxy.Open(sqlproxy.Sqlite, jrpDBFilePath) @@ -378,9 +387,9 @@ }() // scan rows - var allHistory []model.Jrp + var allHistory []*model.Jrp for rows.Next() { - var history model.Jrp + history := &model.Jrp{} if err := rows.Scan( &history.ID, &history.Phrase, @@ -402,7 +411,7 @@ } // GetHistoryWithNumber gets history with number. -func (j JrpRepository) GetHistoryWithNumber(jrpDBFilePath string, number int) ([]model.Jrp, error) { +func (j JrpRepository) GetHistoryWithNumber(jrpDBFilePath string, number int) ([]*model.Jrp, error) { var deferErr error if number <= 0 { // if number is less than or equal to 0, return nil @@ -442,9 +451,9 @@ }() // scan rows - var allHistory []model.Jrp + var allHistory []*model.Jrp for rows.Next() { - var history model.Jrp + history := &model.Jrp{} if err := rows.Scan( &history.ID, &history.Phrase, @@ -471,7 +480,7 @@ } // SearchAllHistory searches all jrps as history with keywords. -func (j JrpRepository) SearchAllHistory(jrpDBFilePath string, keywords []string, and bool) ([]model.Jrp, error) { +func (j JrpRepository) SearchAllHistory(jrpDBFilePath string, keywords []string, and bool) ([]*model.Jrp, error) { var deferErr error if keywords == nil || len(keywords) <= 0 { // if keywords is nil or empty, return nil @@ -524,9 +533,9 @@ }() // scan rows - var searchedAllHistory []model.Jrp + var searchedAllHistory []*model.Jrp for rows.Next() { - var history model.Jrp + history := &model.Jrp{} if err := rows.Scan( &history.ID, &history.Phrase, @@ -553,7 +562,7 @@ number int, keywords []string, and bool, -) ([]model.Jrp, error) { +) ([]*model.Jrp, error) { var deferErr error if number <= 0 || keywords == nil || len(keywords) <= 0 { // if number is less than or equal to 0 or keywords is nil or empty @@ -607,9 +616,9 @@ }() // scan rows - var searchedHistory []model.Jrp + var searchedHistory []*model.Jrp for rows.Next() { - var history model.Jrp + history := &model.Jrp{} if err := rows.Scan( &history.ID, &history.Phrase, @@ -775,7 +784,7 @@ } // GetAllFavorite gets all jrps that are favorited. -func (j JrpRepository) GetAllFavorite(jrpDBFilePath string) ([]model.Jrp, error) { +func (j JrpRepository) GetAllFavorite(jrpDBFilePath string) ([]*model.Jrp, error) { var deferErr error // connect to db db, err := j.SqlProxy.Open(sqlproxy.Sqlite, jrpDBFilePath) @@ -801,9 +810,9 @@ }() // scan rows - var allFavorite []model.Jrp + var allFavorite []*model.Jrp for rows.Next() { - var favorite model.Jrp + favorite := &model.Jrp{} if err := rows.Scan( &favorite.ID, &favorite.Phrase, @@ -825,7 +834,7 @@ } // GetFavoriteWithNumber gets jrps that are favorited with number. -func (j JrpRepository) GetFavoriteWithNumber(jrpDBFilePath string, number int) ([]model.Jrp, error) { +func (j JrpRepository) GetFavoriteWithNumber(jrpDBFilePath string, number int) ([]*model.Jrp, error) { var deferErr error if number <= 0 { // if number is less than or equal to 0, return nil @@ -865,9 +874,9 @@ }() // scan rows - var allFavorite []model.Jrp + var allFavorite []*model.Jrp for rows.Next() { - var favorite model.Jrp + favorite := &model.Jrp{} if err := rows.Scan( &favorite.ID, &favorite.Phrase, @@ -894,7 +903,7 @@ } // SearchAllFavorite searches all jrps that are favorited with keywords. -func (j JrpRepository) SearchAllFavorite(jrpDBFilePath string, keywords []string, and bool) ([]model.Jrp, error) { +func (j JrpRepository) SearchAllFavorite(jrpDBFilePath string, keywords []string, and bool) ([]*model.Jrp, error) { var deferErr error if keywords == nil || len(keywords) <= 0 { // if keywords is nil or empty, return nil @@ -947,9 +956,9 @@ }() // scan rows - var searchedAllFavorite []model.Jrp + var searchedAllFavorite []*model.Jrp for rows.Next() { - var favorite model.Jrp + favorite := &model.Jrp{} if err := rows.Scan(&favorite.ID, &favorite.Phrase, &favorite.Prefix, @@ -975,7 +984,7 @@ number int, keywords []string, and bool, -) ([]model.Jrp, error) { +) ([]*model.Jrp, error) { var deferErr error if number <= 0 || keywords == nil || len(keywords) <= 0 { // if number is less than or equal to 0 or keywords is nil or empty @@ -1029,9 +1038,9 @@ }() // scan rows - var searchedFavorite []model.Jrp + var searchedFavorite []*model.Jrp for rows.Next() { - var favorite model.Jrp + favorite := &model.Jrp{} if err := rows.Scan( &favorite.ID, &favorite.Phrase, @@ -1560,7 +1569,7 @@ // Generatable is an interface for Generator. type Generatable interface { - GenerateJrp(wnJpnDBFilePath string, num int, word string, mode GenerateMode) (GenerateResult, []jrp.Jrp, error) + GenerateJrp(wnJpnDBFilePath string, num int, word string, mode GenerateMode) (GenerateResult, []*jrp.Jrp, error) } // Generatoor is a struct that implements Generatable interface. @@ -1590,7 +1599,7 @@ } // GenerateJrp generates jrps. -func (g *Generator) GenerateJrp(wnJpnDBFilePath string, num int, word string, mode GenerateMode) (GenerateResult, []jrp.Jrp, error) { +func (g *Generator) GenerateJrp(wnJpnDBFilePath string, num int, word string, mode GenerateMode) (GenerateResult, []*jrp.Jrp, error) { if _, err := g.OsProxy.Stat(wnJpnDBFilePath); g.OsProxy.IsNotExist(err) { // if WordNet Japan sqlite database file does not exist, return warning return DBFileNotFound, nil, nil @@ -1636,8 +1645,8 @@ argPrefix string, argSuffix string, mode GenerateMode, -) []jrp.Jrp { - jrps := make([]jrp.Jrp, 0) +) []*jrp.Jrp { + jrps := make([]*jrp.Jrp, 0) createdAt := g.TimeProxy.Now() for i := 0; i < num; i++ { @@ -1681,7 +1690,7 @@ argPrefix = "" } - jrp := jrp.Jrp{ + jrp := &jrp.Jrp{ Phrase: prefixWord + suffixWord, Prefix: g.SqlProxy.StringToNullString(argPrefix), Suffix: g.SqlProxy.StringToNullString(argSuffix), @@ -1743,8 +1752,8 @@ // JrpWritable is an interface for JrpWriter. type JrpWritable interface { - WriteGenerateResultAsTable(writer ioproxy.WriterInstanceInterface, jrps []model.Jrp) - WriteAsTable(writer ioproxy.WriterInstanceInterface, jrps []model.Jrp) + WriteGenerateResultAsTable(writer ioproxy.WriterInstanceInterface, jrps []*model.Jrp) + WriteAsTable(writer ioproxy.WriterInstanceInterface, jrps []*model.Jrp) } // JrpWriter is a struct that implements JrpWritable. @@ -1765,13 +1774,13 @@ } // WriteGenerateResultAsTable writes the generate result as table. -func (j *JrpWriter) WriteGenerateResultAsTable(writer ioproxy.WriterInstanceInterface, jrps []model.Jrp) { +func (j *JrpWriter) WriteGenerateResultAsTable(writer ioproxy.WriterInstanceInterface, jrps []*model.Jrp) { if jrps == nil || len(jrps) <= 0 { return } - headers := []string{"phrase", "prefix", "suffix", "created_at"} - rowFunc := func(jrp model.Jrp) []string { + headers := []string{"id", "phrase", "prefix", "suffix", "created_at"} + rowFunc := func(jrp *model.Jrp) []string { prefix := "" if jrp.Prefix.FieldNullString.Valid { prefix = jrp.Prefix.FieldNullString.String @@ -1781,6 +1790,7 @@ suffix = jrp.Suffix.FieldNullString.String } return []string{ + j.StrconvProxy.Itoa(jrp.ID), jrp.Phrase, prefix, suffix, @@ -1792,13 +1802,13 @@ } // WriteAsTable writes the jrps as table. -func (j *JrpWriter) WriteAsTable(writer ioproxy.WriterInstanceInterface, jrps []model.Jrp) { +func (j *JrpWriter) WriteAsTable(writer ioproxy.WriterInstanceInterface, jrps []*model.Jrp) { if jrps == nil || len(jrps) <= 0 { return } headers := []string{"id", "phrase", "prefix", "suffix", "is_favorited", "created_at", "updated_at"} - rowFunc := func(jrp model.Jrp) []string { + rowFunc := func(jrp *model.Jrp) []string { prefix := "" if jrp.Prefix.FieldNullString.Valid { prefix = jrp.Prefix.FieldNullString.String @@ -1826,7 +1836,7 @@ } // writeTable writes the table. -func (j *JrpWriter) writeTable(writer ioproxy.WriterInstanceInterface, jrps []model.Jrp, headers []string, rowFunc func(model.Jrp) []string) { +func (j *JrpWriter) writeTable(writer ioproxy.WriterInstanceInterface, jrps []*model.Jrp, headers []string, rowFunc func(*model.Jrp) []string) { if jrps == nil || len(jrps) <= 0 { return } @@ -2798,6 +2808,7 @@ // ResultInstanceInterface is an interface for sql.Result. type ResultInstanceInterface interface { + LastInsertId() (int64, error) RowsAffected() (int64, error) } @@ -2806,6 +2817,11 @@ FieldResult sql.Result } +// LastInsertId is a proxy for sql.Result.LastInsertId. +func (r ResultInstance) LastInsertId() (int64, error) { + return r.FieldResult.LastInsertId() +} + // RowsAffected is a proxy for sql.Result.RowsAffected. func (r ResultInstance) RowsAffected() (int64, error) { return r.FieldResult.RowsAffected() @@ -4360,7 +4376,7 @@ // favorite shows the favorite. func (o *favoriteOption) favorite(jrpDBFilePath string) error { - var favorites []model.Jrp + var favorites []*model.Jrp var err error if o.All { // if all flag is set, get all favorite @@ -4391,7 +4407,7 @@ } // writeFavoriteResult writes the favorite result. -func (o *favoriteOption) writeFavoriteResult(favorites []model.Jrp) { +func (o *favoriteOption) writeFavoriteResult(favorites []*model.Jrp) { if len(favorites) != 0 { if o.Plain { for _, favorite := range favorites { @@ -5000,7 +5016,7 @@ // favoriteSearch searches favorite. func (o *favoriteSearchOption) favoriteSearch(jrpDBFilePath string, keywords []string) error { - var favorites []model.Jrp + var favorites []*model.Jrp var err error if o.All { // if all flag is set, search all favorite @@ -5020,7 +5036,7 @@ } // writeFavoriteSearchResult writes the favorite search result. -func (o *favoriteSearchOption) writeFavoriteSearchResult(favorites []model.Jrp) { +func (o *favoriteSearchOption) writeFavoriteSearchResult(favorites []*model.Jrp) { if len(favorites) != 0 { if o.Plain { for _, favorite := range favorites { @@ -5163,7 +5179,7 @@ // favoriteShow is the function that gets the favorite. func (o *favoriteShowOption) favoriteShow(jrpDBFilePath string) error { - var favorites []model.Jrp + var favorites []*model.Jrp var err error if o.All { // if all flag is set, get all favorite @@ -5194,7 +5210,7 @@ } // writeFavoriteShowResult writes the favorite show result. -func (o *favoriteShowOption) writeFavoriteShowResult(favorites []model.Jrp) { +func (o *favoriteShowOption) writeFavoriteShowResult(favorites []*model.Jrp) { if len(favorites) != 0 { if o.Plain { for _, favorite := range favorites { @@ -5398,7 +5414,7 @@ word string, mode generator.GenerateMode, ) error { - var jrps []model.Jrp + var jrps []*model.Jrp var err error jrps, err = o.generateGenerate(wnJpnDBFilePath, word, mode) if err != nil { @@ -5414,7 +5430,7 @@ } // generateGenerate generates jrps. -func (o *generateOption) generateGenerate(wnJpnDBFilePath string, word string, mode generator.GenerateMode) ([]model.Jrp, error) { +func (o *generateOption) generateGenerate(wnJpnDBFilePath string, word string, mode generator.GenerateMode) ([]*model.Jrp, error) { strconvProxy := strconvproxy.New() res, jrps, err := o.Generator.GenerateJrp( wnJpnDBFilePath, @@ -5453,7 +5469,7 @@ } // generateSave saves jrps. -func (o *generateOption) generateSave(jrpDBFilePath string, jrps []model.Jrp) error { +func (o *generateOption) generateSave(jrpDBFilePath string, jrps []*model.Jrp) error { var res jrprepository.SaveStatus var err error if !o.DryRun && len(jrps) != 0 { @@ -5486,7 +5502,7 @@ } // writeGenerateResult writes the result of generate command. -func (o *generateOption) writeGenerateResult(jrps []model.Jrp) { +func (o *generateOption) writeGenerateResult(jrps []*model.Jrp) { if len(jrps) != 0 { if o.Plain { for _, jrp := range jrps { @@ -5630,7 +5646,7 @@ // history searches the history. func (o *historyOption) history(jrpDBFilePath string) error { - var histories []model.Jrp + var histories []*model.Jrp var err error if o.All { // if all flag is set, get all history @@ -5661,7 +5677,7 @@ } // writeHistoryResult writes the history result. -func (o *historyOption) writeHistoryResult(histories []model.Jrp) { +func (o *historyOption) writeHistoryResult(histories []*model.Jrp) { if len(histories) != 0 { if o.Plain { for _, history := range histories { @@ -6153,7 +6169,7 @@ // historySearch searches the history with the given keywords. func (o *historySearchOption) historySearch(jrpDBFilePath string, keywords []string) error { - var histories []model.Jrp + var histories []*model.Jrp var err error if o.All { // if all flag is set, search all history @@ -6173,7 +6189,7 @@ } // writeHistorySearchResult writes the history search result. -func (o *historySearchOption) writeHistorySearchResult(histories []model.Jrp) { +func (o *historySearchOption) writeHistorySearchResult(histories []*model.Jrp) { if len(histories) != 0 { if o.Plain { for _, hist := range histories { @@ -6315,7 +6331,7 @@ // historyShow shows the history. func (o *historyShowOption) historyShow(jrpDBFilePath string) error { - var histories []model.Jrp + var histories []*model.Jrp var err error if o.All { // if all flag is set, get all history @@ -6346,7 +6362,7 @@ } // writeHistory writes the history. -func (o *historyShowOption) writeHistoryShowResult(histories []model.Jrp) { +func (o *historyShowOption) writeHistoryShowResult(histories []*model.Jrp) { if len(histories) != 0 { if o.Plain { for _, history := range histories { @@ -6615,7 +6631,7 @@ word string, mode generator.GenerateMode, ) error { - var jrps []model.Jrp + var jrps []*model.Jrp var err error jrps, err = o.rootGenerate(wnJpnDBFilePath, word, mode) if err != nil { @@ -6631,7 +6647,7 @@ } // rootGenerate generates jrpss. -func (o *rootOption) rootGenerate(wnJpnDBFilePath string, word string, mode generator.GenerateMode) ([]model.Jrp, error) { +func (o *rootOption) rootGenerate(wnJpnDBFilePath string, word string, mode generator.GenerateMode) ([]*model.Jrp, error) { strconvProxy := strconvproxy.New() res, jrps, err := o.Generator.GenerateJrp( wnJpnDBFilePath, @@ -6670,7 +6686,7 @@ } // rootSave saves jrpss. -func (o *rootOption) rootSave(jrpDBFilePath string, jrps []model.Jrp) error { +func (o *rootOption) rootSave(jrpDBFilePath string, jrps []*model.Jrp) error { var res jrprepository.SaveStatus var err error if !o.DryRun && len(jrps) != 0 { @@ -6702,7 +6718,7 @@ } // writeRootResult writes the result of the root command. -func (o *rootOption) writeRootResult(jrps []model.Jrp) { +func (o *rootOption) writeRootResult(jrps []*model.Jrp) { if len(jrps) != 0 { if o.Plain { for _, jrp := range jrps { @@ -6889,7 +6905,7 @@ GetJrpSeq(jrpDBFilePath string) (int, error) IsExist(jrpDBFilePath string, id int) (bool, error) IsFavorited(jrpDBFilePath string, id int) (bool, error) - IsSameJrps(got, want []model.Jrp) bool + IsSameJrps(got, want []*model.Jrp) bool } // JrpChecker is a struct for checking Jrp. @@ -7006,7 +7022,7 @@ } // IsSameJrps checks if jrps are the same. -func (j *JrpChecker) IsSameJrps(got, want []model.Jrp) bool { +func (j *JrpChecker) IsSameJrps(got, want []*model.Jrp) bool { if len(got) != len(want) { return false } diff --git a/test/testutility/jrpchecker_test.go b/test/testutility/jrpchecker_test.go index 06df52dd..d6a34706 100644 --- a/test/testutility/jrpchecker_test.go +++ b/test/testutility/jrpchecker_test.go @@ -130,7 +130,7 @@ func TestJrpChecker_GetJrpSeq(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -172,7 +172,7 @@ func TestJrpChecker_GetJrpSeq(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -211,7 +211,7 @@ func TestJrpChecker_GetJrpSeq(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -253,7 +253,7 @@ func TestJrpChecker_GetJrpSeq(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -298,7 +298,7 @@ func TestJrpChecker_GetJrpSeq(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -420,7 +420,7 @@ func TestJrpChecker_IsExist(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -460,7 +460,7 @@ func TestJrpChecker_IsExist(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -500,7 +500,7 @@ func TestJrpChecker_IsExist(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -543,7 +543,7 @@ func TestJrpChecker_IsExist(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -589,7 +589,7 @@ func TestJrpChecker_IsExist(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -711,7 +711,7 @@ func TestJrpChecker_IsFavorited(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -751,7 +751,7 @@ func TestJrpChecker_IsFavorited(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -791,7 +791,7 @@ func TestJrpChecker_IsFavorited(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -834,7 +834,7 @@ func TestJrpChecker_IsFavorited(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -880,7 +880,7 @@ func TestJrpChecker_IsFavorited(t *testing.T) { } if _, err := jrpRepository.SaveHistory( jrpDBFilePath, - []model.Jrp{ + []*model.Jrp{ { Phrase: "test1", Prefix: sqlProxy.StringToNullString(""), @@ -951,8 +951,8 @@ func TestJrpChecker_IsSameJrps(t *testing.T) { StringsProxy stringsproxy.Strings } type args struct { - got []model.Jrp - want []model.Jrp + got []*model.Jrp + want []*model.Jrp } tests := []struct { name string @@ -970,7 +970,7 @@ func TestJrpChecker_IsSameJrps(t *testing.T) { StringsProxy: stringsproxy.New(), }, args: args{ - got: []model.Jrp{ + got: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -981,7 +981,7 @@ func TestJrpChecker_IsSameJrps(t *testing.T) { UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), }, }, - want: []model.Jrp{}, + want: []*model.Jrp{}, }, want: false, }, @@ -995,7 +995,7 @@ func TestJrpChecker_IsSameJrps(t *testing.T) { StringsProxy: stringsproxy.New(), }, args: args{ - got: []model.Jrp{ + got: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1006,7 +1006,7 @@ func TestJrpChecker_IsSameJrps(t *testing.T) { UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), }, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1030,7 +1030,7 @@ func TestJrpChecker_IsSameJrps(t *testing.T) { StringsProxy: stringsproxy.New(), }, args: args{ - got: []model.Jrp{ + got: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1041,7 +1041,7 @@ func TestJrpChecker_IsSameJrps(t *testing.T) { UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), }, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1065,7 +1065,7 @@ func TestJrpChecker_IsSameJrps(t *testing.T) { StringsProxy: stringsproxy.New(), }, args: args{ - got: []model.Jrp{ + got: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1076,7 +1076,7 @@ func TestJrpChecker_IsSameJrps(t *testing.T) { UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), }, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1100,7 +1100,7 @@ func TestJrpChecker_IsSameJrps(t *testing.T) { StringsProxy: stringsproxy.New(), }, args: args{ - got: []model.Jrp{ + got: []*model.Jrp{ { ID: 1, Phrase: "test1", @@ -1111,7 +1111,7 @@ func TestJrpChecker_IsSameJrps(t *testing.T) { UpdatedAt: timeProxy.Date(9999, 12, 31, 0, 0, 0, 0, &timeproxy.UTC), }, }, - want: []model.Jrp{ + want: []*model.Jrp{ { ID: 1, Phrase: "test1",