Update go-gorp and run go mod tidy. (#4860)
gorp now uses go modules. ``` $ cd ~/go/src/github.com/go-gorp/gorp/ $ git checkout v3.0.1 $ go test ./... ok github.com/go-gorp/gorp/v3 0.002s ```
This commit is contained in:
parent
485f1ee0ba
commit
06ffb57221
|
@ -17,7 +17,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"gopkg.in/go-gorp/gorp.v2"
|
||||
"github.com/go-gorp/gorp/v3"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"golang.org/x/crypto/ocsp"
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"gopkg.in/go-gorp/gorp.v2"
|
||||
"github.com/go-gorp/gorp/v3"
|
||||
|
||||
"golang.org/x/crypto/ocsp"
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
gorp "gopkg.in/go-gorp/gorp.v2"
|
||||
gorp "github.com/go-gorp/gorp/v3"
|
||||
)
|
||||
|
||||
// ErrDatabaseOp wraps an underlying err with a description of the operation
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
gorp "gopkg.in/go-gorp/gorp.v2"
|
||||
gorp "github.com/go-gorp/gorp/v3"
|
||||
|
||||
"github.com/go-sql-driver/mysql"
|
||||
"github.com/letsencrypt/boulder/core"
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"context"
|
||||
"database/sql"
|
||||
|
||||
"gopkg.in/go-gorp/gorp.v2"
|
||||
"github.com/go-gorp/gorp/v3"
|
||||
)
|
||||
|
||||
// These interfaces exist to aid in mocking database operations for unit tests.
|
||||
|
|
5
go.mod
5
go.mod
|
@ -3,11 +3,10 @@ module github.com/letsencrypt/boulder
|
|||
go 1.12
|
||||
|
||||
require (
|
||||
github.com/apoydence/onpar v0.0.0-20181125144932-f2f06780798d // indirect
|
||||
github.com/beeker1121/goque v0.0.0-20170321141813-4044bc29b280
|
||||
github.com/cloudflare/cfssl v1.4.2-0.20200324225241-abef926615f4
|
||||
github.com/eggsampler/acme/v3 v3.0.0
|
||||
github.com/go-gorp/gorp v2.0.0+incompatible // indirect
|
||||
github.com/go-gorp/gorp/v3 v3.0.2
|
||||
github.com/go-sql-driver/mysql v1.5.0
|
||||
github.com/golang/mock v1.3.1
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0
|
||||
|
@ -22,7 +21,6 @@ require (
|
|||
github.com/miekg/pkcs11 v1.0.3
|
||||
github.com/onsi/ginkgo v1.8.0 // indirect
|
||||
github.com/onsi/gomega v1.5.0 // indirect
|
||||
github.com/poy/onpar v0.0.0-20181125144932-f2f06780798d // indirect
|
||||
github.com/prometheus/client_golang v1.2.1
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4
|
||||
github.com/syndtr/goleveldb v0.0.0-20180331014930-714f901b98fd // indirect
|
||||
|
@ -35,7 +33,6 @@ require (
|
|||
golang.org/x/text v0.3.2
|
||||
google.golang.org/grpc v1.29.0
|
||||
google.golang.org/protobuf v1.21.0
|
||||
gopkg.in/go-gorp/gorp.v2 v2.0.1-0.20180410155428-6032c66e0f5f
|
||||
gopkg.in/square/go-jose.v2 v2.4.1
|
||||
gopkg.in/yaml.v2 v2.2.5
|
||||
)
|
||||
|
|
37
go.sum
37
go.sum
|
@ -12,8 +12,6 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy
|
|||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/apoydence/onpar v0.0.0-20181125144932-f2f06780798d h1:FRJKB4Wq559uXmSrWVyMtN3BQ+HYrN6gSdjhvvbCstk=
|
||||
github.com/apoydence/onpar v0.0.0-20181125144932-f2f06780798d/go.mod h1:maauOJD0kdDqIz4xmkunipFVbBoTM6pFSy0kkWBcIUY=
|
||||
github.com/beeker1121/goque v0.0.0-20170321141813-4044bc29b280 h1:ZgW7EEoTQvz27wleAVF3XVBqc6eBFqB4BNw4Awg4BN8=
|
||||
github.com/beeker1121/goque v0.0.0-20170321141813-4044bc29b280/go.mod h1:L6dOWBhDOnxUVQsb0wkLve0VCnt2xJW/MI8pdRX4ANw=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
|
@ -50,8 +48,8 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV
|
|||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/getsentry/raven-go v0.0.0-20180121060056-563b81fc02b7 h1:ELaJ1cjF2nEJeIlHXahGme22yG7TK+3jB6IGCq0Cdrc=
|
||||
github.com/getsentry/raven-go v0.0.0-20180121060056-563b81fc02b7/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
|
||||
github.com/go-gorp/gorp v2.0.0+incompatible h1:dIQPsBtl6/H1MjVseWuWPXa7ET4p6Dve4j3Hg+UjqYw=
|
||||
github.com/go-gorp/gorp v2.0.0+incompatible/go.mod h1:7IfkAQnO7jfT/9IQ3R9wL1dFhukN6aQxzKTHnkxzA/E=
|
||||
github.com/go-gorp/gorp/v3 v3.0.2 h1:ULqJXIekoqMx29FI5ekXXFoH1dT2Vc8UhnRzBg+Emz4=
|
||||
github.com/go-gorp/gorp/v3 v3.0.2/go.mod h1:BJ3q1ejpV8cVALtcXvXaXyTOlMmJhWDxTmncaR6rwBY=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
|
@ -89,6 +87,7 @@ github.com/google/certificate-transparency-go v1.0.22-0.20181127102053-c25855a82
|
|||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=
|
||||
|
@ -106,16 +105,22 @@ github.com/kisielk/sqlstruct v0.0.0-20150923205031-648daed35d49/go.mod h1:yyMNCy
|
|||
github.com/kisom/goutils v1.1.0/go.mod h1:+UBTfd78habUYWFbNWTJNG+jNG/i/lGURakr4A/yNRw=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kylelemons/go-gypsy v0.0.0-20160905020020-08cad365cd28/go.mod h1:T/T7jsxVqf9k/zYOqbgNAsANsjxTd1Yq3htjDhQ1H0c=
|
||||
github.com/letsencrypt/challtestsrv v1.0.2 h1:nBAQjKvVMLhpj4cg2Px6jMyvMbQNdJrCEd6gdcmEuOU=
|
||||
github.com/letsencrypt/challtestsrv v1.0.2/go.mod h1:/gzSMb+5FjprRIa1TtW6ngjhUOr8JbEFM2XESzK2zPg=
|
||||
github.com/letsencrypt/pkcs11key/v4 v4.0.0 h1:qLc/OznH7xMr5ARJgkZCCWk+EomQkiNTOoOF5LAgagc=
|
||||
github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJiIbETBPTl9ATXQag=
|
||||
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU=
|
||||
github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||
github.com/mattn/go-sqlite3 v1.11.0 h1:LDdKkqtYlom37fkvqs8rMPFKAMe8+SgjbwZ6ex1/A/Q=
|
||||
github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/miekg/dns v1.1.1/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
|
@ -132,13 +137,17 @@ github.com/mreiferson/go-httpclient v0.0.0-20160630210159-31f0106b4474/go.mod h1
|
|||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w=
|
||||
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo=
|
||||
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
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/poy/onpar v0.0.0-20181125144932-f2f06780798d/go.mod h1:nSbFQvMj97ZyhFRSJYtut+msi4sOY6zJDGCdSc+/rZU=
|
||||
github.com/poy/onpar v0.0.0-20190519213022-ee068f8ea4d1 h1:oL4IBbcqwhhNWh31bjOX8C/OCy0zs9906d/VUru+bqg=
|
||||
github.com/poy/onpar v0.0.0-20190519213022-ee068f8ea4d1/go.mod h1:nSbFQvMj97ZyhFRSJYtut+msi4sOY6zJDGCdSc+/rZU=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||
github.com/prometheus/client_golang v1.2.1 h1:JnMpQc6ppsNgw9QPAGF6Dod479itz7lvlsMzzNayLOI=
|
||||
|
@ -161,6 +170,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
|||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/syndtr/goleveldb v0.0.0-20180331014930-714f901b98fd h1:WuVJ5mLz1bggtrjvb2pQCZxN4MBDEK/SoyQXGI5UtBA=
|
||||
github.com/syndtr/goleveldb v0.0.0-20180331014930-714f901b98fd/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
|
||||
github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 h1:e/5i7d4oYZ+C1wj2THlRK+oAhjeS/TRQwMfkIuet3w0=
|
||||
|
@ -169,12 +180,9 @@ github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyC
|
|||
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
||||
github.com/weppos/publicsuffix-go v0.4.0/go.mod h1:z3LCPQ38eedDQSwmsSRW4Y7t2L8Ln16JPQ02lHAdn5k=
|
||||
github.com/weppos/publicsuffix-go v0.5.0/go.mod h1:z3LCPQ38eedDQSwmsSRW4Y7t2L8Ln16JPQ02lHAdn5k=
|
||||
github.com/weppos/publicsuffix-go v0.10.1-0.20200202094241-a723c5d90134 h1:PIGnoA+Z23Mup4SOVq24dJPGqt7bce45/ZLrMZdViKc=
|
||||
github.com/weppos/publicsuffix-go v0.10.1-0.20200202094241-a723c5d90134/go.mod h1:z3LCPQ38eedDQSwmsSRW4Y7t2L8Ln16JPQ02lHAdn5k=
|
||||
github.com/weppos/publicsuffix-go v0.13.0 h1:0Tu1uzLBd1jPn4k6OnMmOPZH/l/9bj9kUOMMkoRs6Gg=
|
||||
github.com/weppos/publicsuffix-go v0.13.0/go.mod h1:z3LCPQ38eedDQSwmsSRW4Y7t2L8Ln16JPQ02lHAdn5k=
|
||||
github.com/weppos/publicsuffix-go v0.13.1-0.20200526195454-983d101becd6 h1:ZRXyUEzq0HIULzh5VO/7Igju+LG0hGc8u1FX5SWdTcg=
|
||||
github.com/weppos/publicsuffix-go v0.13.1-0.20200526195454-983d101becd6/go.mod h1:HYux0V0Zi04bHNwOHy4cXJVz/TQjYonnF6aoYhj+3QE=
|
||||
github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs=
|
||||
github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
|
||||
github.com/zmap/rc2 v0.0.0-20131011165748-24b9757f5521/go.mod h1:3YZ9o3WnatTIZhuOtot4IcUfzoKVjUHqu6WALIyI0nE=
|
||||
github.com/zmap/zcertificate v0.0.0-20180516150559-0e3d58b1bac4/go.mod h1:5iU54tB79AMBcySS0R2XIyZBAVmeHranShAFELYx7is=
|
||||
|
@ -203,16 +211,16 @@ golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73r
|
|||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191112182307-2180aed22343 h1:00ohfJ4K98s3m6BGUoBd8nyfp4Yl0GoIKvw5abItTjI=
|
||||
golang.org/x/net v0.0.0-20191112182307-2180aed22343/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI=
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
@ -233,10 +241,13 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3
|
|||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
|
@ -253,17 +264,17 @@ google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zim
|
|||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/go-gorp/gorp.v2 v2.0.1-0.20180410155428-6032c66e0f5f h1:OuFU7cfzlNAFNOXX0F3uy5jrC8YHSR0UeNponDkdZO8=
|
||||
gopkg.in/go-gorp/gorp.v2 v2.0.1-0.20180410155428-6032c66e0f5f/go.mod h1:eJwu1bWCXesk9aw26U78PFtctx3Y8haXGmL7x3VJlrw=
|
||||
gopkg.in/square/go-jose.v2 v2.4.1 h1:H0TmLt7/KmzlrDOpa1F+zr0Tk90PbJYBfsVUmRLrf9Y=
|
||||
gopkg.in/square/go-jose.v2 v2.4.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.5 h1:ymVxjfMaHvXD8RqPRmzHHsB3VvucivSkIAvJFDI5O3c=
|
||||
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
|
|
@ -4,8 +4,8 @@ import (
|
|||
"database/sql"
|
||||
"fmt"
|
||||
|
||||
"github.com/go-gorp/gorp/v3"
|
||||
"github.com/go-sql-driver/mysql"
|
||||
"gopkg.in/go-gorp/gorp.v2"
|
||||
|
||||
"github.com/letsencrypt/boulder/core"
|
||||
boulderDB "github.com/letsencrypt/boulder/db"
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"gopkg.in/go-gorp/gorp.v2"
|
||||
"github.com/go-gorp/gorp/v3"
|
||||
jose "gopkg.in/square/go-jose.v2"
|
||||
|
||||
"github.com/letsencrypt/boulder/core"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
language: go
|
||||
go:
|
||||
- "1.9"
|
||||
- "1.10"
|
||||
- "1.12.x"
|
||||
- "1.13.x"
|
||||
- tip
|
||||
|
||||
matrix:
|
||||
|
@ -10,13 +10,17 @@ matrix:
|
|||
|
||||
services:
|
||||
- mysql
|
||||
- postgres
|
||||
- postgresql
|
||||
- sqlite3
|
||||
|
||||
env:
|
||||
global:
|
||||
- secure: RriLxF6+2yMl67hdVv8ImXlu0h62mhcpqjaOgYNU+IEbUQ7hx96CKY6gkpYubW3BgApvF5RH6j3+HKvh2kGp0XhDOYOQCODfBSaSipZ5Aa5RKjsEYLtuVIobvJ80awR9hUeql69+WXs0/s72WThG0qTbOUY4pqHWfteeY235hWM=
|
||||
|
||||
install:
|
||||
- go get -t -d
|
||||
- go get -t -d -tags integration
|
||||
|
||||
before_script:
|
||||
- mysql -e "CREATE DATABASE gorptest;"
|
||||
- mysql -u root -e "GRANT ALL ON gorptest.* TO gorptest@localhost IDENTIFIED BY 'gorptest'"
|
||||
|
@ -28,6 +32,5 @@ before_script:
|
|||
- go get github.com/go-sql-driver/mysql
|
||||
- go get golang.org/x/tools/cmd/cover
|
||||
- go get github.com/mattn/goveralls
|
||||
- go get github.com/onsi/ginkgo/ginkgo
|
||||
|
||||
script: ./test_all.sh
|
0
vendor/gopkg.in/go-gorp/gorp.v2/LICENSE → vendor/github.com/go-gorp/gorp/v3/LICENSE
generated
vendored
0
vendor/gopkg.in/go-gorp/gorp.v2/LICENSE → vendor/github.com/go-gorp/gorp/v3/LICENSE
generated
vendored
21
vendor/gopkg.in/go-gorp/gorp.v2/README.md → vendor/github.com/go-gorp/gorp/v3/README.md
generated
vendored
21
vendor/gopkg.in/go-gorp/gorp.v2/README.md → vendor/github.com/go-gorp/gorp/v3/README.md
generated
vendored
|
@ -318,7 +318,7 @@ See the `TestWithEmbeddedStruct` function in `gorp_test.go` for a full example.
|
|||
|
||||
Automatically create / drop registered tables. This is useful for unit tests
|
||||
but is entirely optional. You can of course use gorp with tables created manually,
|
||||
or with a separate migration tool (like [goose](https://bitbucket.org/liamstask/goose) or [migrate](https://github.com/mattes/migrate)).
|
||||
or with a separate migration tool (like [sql-migrate](https://github.com/rubenv/sql-migrate), [goose](https://bitbucket.org/liamstask/goose) or [migrate](https://github.com/mattes/migrate)).
|
||||
|
||||
```go
|
||||
// create all registered tables
|
||||
|
@ -436,11 +436,13 @@ type InvoicePersonView struct {
|
|||
|
||||
// Create some rows
|
||||
p1 := &Person{0, 0, 0, "bob", "smith"}
|
||||
dbmap.Insert(p1)
|
||||
err = dbmap.Insert(p1)
|
||||
checkErr(err, "Insert failed")
|
||||
|
||||
// notice how we can wire up p1.Id to the invoice easily
|
||||
inv1 := &Invoice{0, 0, 0, "xmas order", p1.Id}
|
||||
dbmap.Insert(inv1)
|
||||
err = dbmap.Insert(inv1)
|
||||
checkErr(err, "Insert failed")
|
||||
|
||||
// Run your query
|
||||
query := "select i.Id InvoiceId, p.Id PersonId, i.Memo, p.FName " +
|
||||
|
@ -503,9 +505,12 @@ func InsertInv(dbmap *DbMap, inv *Invoice, per *Person) error {
|
|||
return err
|
||||
}
|
||||
|
||||
trans.Insert(per)
|
||||
err = trans.Insert(per)
|
||||
checkErr(err, "Insert failed")
|
||||
|
||||
inv.PersonId = per.Id
|
||||
trans.Insert(inv)
|
||||
err = trans.Insert(inv)
|
||||
checkErr(err, "Insert failed")
|
||||
|
||||
// if the commit is successful, a nil error is returned
|
||||
return trans.Commit()
|
||||
|
@ -591,12 +596,14 @@ type Person struct {
|
|||
}
|
||||
|
||||
p1 := &Person{0, 0, 0, "Bob", "Smith", 0}
|
||||
dbmap.Insert(p1) // Version is now 1
|
||||
err = dbmap.Insert(p1) // Version is now 1
|
||||
checkErr(err, "Insert failed")
|
||||
|
||||
obj, err := dbmap.Get(Person{}, p1.Id)
|
||||
p2 := obj.(*Person)
|
||||
p2.LName = "Edwards"
|
||||
dbmap.Update(p2) // Version is now 2
|
||||
_,err = dbmap.Update(p2) // Version is now 2
|
||||
checkErr(err, "Update failed")
|
||||
|
||||
p1.LName = "Howard"
|
||||
|
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
import "reflect"
|
212
vendor/gopkg.in/go-gorp/gorp.v2/db.go → vendor/github.com/go-gorp/gorp/v3/db.go
generated
vendored
212
vendor/gopkg.in/go-gorp/gorp.v2/db.go → vendor/github.com/go-gorp/gorp/v3/db.go
generated
vendored
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
import (
|
||||
|
@ -45,6 +38,57 @@ type DbMap struct {
|
|||
|
||||
TypeConverter TypeConverter
|
||||
|
||||
// ExpandSlices when enabled will convert slice arguments in mappers into flat
|
||||
// values. It will modify the query, adding more placeholders, and the mapper,
|
||||
// adding each item of the slice as a new unique entry in the mapper. For
|
||||
// example, given the scenario bellow:
|
||||
//
|
||||
// dbmap.Select(&output, "SELECT 1 FROM example WHERE id IN (:IDs)", map[string]interface{}{
|
||||
// "IDs": []int64{1, 2, 3},
|
||||
// })
|
||||
//
|
||||
// The executed query would be:
|
||||
//
|
||||
// SELECT 1 FROM example WHERE id IN (:IDs0,:IDs1,:IDs2)
|
||||
//
|
||||
// With the mapper:
|
||||
//
|
||||
// map[string]interface{}{
|
||||
// "IDs": []int64{1, 2, 3},
|
||||
// "IDs0": int64(1),
|
||||
// "IDs1": int64(2),
|
||||
// "IDs2": int64(3),
|
||||
// }
|
||||
//
|
||||
// It is also flexible for custom slice types. The value just need to
|
||||
// implement stringer or numberer interfaces.
|
||||
//
|
||||
// type CustomValue string
|
||||
//
|
||||
// const (
|
||||
// CustomValueHey CustomValue = "hey"
|
||||
// CustomValueOh CustomValue = "oh"
|
||||
// )
|
||||
//
|
||||
// type CustomValues []CustomValue
|
||||
//
|
||||
// func (c CustomValues) ToStringSlice() []string {
|
||||
// values := make([]string, len(c))
|
||||
// for i := range c {
|
||||
// values[i] = string(c[i])
|
||||
// }
|
||||
// return values
|
||||
// }
|
||||
//
|
||||
// func query() {
|
||||
// // ...
|
||||
// result, err := dbmap.Select(&output, "SELECT 1 FROM example WHERE value IN (:Values)", map[string]interface{}{
|
||||
// "Values": CustomValues([]CustomValue{CustomValueHey}),
|
||||
// })
|
||||
// // ...
|
||||
// }
|
||||
ExpandSliceArgs bool
|
||||
|
||||
tables []*TableMap
|
||||
tablesDynamic map[string]*TableMap // tables that use same go-struct and different db table names
|
||||
logger GorpLogger
|
||||
|
@ -605,12 +649,20 @@ func (m *DbMap) Get(i interface{}, keys ...interface{}) (interface{}, error) {
|
|||
//
|
||||
// i does NOT need to be registered with AddTable()
|
||||
func (m *DbMap) Select(i interface{}, query string, args ...interface{}) ([]interface{}, error) {
|
||||
if m.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
return hookedselect(m, m, i, query, args...)
|
||||
}
|
||||
|
||||
// Exec runs an arbitrary SQL statement. args represent the bind parameters.
|
||||
// This is equivalent to running: Exec() using database/sql
|
||||
func (m *DbMap) Exec(query string, args ...interface{}) (sql.Result, error) {
|
||||
if m.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
if m.logger != nil {
|
||||
now := time.Now()
|
||||
defer m.trace(now, query, args...)
|
||||
|
@ -620,36 +672,64 @@ func (m *DbMap) Exec(query string, args ...interface{}) (sql.Result, error) {
|
|||
|
||||
// SelectInt is a convenience wrapper around the gorp.SelectInt function
|
||||
func (m *DbMap) SelectInt(query string, args ...interface{}) (int64, error) {
|
||||
if m.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
return SelectInt(m, query, args...)
|
||||
}
|
||||
|
||||
// SelectNullInt is a convenience wrapper around the gorp.SelectNullInt function
|
||||
func (m *DbMap) SelectNullInt(query string, args ...interface{}) (sql.NullInt64, error) {
|
||||
if m.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
return SelectNullInt(m, query, args...)
|
||||
}
|
||||
|
||||
// SelectFloat is a convenience wrapper around the gorp.SelectFloat function
|
||||
func (m *DbMap) SelectFloat(query string, args ...interface{}) (float64, error) {
|
||||
if m.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
return SelectFloat(m, query, args...)
|
||||
}
|
||||
|
||||
// SelectNullFloat is a convenience wrapper around the gorp.SelectNullFloat function
|
||||
func (m *DbMap) SelectNullFloat(query string, args ...interface{}) (sql.NullFloat64, error) {
|
||||
if m.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
return SelectNullFloat(m, query, args...)
|
||||
}
|
||||
|
||||
// SelectStr is a convenience wrapper around the gorp.SelectStr function
|
||||
func (m *DbMap) SelectStr(query string, args ...interface{}) (string, error) {
|
||||
if m.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
return SelectStr(m, query, args...)
|
||||
}
|
||||
|
||||
// SelectNullStr is a convenience wrapper around the gorp.SelectNullStr function
|
||||
func (m *DbMap) SelectNullStr(query string, args ...interface{}) (sql.NullString, error) {
|
||||
if m.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
return SelectNullStr(m, query, args...)
|
||||
}
|
||||
|
||||
// SelectOne is a convenience wrapper around the gorp.SelectOne function
|
||||
func (m *DbMap) SelectOne(holder interface{}, query string, args ...interface{}) error {
|
||||
if m.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
return SelectOne(m, m, holder, query, args...)
|
||||
}
|
||||
|
||||
|
@ -764,6 +844,10 @@ func (m *DbMap) tableForPointer(ptr interface{}, checkPK bool) (*TableMap, refle
|
|||
}
|
||||
|
||||
func (m *DbMap) QueryRow(query string, args ...interface{}) *sql.Row {
|
||||
if m.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
if m.logger != nil {
|
||||
now := time.Now()
|
||||
defer m.trace(now, query, args...)
|
||||
|
@ -772,6 +856,10 @@ func (m *DbMap) QueryRow(query string, args ...interface{}) *sql.Row {
|
|||
}
|
||||
|
||||
func (m *DbMap) Query(q string, args ...interface{}) (*sql.Rows, error) {
|
||||
if m.ExpandSliceArgs {
|
||||
expandSliceArgs(&q, args...)
|
||||
}
|
||||
|
||||
if m.logger != nil {
|
||||
now := time.Now()
|
||||
defer m.trace(now, q, args...)
|
||||
|
@ -780,8 +868,118 @@ func (m *DbMap) Query(q string, args ...interface{}) (*sql.Rows, error) {
|
|||
}
|
||||
|
||||
func (m *DbMap) trace(started time.Time, query string, args ...interface{}) {
|
||||
if m.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
if m.logger != nil {
|
||||
var margs = argsString(args...)
|
||||
m.logger.Printf("%s%s [%s] (%v)", m.logPrefix, query, margs, (time.Now().Sub(started)))
|
||||
}
|
||||
}
|
||||
|
||||
type stringer interface {
|
||||
ToStringSlice() []string
|
||||
}
|
||||
|
||||
type numberer interface {
|
||||
ToInt64Slice() []int64
|
||||
}
|
||||
|
||||
func expandSliceArgs(query *string, args ...interface{}) {
|
||||
for _, arg := range args {
|
||||
mapper, ok := arg.(map[string]interface{})
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
for key, value := range mapper {
|
||||
var replacements []string
|
||||
|
||||
// add flexibility for any custom type to be convert to one of the
|
||||
// acceptable formats.
|
||||
if v, ok := value.(stringer); ok {
|
||||
value = v.ToStringSlice()
|
||||
}
|
||||
if v, ok := value.(numberer); ok {
|
||||
value = v.ToInt64Slice()
|
||||
}
|
||||
|
||||
switch v := value.(type) {
|
||||
case []string:
|
||||
for id, replace := range v {
|
||||
mapper[fmt.Sprintf("%s%d", key, id)] = replace
|
||||
replacements = append(replacements, fmt.Sprintf(":%s%d", key, id))
|
||||
}
|
||||
case []uint:
|
||||
for id, replace := range v {
|
||||
mapper[fmt.Sprintf("%s%d", key, id)] = replace
|
||||
replacements = append(replacements, fmt.Sprintf(":%s%d", key, id))
|
||||
}
|
||||
case []uint8:
|
||||
for id, replace := range v {
|
||||
mapper[fmt.Sprintf("%s%d", key, id)] = replace
|
||||
replacements = append(replacements, fmt.Sprintf(":%s%d", key, id))
|
||||
}
|
||||
case []uint16:
|
||||
for id, replace := range v {
|
||||
mapper[fmt.Sprintf("%s%d", key, id)] = replace
|
||||
replacements = append(replacements, fmt.Sprintf(":%s%d", key, id))
|
||||
}
|
||||
case []uint32:
|
||||
for id, replace := range v {
|
||||
mapper[fmt.Sprintf("%s%d", key, id)] = replace
|
||||
replacements = append(replacements, fmt.Sprintf(":%s%d", key, id))
|
||||
}
|
||||
case []uint64:
|
||||
for id, replace := range v {
|
||||
mapper[fmt.Sprintf("%s%d", key, id)] = replace
|
||||
replacements = append(replacements, fmt.Sprintf(":%s%d", key, id))
|
||||
}
|
||||
case []int:
|
||||
for id, replace := range v {
|
||||
mapper[fmt.Sprintf("%s%d", key, id)] = replace
|
||||
replacements = append(replacements, fmt.Sprintf(":%s%d", key, id))
|
||||
}
|
||||
case []int8:
|
||||
for id, replace := range v {
|
||||
mapper[fmt.Sprintf("%s%d", key, id)] = replace
|
||||
replacements = append(replacements, fmt.Sprintf(":%s%d", key, id))
|
||||
}
|
||||
case []int16:
|
||||
for id, replace := range v {
|
||||
mapper[fmt.Sprintf("%s%d", key, id)] = replace
|
||||
replacements = append(replacements, fmt.Sprintf(":%s%d", key, id))
|
||||
}
|
||||
case []int32:
|
||||
for id, replace := range v {
|
||||
mapper[fmt.Sprintf("%s%d", key, id)] = replace
|
||||
replacements = append(replacements, fmt.Sprintf(":%s%d", key, id))
|
||||
}
|
||||
case []int64:
|
||||
for id, replace := range v {
|
||||
mapper[fmt.Sprintf("%s%d", key, id)] = replace
|
||||
replacements = append(replacements, fmt.Sprintf(":%s%d", key, id))
|
||||
}
|
||||
case []float32:
|
||||
for id, replace := range v {
|
||||
mapper[fmt.Sprintf("%s%d", key, id)] = replace
|
||||
replacements = append(replacements, fmt.Sprintf(":%s%d", key, id))
|
||||
}
|
||||
case []float64:
|
||||
for id, replace := range v {
|
||||
mapper[fmt.Sprintf("%s%d", key, id)] = replace
|
||||
replacements = append(replacements, fmt.Sprintf(":%s%d", key, id))
|
||||
}
|
||||
default:
|
||||
continue
|
||||
}
|
||||
|
||||
if len(replacements) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
*query = strings.Replace(*query, fmt.Sprintf(":%s", key), strings.Join(replacements, ","), -1)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
import (
|
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
import (
|
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
import (
|
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
import (
|
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
import (
|
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
import (
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright 2012 James Cooper. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
package gorp
|
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
import (
|
|
@ -0,0 +1,15 @@
|
|||
module github.com/go-gorp/gorp/v3
|
||||
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/go-sql-driver/mysql v1.4.1
|
||||
github.com/lib/pq v1.2.0
|
||||
github.com/mattn/go-sqlite3 v1.11.0
|
||||
github.com/poy/onpar v0.0.0-20190519213022-ee068f8ea4d1
|
||||
github.com/stretchr/testify v1.4.0
|
||||
github.com/ziutek/mymysql v1.5.4
|
||||
google.golang.org/appengine v1.6.5 // indirect
|
||||
gopkg.in/yaml.v2 v2.2.4 // indirect
|
||||
)
|
|
@ -0,0 +1,34 @@
|
|||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
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=
|
||||
github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
|
||||
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0=
|
||||
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/mattn/go-sqlite3 v1.11.0 h1:LDdKkqtYlom37fkvqs8rMPFKAMe8+SgjbwZ6ex1/A/Q=
|
||||
github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||
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/poy/onpar v0.0.0-20190519213022-ee068f8ea4d1 h1:oL4IBbcqwhhNWh31bjOX8C/OCy0zs9906d/VUru+bqg=
|
||||
github.com/poy/onpar v0.0.0-20190519213022-ee068f8ea4d1/go.mod h1:nSbFQvMj97ZyhFRSJYtut+msi4sOY6zJDGCdSc+/rZU=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs=
|
||||
github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
92
vendor/gopkg.in/go-gorp/gorp.v2/gorp.go → vendor/github.com/go-gorp/gorp/v3/gorp.go
generated
vendored
92
vendor/gopkg.in/go-gorp/gorp.v2/gorp.go → vendor/github.com/go-gorp/gorp/v3/gorp.go
generated
vendored
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
//
|
||||
package gorp
|
||||
|
||||
import (
|
||||
|
@ -127,16 +120,26 @@ type DynamicTable interface {
|
|||
// interface.
|
||||
var _, _ SqlExecutor = &DbMap{}, &Transaction{}
|
||||
|
||||
func argValue(a interface{}) interface{} {
|
||||
v, ok := a.(driver.Valuer)
|
||||
if !ok {
|
||||
return a
|
||||
}
|
||||
vV := reflect.ValueOf(v)
|
||||
if vV.Kind() == reflect.Ptr && vV.IsNil() {
|
||||
return nil
|
||||
}
|
||||
ret, err := v.Value()
|
||||
if err != nil {
|
||||
return a
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func argsString(args ...interface{}) string {
|
||||
var margs string
|
||||
for i, a := range args {
|
||||
var v interface{} = a
|
||||
if x, ok := v.(driver.Valuer); ok {
|
||||
y, err := x.Value()
|
||||
if err == nil {
|
||||
v = y
|
||||
}
|
||||
}
|
||||
v := argValue(a)
|
||||
switch v.(type) {
|
||||
case string:
|
||||
v = fmt.Sprintf("%q", v)
|
||||
|
@ -173,6 +176,19 @@ func extractDbMap(e SqlExecutor) *DbMap {
|
|||
return nil
|
||||
}
|
||||
|
||||
// executor exposes the sql.DB and sql.Tx functions so that it can be used
|
||||
// on internal functions that need to be agnostic to the underlying object.
|
||||
type executor interface {
|
||||
Exec(query string, args ...interface{}) (sql.Result, error)
|
||||
Prepare(query string) (*sql.Stmt, error)
|
||||
QueryRow(query string, args ...interface{}) *sql.Row
|
||||
Query(query string, args ...interface{}) (*sql.Rows, error)
|
||||
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
|
||||
PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
|
||||
QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
|
||||
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
|
||||
}
|
||||
|
||||
func extractExecutorAndContext(e SqlExecutor) (executor, context.Context) {
|
||||
switch m := e.(type) {
|
||||
case *DbMap:
|
||||
|
@ -606,3 +622,51 @@ func insert(m *DbMap, exec SqlExecutor, list ...interface{}) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func exec(e SqlExecutor, query string, args ...interface{}) (sql.Result, error) {
|
||||
executor, ctx := extractExecutorAndContext(e)
|
||||
|
||||
if ctx != nil {
|
||||
return executor.ExecContext(ctx, query, args...)
|
||||
}
|
||||
|
||||
return executor.Exec(query, args...)
|
||||
}
|
||||
|
||||
func prepare(e SqlExecutor, query string) (*sql.Stmt, error) {
|
||||
executor, ctx := extractExecutorAndContext(e)
|
||||
|
||||
if ctx != nil {
|
||||
return executor.PrepareContext(ctx, query)
|
||||
}
|
||||
|
||||
return executor.Prepare(query)
|
||||
}
|
||||
|
||||
func queryRow(e SqlExecutor, query string, args ...interface{}) *sql.Row {
|
||||
executor, ctx := extractExecutorAndContext(e)
|
||||
|
||||
if ctx != nil {
|
||||
return executor.QueryRowContext(ctx, query, args...)
|
||||
}
|
||||
|
||||
return executor.QueryRow(query, args...)
|
||||
}
|
||||
|
||||
func query(e SqlExecutor, query string, args ...interface{}) (*sql.Rows, error) {
|
||||
executor, ctx := extractExecutorAndContext(e)
|
||||
|
||||
if ctx != nil {
|
||||
return executor.QueryContext(ctx, query, args...)
|
||||
}
|
||||
|
||||
return executor.Query(query, args...)
|
||||
}
|
||||
|
||||
func begin(m *DbMap) (*sql.Tx, error) {
|
||||
if m.ctx != nil {
|
||||
return m.Db.BeginTx(m.ctx, nil)
|
||||
}
|
||||
|
||||
return m.Db.Begin()
|
||||
}
|
21
vendor/gopkg.in/go-gorp/gorp.v2/hooks.go → vendor/github.com/go-gorp/gorp/v3/hooks.go
generated
vendored
21
vendor/gopkg.in/go-gorp/gorp.v2/hooks.go → vendor/github.com/go-gorp/gorp/v3/hooks.go
generated
vendored
|
@ -2,48 +2,41 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
//++ TODO v2-phase3: HasPostGet => PostGetter, HasPostDelete => PostDeleter, etc.
|
||||
|
||||
// PostUpdate() will be executed after the GET statement.
|
||||
// HasPostGet provides PostGet() which will be executed after the GET statement.
|
||||
type HasPostGet interface {
|
||||
PostGet(SqlExecutor) error
|
||||
}
|
||||
|
||||
// PostUpdate() will be executed after the DELETE statement
|
||||
// HasPostDelete provides PostDelete() which will be executed after the DELETE statement
|
||||
type HasPostDelete interface {
|
||||
PostDelete(SqlExecutor) error
|
||||
}
|
||||
|
||||
// PostUpdate() will be executed after the UPDATE statement
|
||||
// HasPostUpdate provides PostUpdate() which will be executed after the UPDATE statement
|
||||
type HasPostUpdate interface {
|
||||
PostUpdate(SqlExecutor) error
|
||||
}
|
||||
|
||||
// PostInsert() will be executed after the INSERT statement
|
||||
// HasPostInsert provides PostInsert() which will be executed after the INSERT statement
|
||||
type HasPostInsert interface {
|
||||
PostInsert(SqlExecutor) error
|
||||
}
|
||||
|
||||
// PreDelete() will be executed before the DELETE statement.
|
||||
// HasPreDelete provides PreDelete() which will be executed before the DELETE statement.
|
||||
type HasPreDelete interface {
|
||||
PreDelete(SqlExecutor) error
|
||||
}
|
||||
|
||||
// PreUpdate() will be executed before UPDATE statement.
|
||||
// HasPreUpdate provides PreUpdate() which will be executed before UPDATE statement.
|
||||
type HasPreUpdate interface {
|
||||
PreUpdate(SqlExecutor) error
|
||||
}
|
||||
|
||||
// PreInsert() will be executed before INSERT statement.
|
||||
// HasPreInsert provides PreInsert() which will be executed before INSERT statement.
|
||||
type HasPreInsert interface {
|
||||
PreInsert(SqlExecutor) error
|
||||
}
|
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
// IndexMap represents a mapping between a Go struct field and a single
|
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
import (
|
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
import "fmt"
|
|
@ -2,17 +2,11 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"log"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -24,26 +18,39 @@ type NullTime struct {
|
|||
|
||||
// Scan implements the Scanner interface.
|
||||
func (nt *NullTime) Scan(value interface{}) error {
|
||||
log.Printf("Time scan value is: %#v", value)
|
||||
switch t := value.(type) {
|
||||
case time.Time:
|
||||
nt.Time, nt.Valid = t, true
|
||||
case []byte:
|
||||
nt.Valid = false
|
||||
for _, dtfmt := range []string{
|
||||
"2006-01-02 15:04:05.999999999",
|
||||
"2006-01-02T15:04:05.999999999",
|
||||
"2006-01-02 15:04:05",
|
||||
"2006-01-02T15:04:05",
|
||||
"2006-01-02 15:04",
|
||||
"2006-01-02T15:04",
|
||||
"2006-01-02",
|
||||
"2006-01-02 15:04:05-07:00",
|
||||
} {
|
||||
var err error
|
||||
if nt.Time, err = time.Parse(dtfmt, string(t)); err == nil {
|
||||
nt.Valid = true
|
||||
break
|
||||
}
|
||||
v := strToTime(string(t))
|
||||
if v != nil {
|
||||
nt.Valid = true
|
||||
nt.Time = *v
|
||||
}
|
||||
case string:
|
||||
v := strToTime(t)
|
||||
if v != nil {
|
||||
nt.Valid = true
|
||||
nt.Time = *v
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func strToTime(v string) *time.Time {
|
||||
for _, dtfmt := range []string{
|
||||
"2006-01-02 15:04:05.999999999",
|
||||
"2006-01-02T15:04:05.999999999",
|
||||
"2006-01-02 15:04:05",
|
||||
"2006-01-02T15:04:05",
|
||||
"2006-01-02 15:04",
|
||||
"2006-01-02T15:04",
|
||||
"2006-01-02",
|
||||
"2006-01-02 15:04:05-07:00",
|
||||
} {
|
||||
if t, err := time.Parse(dtfmt, v); err == nil {
|
||||
return &t
|
||||
}
|
||||
}
|
||||
return nil
|
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
import (
|
27
vendor/gopkg.in/go-gorp/gorp.v2/table.go → vendor/github.com/go-gorp/gorp/v3/table.go
generated
vendored
27
vendor/gopkg.in/go-gorp/gorp.v2/table.go → vendor/github.com/go-gorp/gorp/v3/table.go
generated
vendored
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
import (
|
||||
|
@ -87,10 +80,16 @@ func (t *TableMap) SetUniqueTogether(fieldNames ...string) *TableMap {
|
|||
"gorp: SetUniqueTogether: must provide at least two fieldNames to set uniqueness constraint."))
|
||||
}
|
||||
|
||||
columns := make([]string, 0)
|
||||
columns := make([]string, 0, len(fieldNames))
|
||||
for _, name := range fieldNames {
|
||||
columns = append(columns, name)
|
||||
}
|
||||
|
||||
for _, existingColumns := range t.uniqueTogether {
|
||||
if equal(existingColumns, columns) {
|
||||
return t
|
||||
}
|
||||
}
|
||||
t.uniqueTogether = append(t.uniqueTogether, columns)
|
||||
t.ResetSql()
|
||||
|
||||
|
@ -245,3 +244,15 @@ func (t *TableMap) SqlForCreate(ifNotExists bool) string {
|
|||
s.WriteString(dialect.QuerySuffix())
|
||||
return s.String()
|
||||
}
|
||||
|
||||
func equal(a, b []string) bool {
|
||||
if len(a) != len(b) {
|
||||
return false
|
||||
}
|
||||
for i := range a {
|
||||
if a[i] != b[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
import (
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash -e
|
||||
#!/bin/bash -ex
|
||||
|
||||
# on macs, you may need to:
|
||||
# export GOBUILDFLAG=-ldflags -linkmode=external
|
||||
|
@ -6,27 +6,27 @@
|
|||
coveralls_testflags="-v -covermode=count -coverprofile=coverage.out"
|
||||
|
||||
echo "Running unit tests"
|
||||
ginkgo -r -race -randomizeAllSpecs -keepGoing -- -test.run TestGorp
|
||||
go test -race
|
||||
|
||||
echo "Testing against mysql"
|
||||
export GORP_TEST_DSN=gorptest/gorptest/gorptest
|
||||
export GORP_TEST_DIALECT=mysql
|
||||
go test $coveralls_testflags $GOBUILDFLAG $@ .
|
||||
go test -tags integration $coveralls_testflags $GOBUILDFLAG $@ .
|
||||
|
||||
echo "Testing against gomysql"
|
||||
export GORP_TEST_DSN=gorptest:gorptest@/gorptest
|
||||
export GORP_TEST_DIALECT=gomysql
|
||||
go test $coveralls_testflags $GOBUILDFLAG $@ .
|
||||
go test -tags integration $coveralls_testflags $GOBUILDFLAG $@ .
|
||||
|
||||
echo "Testing against postgres"
|
||||
export GORP_TEST_DSN="user=gorptest password=gorptest dbname=gorptest sslmode=disable"
|
||||
export GORP_TEST_DIALECT=postgres
|
||||
go test $coveralls_testflags $GOBUILDFLAG $@ .
|
||||
go test -tags integration $coveralls_testflags $GOBUILDFLAG $@ .
|
||||
|
||||
echo "Testing against sqlite"
|
||||
export GORP_TEST_DSN=/tmp/gorptest.bin
|
||||
export GORP_TEST_DIALECT=sqlite
|
||||
go test $coveralls_testflags $GOBUILDFLAG $@ .
|
||||
go test -tags integration $coveralls_testflags $GOBUILDFLAG $@ .
|
||||
rm -f /tmp/gorptest.bin
|
||||
|
||||
case $(go version) in
|
|
@ -2,13 +2,6 @@
|
|||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
|
||||
package gorp
|
||||
|
||||
import (
|
||||
|
@ -62,50 +55,86 @@ func (t *Transaction) Get(i interface{}, keys ...interface{}) (interface{}, erro
|
|||
|
||||
// Select has the same behavior as DbMap.Select(), but runs in a transaction.
|
||||
func (t *Transaction) Select(i interface{}, query string, args ...interface{}) ([]interface{}, error) {
|
||||
if t.dbmap.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
return hookedselect(t.dbmap, t, i, query, args...)
|
||||
}
|
||||
|
||||
// Exec has the same behavior as DbMap.Exec(), but runs in a transaction.
|
||||
func (t *Transaction) Exec(query string, args ...interface{}) (sql.Result, error) {
|
||||
if t.dbmap.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
if t.dbmap.logger != nil {
|
||||
now := time.Now()
|
||||
defer t.dbmap.trace(now, query, args...)
|
||||
}
|
||||
return exec(t, query, args...)
|
||||
return maybeExpandNamedQueryAndExec(t, query, args...)
|
||||
}
|
||||
|
||||
// SelectInt is a convenience wrapper around the gorp.SelectInt function.
|
||||
func (t *Transaction) SelectInt(query string, args ...interface{}) (int64, error) {
|
||||
if t.dbmap.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
return SelectInt(t, query, args...)
|
||||
}
|
||||
|
||||
// SelectNullInt is a convenience wrapper around the gorp.SelectNullInt function.
|
||||
func (t *Transaction) SelectNullInt(query string, args ...interface{}) (sql.NullInt64, error) {
|
||||
if t.dbmap.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
return SelectNullInt(t, query, args...)
|
||||
}
|
||||
|
||||
// SelectFloat is a convenience wrapper around the gorp.SelectFloat function.
|
||||
func (t *Transaction) SelectFloat(query string, args ...interface{}) (float64, error) {
|
||||
if t.dbmap.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
return SelectFloat(t, query, args...)
|
||||
}
|
||||
|
||||
// SelectNullFloat is a convenience wrapper around the gorp.SelectNullFloat function.
|
||||
func (t *Transaction) SelectNullFloat(query string, args ...interface{}) (sql.NullFloat64, error) {
|
||||
if t.dbmap.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
return SelectNullFloat(t, query, args...)
|
||||
}
|
||||
|
||||
// SelectStr is a convenience wrapper around the gorp.SelectStr function.
|
||||
func (t *Transaction) SelectStr(query string, args ...interface{}) (string, error) {
|
||||
if t.dbmap.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
return SelectStr(t, query, args...)
|
||||
}
|
||||
|
||||
// SelectNullStr is a convenience wrapper around the gorp.SelectNullStr function.
|
||||
func (t *Transaction) SelectNullStr(query string, args ...interface{}) (sql.NullString, error) {
|
||||
if t.dbmap.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
return SelectNullStr(t, query, args...)
|
||||
}
|
||||
|
||||
// SelectOne is a convenience wrapper around the gorp.SelectOne function.
|
||||
func (t *Transaction) SelectOne(holder interface{}, query string, args ...interface{}) error {
|
||||
if t.dbmap.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
return SelectOne(t.dbmap, t, holder, query, args...)
|
||||
}
|
||||
|
||||
|
@ -186,6 +215,10 @@ func (t *Transaction) Prepare(query string) (*sql.Stmt, error) {
|
|||
}
|
||||
|
||||
func (t *Transaction) QueryRow(query string, args ...interface{}) *sql.Row {
|
||||
if t.dbmap.ExpandSliceArgs {
|
||||
expandSliceArgs(&query, args...)
|
||||
}
|
||||
|
||||
if t.dbmap.logger != nil {
|
||||
now := time.Now()
|
||||
defer t.dbmap.trace(now, query, args...)
|
||||
|
@ -194,6 +227,10 @@ func (t *Transaction) QueryRow(query string, args ...interface{}) *sql.Row {
|
|||
}
|
||||
|
||||
func (t *Transaction) Query(q string, args ...interface{}) (*sql.Rows, error) {
|
||||
if t.dbmap.ExpandSliceArgs {
|
||||
expandSliceArgs(&q, args...)
|
||||
}
|
||||
|
||||
if t.dbmap.logger != nil {
|
||||
now := time.Now()
|
||||
defer t.dbmap.trace(now, q, args...)
|
|
@ -1,54 +0,0 @@
|
|||
// Copyright 2012 James Cooper. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
//
|
||||
|
||||
// +build !go1.8
|
||||
|
||||
package gorp
|
||||
|
||||
import "database/sql"
|
||||
|
||||
// Executor exposes the sql.DB and sql.Tx functions so that it can be used
|
||||
// on internal functions that need to be agnostic to the underlying object.
|
||||
type executor interface {
|
||||
Exec(query string, args ...interface{}) (sql.Result, error)
|
||||
Prepare(query string) (*sql.Stmt, error)
|
||||
QueryRow(query string, args ...interface{}) *sql.Row
|
||||
Query(query string, args ...interface{}) (*sql.Rows, error)
|
||||
}
|
||||
|
||||
func exec(e SqlExecutor, query string, args ...interface{}) (sql.Result, error) {
|
||||
executor, _ := extractExecutorAndContext(e)
|
||||
|
||||
return executor.Exec(query, args...)
|
||||
}
|
||||
|
||||
func prepare(e SqlExecutor, query string) (*sql.Stmt, error) {
|
||||
executor, _ := extractExecutorAndContext(e)
|
||||
|
||||
return executor.Prepare(query)
|
||||
}
|
||||
|
||||
func queryRow(e SqlExecutor, query string, args ...interface{}) *sql.Row {
|
||||
executor, _ := extractExecutorAndContext(e)
|
||||
|
||||
return executor.QueryRow(query, args...)
|
||||
}
|
||||
|
||||
func query(e SqlExecutor, query string, args ...interface{}) (*sql.Rows, error) {
|
||||
executor, _ := extractExecutorAndContext(e)
|
||||
|
||||
return executor.Query(query, args...)
|
||||
}
|
||||
|
||||
func begin(m *DbMap) (*sql.Tx, error) {
|
||||
return m.Db.Begin()
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
// Copyright 2012 James Cooper. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gorp provides a simple way to marshal Go structs to and from
|
||||
// SQL databases. It uses the database/sql package, and should work with any
|
||||
// compliant database/sql driver.
|
||||
//
|
||||
// Source code and project home:
|
||||
// https://github.com/go-gorp/gorp
|
||||
//
|
||||
|
||||
// +build go1.8
|
||||
|
||||
package gorp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
// executor exposes the sql.DB and sql.Tx functions so that it can be used
|
||||
// on internal functions that need to be agnostic to the underlying object.
|
||||
type executor interface {
|
||||
Exec(query string, args ...interface{}) (sql.Result, error)
|
||||
Prepare(query string) (*sql.Stmt, error)
|
||||
QueryRow(query string, args ...interface{}) *sql.Row
|
||||
Query(query string, args ...interface{}) (*sql.Rows, error)
|
||||
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
|
||||
PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
|
||||
QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
|
||||
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
|
||||
}
|
||||
|
||||
func exec(e SqlExecutor, query string, args ...interface{}) (sql.Result, error) {
|
||||
executor, ctx := extractExecutorAndContext(e)
|
||||
|
||||
if ctx != nil {
|
||||
return executor.ExecContext(ctx, query, args...)
|
||||
}
|
||||
|
||||
return executor.Exec(query, args...)
|
||||
}
|
||||
|
||||
func prepare(e SqlExecutor, query string) (*sql.Stmt, error) {
|
||||
executor, ctx := extractExecutorAndContext(e)
|
||||
|
||||
if ctx != nil {
|
||||
return executor.PrepareContext(ctx, query)
|
||||
}
|
||||
|
||||
return executor.Prepare(query)
|
||||
}
|
||||
|
||||
func queryRow(e SqlExecutor, query string, args ...interface{}) *sql.Row {
|
||||
executor, ctx := extractExecutorAndContext(e)
|
||||
|
||||
if ctx != nil {
|
||||
return executor.QueryRowContext(ctx, query, args...)
|
||||
}
|
||||
|
||||
return executor.QueryRow(query, args...)
|
||||
}
|
||||
|
||||
func query(e SqlExecutor, query string, args ...interface{}) (*sql.Rows, error) {
|
||||
executor, ctx := extractExecutorAndContext(e)
|
||||
|
||||
if ctx != nil {
|
||||
return executor.QueryContext(ctx, query, args...)
|
||||
}
|
||||
|
||||
return executor.Query(query, args...)
|
||||
}
|
||||
|
||||
func begin(m *DbMap) (*sql.Tx, error) {
|
||||
if m.ctx != nil {
|
||||
return m.Db.BeginTx(m.ctx, nil)
|
||||
}
|
||||
|
||||
return m.Db.Begin()
|
||||
}
|
|
@ -20,6 +20,8 @@ github.com/cloudflare/cfssl/signer
|
|||
github.com/cloudflare/cfssl/signer/local
|
||||
# github.com/eggsampler/acme/v3 v3.0.0
|
||||
github.com/eggsampler/acme/v3
|
||||
# github.com/go-gorp/gorp/v3 v3.0.2
|
||||
github.com/go-gorp/gorp/v3
|
||||
# github.com/go-sql-driver/mysql v1.5.0
|
||||
github.com/go-sql-driver/mysql
|
||||
# github.com/golang/mock v1.3.1
|
||||
|
@ -217,8 +219,6 @@ google.golang.org/protobuf/types/known/durationpb
|
|||
google.golang.org/protobuf/types/known/timestamppb
|
||||
# gopkg.in/fsnotify.v1 v1.4.7
|
||||
gopkg.in/fsnotify.v1
|
||||
# gopkg.in/go-gorp/gorp.v2 v2.0.1-0.20180410155428-6032c66e0f5f
|
||||
gopkg.in/go-gorp/gorp.v2
|
||||
# gopkg.in/square/go-jose.v2 v2.4.1
|
||||
gopkg.in/square/go-jose.v2
|
||||
gopkg.in/square/go-jose.v2/cipher
|
||||
|
|
Loading…
Reference in New Issue