diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..331c58f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea +vendor \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index f79c9a3..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/repo-go.iml b/.idea/repo-go.iml deleted file mode 100644 index 5e764c4..0000000 --- a/.idea/repo-go.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/go.mod b/go.mod index 907776b..b32ff59 100644 --- a/go.mod +++ b/go.mod @@ -1,26 +1,26 @@ -module github.com/spacetab-io/pgrepo-go +module github.com/spacetab-io/repo-go go 1.18 require ( - github.com/Masterminds/squirrel v1.5.3 // indirect + github.com/Masterminds/squirrel v1.5.3 + github.com/jackc/pgx-zap v0.0.0-20220909013905-c08a18c611dd + github.com/jackc/pgx/v5 v5.1.1 + github.com/spacetab-io/configuration-structs-go/v2 v2.0.0-alpha4 + go.uber.org/zap v1.23.0 +) + +require ( github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect - github.com/davecgh/go-spew v1.1.1 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect - github.com/jackc/pgx-zap v0.0.0-20220909013905-c08a18c611dd // indirect - github.com/jackc/pgx/v5 v5.1.1 // indirect github.com/jackc/puddle/v2 v2.1.2 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/spacetab-io/configuration-structs-go/v2 v2.0.0-alpha4 // indirect github.com/stretchr/testify v1.8.1 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.6.0 // indirect - go.uber.org/zap v1.23.0 // indirect golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7 // indirect golang.org/x/text v0.3.8 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 207814a..3d52a3d 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,7 @@ github.com/Masterminds/squirrel v1.5.3 h1:YPpoceAcxuzIljlr5iWpNKaql7hLeG1KLSrhvd github.com/Masterminds/squirrel v1.5.3/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -19,6 +20,7 @@ github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o= github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk= github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/spacetab-io/configuration-structs-go/v2 v2.0.0-alpha4 h1:WxpQZOZ960I+YoC9ZUgz8rUPQHfDhtC6GGAd9fvUQig= @@ -33,10 +35,10 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY= diff --git a/main.functions.internal_test.go b/main.functions.internal_test.go deleted file mode 100644 index 934e954..0000000 --- a/main.functions.internal_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package repo - -import ( - "testing" - - "github.com/Masterminds/squirrel" - "github.com/stretchr/testify/assert" - "gitlab.worldskills.ru/worldskills/dpws/etc.git/v5/configuration" -) - -var testLimits = &configuration.Limits{ - TitleLen: 4096, - TextLen: 12800, -} - -func TestRepositoryStuff_tsVector(t *testing.T) { - type testCase struct { - name string - in []string - exp squirrel.Sqlizer - } - - tcs := []testCase{ - { - name: "один аргумент", - in: []string{"question"}, - exp: squirrel.Expr(`to_tsvector('russian', lower(question))`), - }, - { - name: "два аргумента", - in: []string{"question", "answer"}, - exp: squirrel.Expr(`to_tsvector('russian', lower(question || ' ' || answer))`), - }, - { - name: "без аргументов", - in: nil, - exp: nil, - }, - } - - t.Parallel() - - for _, tc := range tcs { - tc := tc - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - - r := RepositoryStuff{} - - assert.Equal(t, tc.exp, r.tsVectorFromColumn(ColumnLangRu, tc.in...)) - }) - } -}