mirror of
https://github.com/gone-io/gone.git
synced 2025-01-23 01:00:23 +08:00
feat: Use mobile go.uber.org/mock
instead of github.com/golang/mock
This commit is contained in:
parent
a3b810cccd
commit
f2354c0ee4
@ -2,8 +2,8 @@ package gone
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
@ -2,9 +2,9 @@ package test
|
||||
|
||||
import (
|
||||
"example/test/mock"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
goneMock "github.com/gone-io/gone"
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockIPoint is a mock of IPoint interface.
|
||||
|
11
go.mod
11
go.mod
@ -6,10 +6,8 @@ toolchain go1.22.2
|
||||
|
||||
require (
|
||||
github.com/bytedance/sonic v1.10.2
|
||||
github.com/fsnotify/fsnotify v1.7.0
|
||||
github.com/gin-gonic/gin v1.9.1
|
||||
github.com/goccy/go-json v0.10.2
|
||||
github.com/golang/mock v1.6.0
|
||||
github.com/gomodule/redigo v1.8.9
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/imroc/req/v3 v3.48.0
|
||||
@ -24,10 +22,9 @@ require (
|
||||
github.com/soheilhy/cmux v0.1.5
|
||||
github.com/spf13/viper v1.19.0
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/urfave/cli/v2 v2.27.2
|
||||
go.uber.org/mock v0.4.0
|
||||
go.uber.org/zap v1.27.0
|
||||
golang.org/x/time v0.5.0
|
||||
golang.org/x/tools v0.25.0
|
||||
google.golang.org/grpc v1.63.2
|
||||
gopkg.in/errgo.v2 v2.1.0
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
||||
@ -40,8 +37,8 @@ require (
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
|
||||
github.com/chenzhuoyu/iasm v0.9.1 // indirect
|
||||
github.com/cloudflare/circl v1.4.0 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
@ -66,7 +63,6 @@ require (
|
||||
github.com/quic-go/qpack v0.5.1 // indirect
|
||||
github.com/quic-go/quic-go v0.47.0 // indirect
|
||||
github.com/refraction-networking/utls v1.6.7 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/sagikazarmark/locafero v0.4.0 // indirect
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
@ -77,8 +73,6 @@ require (
|
||||
github.com/syndtr/goleveldb v1.0.0 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
|
||||
go.uber.org/mock v0.4.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
golang.org/x/arch v0.7.0 // indirect
|
||||
golang.org/x/crypto v0.27.0 // indirect
|
||||
@ -88,6 +82,7 @@ require (
|
||||
golang.org/x/sync v0.8.0 // indirect
|
||||
golang.org/x/sys v0.25.0 // indirect
|
||||
golang.org/x/text v0.18.0 // indirect
|
||||
golang.org/x/tools v0.25.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c // indirect
|
||||
google.golang.org/protobuf v1.34.1 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
|
17
go.sum
17
go.sum
@ -57,8 +57,6 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7
|
||||
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@ -126,8 +124,6 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU
|
||||
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
|
||||
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
@ -404,8 +400,6 @@ github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
|
||||
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
|
||||
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
|
||||
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
|
||||
@ -472,13 +466,8 @@ github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65E
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/urfave/cli/v2 v2.27.2 h1:6e0H+AkS+zDckwPCUrZkKX38mRaau4nL2uipkJpbkcI=
|
||||
github.com/urfave/cli/v2 v2.27.2/go.mod h1:g0+79LmHHATl7DAcHO99smiR/T7uGLw84w8Y42x+4eM=
|
||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
|
||||
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
|
||||
github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
|
||||
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
@ -536,7 +525,6 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl
|
||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
|
||||
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@ -558,7 +546,6 @@ golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLL
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
|
||||
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
@ -570,7 +557,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@ -597,8 +583,6 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@ -637,7 +621,6 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE=
|
||||
golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg=
|
||||
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
@ -2,10 +2,10 @@ package cmux
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/gone-io/gone"
|
||||
Cmux "github.com/soheilhy/cmux"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"net"
|
||||
"testing"
|
||||
)
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"github.com/gone-io/gone"
|
||||
)
|
||||
|
||||
//go:generate sh -c "mockgen -package=cmux net Listener,Conn > net_Listener_mock_test.go"
|
||||
//go:generate mockgen -package=cmux -destination=./net_Listener_mock_test.go net Listener,Conn
|
||||
|
||||
// Server cumx 服务,用于复用同一端口监听多种协议,参考文档:https://pkg.go.dev/github.com/soheilhy/cmux
|
||||
type Server = gone.CMuxServer
|
||||
|
@ -1,5 +1,10 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: net (interfaces: Listener,Conn)
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -package=cmux -destination=./net_Listener_mock_test.go net Listener,Conn
|
||||
//
|
||||
|
||||
// Package cmux is a generated GoMock package.
|
||||
package cmux
|
||||
@ -9,13 +14,14 @@ import (
|
||||
reflect "reflect"
|
||||
time "time"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockListener is a mock of Listener interface.
|
||||
type MockListener struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockListenerMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockListenerMockRecorder is the mock recorder for MockListener.
|
||||
@ -82,6 +88,7 @@ func (mr *MockListenerMockRecorder) Close() *gomock.Call {
|
||||
type MockConn struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockConnMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockConnMockRecorder is the mock recorder for MockConn.
|
||||
@ -130,18 +137,18 @@ func (mr *MockConnMockRecorder) LocalAddr() *gomock.Call {
|
||||
}
|
||||
|
||||
// Read mocks base method.
|
||||
func (m *MockConn) Read(arg0 []byte) (int, error) {
|
||||
func (m *MockConn) Read(b []byte) (int, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Read", arg0)
|
||||
ret := m.ctrl.Call(m, "Read", b)
|
||||
ret0, _ := ret[0].(int)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Read indicates an expected call of Read.
|
||||
func (mr *MockConnMockRecorder) Read(arg0 interface{}) *gomock.Call {
|
||||
func (mr *MockConnMockRecorder) Read(b any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockConn)(nil).Read), arg0)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockConn)(nil).Read), b)
|
||||
}
|
||||
|
||||
// RemoteAddr mocks base method.
|
||||
@ -159,58 +166,58 @@ func (mr *MockConnMockRecorder) RemoteAddr() *gomock.Call {
|
||||
}
|
||||
|
||||
// SetDeadline mocks base method.
|
||||
func (m *MockConn) SetDeadline(arg0 time.Time) error {
|
||||
func (m *MockConn) SetDeadline(t time.Time) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SetDeadline", arg0)
|
||||
ret := m.ctrl.Call(m, "SetDeadline", t)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SetDeadline indicates an expected call of SetDeadline.
|
||||
func (mr *MockConnMockRecorder) SetDeadline(arg0 interface{}) *gomock.Call {
|
||||
func (mr *MockConnMockRecorder) SetDeadline(t any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDeadline", reflect.TypeOf((*MockConn)(nil).SetDeadline), arg0)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDeadline", reflect.TypeOf((*MockConn)(nil).SetDeadline), t)
|
||||
}
|
||||
|
||||
// SetReadDeadline mocks base method.
|
||||
func (m *MockConn) SetReadDeadline(arg0 time.Time) error {
|
||||
func (m *MockConn) SetReadDeadline(t time.Time) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SetReadDeadline", arg0)
|
||||
ret := m.ctrl.Call(m, "SetReadDeadline", t)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SetReadDeadline indicates an expected call of SetReadDeadline.
|
||||
func (mr *MockConnMockRecorder) SetReadDeadline(arg0 interface{}) *gomock.Call {
|
||||
func (mr *MockConnMockRecorder) SetReadDeadline(t any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetReadDeadline", reflect.TypeOf((*MockConn)(nil).SetReadDeadline), arg0)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetReadDeadline", reflect.TypeOf((*MockConn)(nil).SetReadDeadline), t)
|
||||
}
|
||||
|
||||
// SetWriteDeadline mocks base method.
|
||||
func (m *MockConn) SetWriteDeadline(arg0 time.Time) error {
|
||||
func (m *MockConn) SetWriteDeadline(t time.Time) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SetWriteDeadline", arg0)
|
||||
ret := m.ctrl.Call(m, "SetWriteDeadline", t)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SetWriteDeadline indicates an expected call of SetWriteDeadline.
|
||||
func (mr *MockConnMockRecorder) SetWriteDeadline(arg0 interface{}) *gomock.Call {
|
||||
func (mr *MockConnMockRecorder) SetWriteDeadline(t any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWriteDeadline", reflect.TypeOf((*MockConn)(nil).SetWriteDeadline), arg0)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWriteDeadline", reflect.TypeOf((*MockConn)(nil).SetWriteDeadline), t)
|
||||
}
|
||||
|
||||
// Write mocks base method.
|
||||
func (m *MockConn) Write(arg0 []byte) (int, error) {
|
||||
func (m *MockConn) Write(b []byte) (int, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Write", arg0)
|
||||
ret := m.ctrl.Call(m, "Write", b)
|
||||
ret0, _ := ret[0].(int)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Write indicates an expected call of Write.
|
||||
func (mr *MockConnMockRecorder) Write(arg0 interface{}) *gomock.Call {
|
||||
func (mr *MockConnMockRecorder) Write(b any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockConn)(nil).Write), arg0)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockConn)(nil).Write), b)
|
||||
}
|
||||
|
@ -1,5 +1,10 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/gin-gonic/gin (interfaces: ResponseWriter)
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -package=gin github.com/gin-gonic/gin ResponseWriter
|
||||
//
|
||||
|
||||
// Package gin is a generated GoMock package.
|
||||
package gin
|
||||
@ -10,13 +15,14 @@ import (
|
||||
http "net/http"
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockResponseWriter is a mock of ResponseWriter interface.
|
||||
type MockResponseWriter struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockResponseWriterMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockResponseWriterMockRecorder is the mock recorder for MockResponseWriter.
|
||||
@ -144,21 +150,21 @@ func (m *MockResponseWriter) Write(arg0 []byte) (int, error) {
|
||||
}
|
||||
|
||||
// Write indicates an expected call of Write.
|
||||
func (mr *MockResponseWriterMockRecorder) Write(arg0 interface{}) *gomock.Call {
|
||||
func (mr *MockResponseWriterMockRecorder) Write(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockResponseWriter)(nil).Write), arg0)
|
||||
}
|
||||
|
||||
// WriteHeader mocks base method.
|
||||
func (m *MockResponseWriter) WriteHeader(arg0 int) {
|
||||
func (m *MockResponseWriter) WriteHeader(statusCode int) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "WriteHeader", arg0)
|
||||
m.ctrl.Call(m, "WriteHeader", statusCode)
|
||||
}
|
||||
|
||||
// WriteHeader indicates an expected call of WriteHeader.
|
||||
func (mr *MockResponseWriterMockRecorder) WriteHeader(arg0 interface{}) *gomock.Call {
|
||||
func (mr *MockResponseWriterMockRecorder) WriteHeader(statusCode any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteHeader", reflect.TypeOf((*MockResponseWriter)(nil).WriteHeader), arg0)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteHeader", reflect.TypeOf((*MockResponseWriter)(nil).WriteHeader), statusCode)
|
||||
}
|
||||
|
||||
// WriteHeaderNow mocks base method.
|
||||
@ -183,7 +189,7 @@ func (m *MockResponseWriter) WriteString(arg0 string) (int, error) {
|
||||
}
|
||||
|
||||
// WriteString indicates an expected call of WriteString.
|
||||
func (mr *MockResponseWriterMockRecorder) WriteString(arg0 interface{}) *gomock.Call {
|
||||
func (mr *MockResponseWriterMockRecorder) WriteString(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteString", reflect.TypeOf((*MockResponseWriter)(nil).WriteString), arg0)
|
||||
}
|
||||
|
@ -1,5 +1,10 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: ../../gin_interface.go
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -package=gin -source=../../gin_interface.go
|
||||
//
|
||||
|
||||
// Package gin is a generated GoMock package.
|
||||
package gin
|
||||
@ -9,8 +14,8 @@ import (
|
||||
reflect "reflect"
|
||||
|
||||
gin "github.com/gin-gonic/gin"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
gone "github.com/gone-io/gone"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockIRoutes is a mock of IRoutes interface.
|
||||
@ -18,6 +23,7 @@ type MockIRoutes struct {
|
||||
goneMock.Flag
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockIRoutesMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockIRoutesMockRecorder is the mock recorder for MockIRoutes.
|
||||
@ -40,7 +46,7 @@ func (m *MockIRoutes) EXPECT() *MockIRoutesMockRecorder {
|
||||
// Any mocks base method.
|
||||
func (m *MockIRoutes) Any(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -50,16 +56,16 @@ func (m *MockIRoutes) Any(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
}
|
||||
|
||||
// Any indicates an expected call of Any.
|
||||
func (mr *MockIRoutesMockRecorder) Any(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRoutesMockRecorder) Any(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Any", reflect.TypeOf((*MockIRoutes)(nil).Any), varargs...)
|
||||
}
|
||||
|
||||
// DELETE mocks base method.
|
||||
func (m *MockIRoutes) DELETE(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -69,16 +75,16 @@ func (m *MockIRoutes) DELETE(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes
|
||||
}
|
||||
|
||||
// DELETE indicates an expected call of DELETE.
|
||||
func (mr *MockIRoutesMockRecorder) DELETE(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRoutesMockRecorder) DELETE(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DELETE", reflect.TypeOf((*MockIRoutes)(nil).DELETE), varargs...)
|
||||
}
|
||||
|
||||
// GET mocks base method.
|
||||
func (m *MockIRoutes) GET(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -88,16 +94,16 @@ func (m *MockIRoutes) GET(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
}
|
||||
|
||||
// GET indicates an expected call of GET.
|
||||
func (mr *MockIRoutesMockRecorder) GET(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRoutesMockRecorder) GET(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GET", reflect.TypeOf((*MockIRoutes)(nil).GET), varargs...)
|
||||
}
|
||||
|
||||
// HEAD mocks base method.
|
||||
func (m *MockIRoutes) HEAD(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -107,16 +113,16 @@ func (m *MockIRoutes) HEAD(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
}
|
||||
|
||||
// HEAD indicates an expected call of HEAD.
|
||||
func (mr *MockIRoutesMockRecorder) HEAD(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRoutesMockRecorder) HEAD(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HEAD", reflect.TypeOf((*MockIRoutes)(nil).HEAD), varargs...)
|
||||
}
|
||||
|
||||
// Handle mocks base method.
|
||||
func (m *MockIRoutes) Handle(arg0, arg1 string, arg2 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0, arg1}
|
||||
varargs := []any{arg0, arg1}
|
||||
for _, a := range arg2 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -126,16 +132,16 @@ func (m *MockIRoutes) Handle(arg0, arg1 string, arg2 ...gone.HandlerFunc) gone.I
|
||||
}
|
||||
|
||||
// Handle indicates an expected call of Handle.
|
||||
func (mr *MockIRoutesMockRecorder) Handle(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRoutesMockRecorder) Handle(arg0, arg1 any, arg2 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0, arg1}, arg2...)
|
||||
varargs := append([]any{arg0, arg1}, arg2...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Handle", reflect.TypeOf((*MockIRoutes)(nil).Handle), varargs...)
|
||||
}
|
||||
|
||||
// OPTIONS mocks base method.
|
||||
func (m *MockIRoutes) OPTIONS(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -145,16 +151,16 @@ func (m *MockIRoutes) OPTIONS(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoute
|
||||
}
|
||||
|
||||
// OPTIONS indicates an expected call of OPTIONS.
|
||||
func (mr *MockIRoutesMockRecorder) OPTIONS(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRoutesMockRecorder) OPTIONS(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OPTIONS", reflect.TypeOf((*MockIRoutes)(nil).OPTIONS), varargs...)
|
||||
}
|
||||
|
||||
// PATCH mocks base method.
|
||||
func (m *MockIRoutes) PATCH(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -164,16 +170,16 @@ func (m *MockIRoutes) PATCH(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes
|
||||
}
|
||||
|
||||
// PATCH indicates an expected call of PATCH.
|
||||
func (mr *MockIRoutesMockRecorder) PATCH(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRoutesMockRecorder) PATCH(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PATCH", reflect.TypeOf((*MockIRoutes)(nil).PATCH), varargs...)
|
||||
}
|
||||
|
||||
// POST mocks base method.
|
||||
func (m *MockIRoutes) POST(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -183,16 +189,16 @@ func (m *MockIRoutes) POST(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
}
|
||||
|
||||
// POST indicates an expected call of POST.
|
||||
func (mr *MockIRoutesMockRecorder) POST(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRoutesMockRecorder) POST(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "POST", reflect.TypeOf((*MockIRoutes)(nil).POST), varargs...)
|
||||
}
|
||||
|
||||
// PUT mocks base method.
|
||||
func (m *MockIRoutes) PUT(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -202,16 +208,16 @@ func (m *MockIRoutes) PUT(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
}
|
||||
|
||||
// PUT indicates an expected call of PUT.
|
||||
func (mr *MockIRoutesMockRecorder) PUT(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRoutesMockRecorder) PUT(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PUT", reflect.TypeOf((*MockIRoutes)(nil).PUT), varargs...)
|
||||
}
|
||||
|
||||
// Use mocks base method.
|
||||
func (m *MockIRoutes) Use(arg0 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range arg0 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -221,7 +227,7 @@ func (m *MockIRoutes) Use(arg0 ...gone.HandlerFunc) gone.IRoutes {
|
||||
}
|
||||
|
||||
// Use indicates an expected call of Use.
|
||||
func (mr *MockIRoutesMockRecorder) Use(arg0 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRoutesMockRecorder) Use(arg0 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Use", reflect.TypeOf((*MockIRoutes)(nil).Use), arg0...)
|
||||
}
|
||||
@ -231,6 +237,7 @@ type MockIRouter struct {
|
||||
goneMock.Flag
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockIRouterMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockIRouterMockRecorder is the mock recorder for MockIRouter.
|
||||
@ -253,7 +260,7 @@ func (m *MockIRouter) EXPECT() *MockIRouterMockRecorder {
|
||||
// Any mocks base method.
|
||||
func (m *MockIRouter) Any(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -263,16 +270,16 @@ func (m *MockIRouter) Any(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
}
|
||||
|
||||
// Any indicates an expected call of Any.
|
||||
func (mr *MockIRouterMockRecorder) Any(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRouterMockRecorder) Any(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Any", reflect.TypeOf((*MockIRouter)(nil).Any), varargs...)
|
||||
}
|
||||
|
||||
// DELETE mocks base method.
|
||||
func (m *MockIRouter) DELETE(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -282,16 +289,16 @@ func (m *MockIRouter) DELETE(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes
|
||||
}
|
||||
|
||||
// DELETE indicates an expected call of DELETE.
|
||||
func (mr *MockIRouterMockRecorder) DELETE(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRouterMockRecorder) DELETE(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DELETE", reflect.TypeOf((*MockIRouter)(nil).DELETE), varargs...)
|
||||
}
|
||||
|
||||
// GET mocks base method.
|
||||
func (m *MockIRouter) GET(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -301,9 +308,9 @@ func (m *MockIRouter) GET(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
}
|
||||
|
||||
// GET indicates an expected call of GET.
|
||||
func (mr *MockIRouterMockRecorder) GET(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRouterMockRecorder) GET(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GET", reflect.TypeOf((*MockIRouter)(nil).GET), varargs...)
|
||||
}
|
||||
|
||||
@ -324,7 +331,7 @@ func (mr *MockIRouterMockRecorder) GetGinRouter() *gomock.Call {
|
||||
// Group mocks base method.
|
||||
func (m *MockIRouter) Group(arg0 string, arg1 ...gone.HandlerFunc) gone.RouteGroup {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -334,16 +341,16 @@ func (m *MockIRouter) Group(arg0 string, arg1 ...gone.HandlerFunc) gone.RouteGro
|
||||
}
|
||||
|
||||
// Group indicates an expected call of Group.
|
||||
func (mr *MockIRouterMockRecorder) Group(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRouterMockRecorder) Group(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Group", reflect.TypeOf((*MockIRouter)(nil).Group), varargs...)
|
||||
}
|
||||
|
||||
// HEAD mocks base method.
|
||||
func (m *MockIRouter) HEAD(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -353,16 +360,16 @@ func (m *MockIRouter) HEAD(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
}
|
||||
|
||||
// HEAD indicates an expected call of HEAD.
|
||||
func (mr *MockIRouterMockRecorder) HEAD(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRouterMockRecorder) HEAD(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HEAD", reflect.TypeOf((*MockIRouter)(nil).HEAD), varargs...)
|
||||
}
|
||||
|
||||
// Handle mocks base method.
|
||||
func (m *MockIRouter) Handle(arg0, arg1 string, arg2 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0, arg1}
|
||||
varargs := []any{arg0, arg1}
|
||||
for _, a := range arg2 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -372,9 +379,9 @@ func (m *MockIRouter) Handle(arg0, arg1 string, arg2 ...gone.HandlerFunc) gone.I
|
||||
}
|
||||
|
||||
// Handle indicates an expected call of Handle.
|
||||
func (mr *MockIRouterMockRecorder) Handle(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRouterMockRecorder) Handle(arg0, arg1 any, arg2 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0, arg1}, arg2...)
|
||||
varargs := append([]any{arg0, arg1}, arg2...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Handle", reflect.TypeOf((*MockIRouter)(nil).Handle), varargs...)
|
||||
}
|
||||
|
||||
@ -385,7 +392,7 @@ func (m *MockIRouter) LoadHTMLGlob(pattern string) {
|
||||
}
|
||||
|
||||
// LoadHTMLGlob indicates an expected call of LoadHTMLGlob.
|
||||
func (mr *MockIRouterMockRecorder) LoadHTMLGlob(pattern interface{}) *gomock.Call {
|
||||
func (mr *MockIRouterMockRecorder) LoadHTMLGlob(pattern any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LoadHTMLGlob", reflect.TypeOf((*MockIRouter)(nil).LoadHTMLGlob), pattern)
|
||||
}
|
||||
@ -393,7 +400,7 @@ func (mr *MockIRouterMockRecorder) LoadHTMLGlob(pattern interface{}) *gomock.Cal
|
||||
// OPTIONS mocks base method.
|
||||
func (m *MockIRouter) OPTIONS(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -403,16 +410,16 @@ func (m *MockIRouter) OPTIONS(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoute
|
||||
}
|
||||
|
||||
// OPTIONS indicates an expected call of OPTIONS.
|
||||
func (mr *MockIRouterMockRecorder) OPTIONS(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRouterMockRecorder) OPTIONS(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OPTIONS", reflect.TypeOf((*MockIRouter)(nil).OPTIONS), varargs...)
|
||||
}
|
||||
|
||||
// PATCH mocks base method.
|
||||
func (m *MockIRouter) PATCH(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -422,16 +429,16 @@ func (m *MockIRouter) PATCH(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes
|
||||
}
|
||||
|
||||
// PATCH indicates an expected call of PATCH.
|
||||
func (mr *MockIRouterMockRecorder) PATCH(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRouterMockRecorder) PATCH(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PATCH", reflect.TypeOf((*MockIRouter)(nil).PATCH), varargs...)
|
||||
}
|
||||
|
||||
// POST mocks base method.
|
||||
func (m *MockIRouter) POST(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -441,16 +448,16 @@ func (m *MockIRouter) POST(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
}
|
||||
|
||||
// POST indicates an expected call of POST.
|
||||
func (mr *MockIRouterMockRecorder) POST(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRouterMockRecorder) POST(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "POST", reflect.TypeOf((*MockIRouter)(nil).POST), varargs...)
|
||||
}
|
||||
|
||||
// PUT mocks base method.
|
||||
func (m *MockIRouter) PUT(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -460,16 +467,16 @@ func (m *MockIRouter) PUT(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
}
|
||||
|
||||
// PUT indicates an expected call of PUT.
|
||||
func (mr *MockIRouterMockRecorder) PUT(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRouterMockRecorder) PUT(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PUT", reflect.TypeOf((*MockIRouter)(nil).PUT), varargs...)
|
||||
}
|
||||
|
||||
// Use mocks base method.
|
||||
func (m *MockIRouter) Use(arg0 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range arg0 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -479,7 +486,7 @@ func (m *MockIRouter) Use(arg0 ...gone.HandlerFunc) gone.IRoutes {
|
||||
}
|
||||
|
||||
// Use indicates an expected call of Use.
|
||||
func (mr *MockIRouterMockRecorder) Use(arg0 ...interface{}) *gomock.Call {
|
||||
func (mr *MockIRouterMockRecorder) Use(arg0 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Use", reflect.TypeOf((*MockIRouter)(nil).Use), arg0...)
|
||||
}
|
||||
@ -489,6 +496,7 @@ type MockRouteGroup struct {
|
||||
goneMock.Flag
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockRouteGroupMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockRouteGroupMockRecorder is the mock recorder for MockRouteGroup.
|
||||
@ -511,7 +519,7 @@ func (m *MockRouteGroup) EXPECT() *MockRouteGroupMockRecorder {
|
||||
// Any mocks base method.
|
||||
func (m *MockRouteGroup) Any(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -521,16 +529,16 @@ func (m *MockRouteGroup) Any(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes
|
||||
}
|
||||
|
||||
// Any indicates an expected call of Any.
|
||||
func (mr *MockRouteGroupMockRecorder) Any(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockRouteGroupMockRecorder) Any(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Any", reflect.TypeOf((*MockRouteGroup)(nil).Any), varargs...)
|
||||
}
|
||||
|
||||
// DELETE mocks base method.
|
||||
func (m *MockRouteGroup) DELETE(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -540,16 +548,16 @@ func (m *MockRouteGroup) DELETE(arg0 string, arg1 ...gone.HandlerFunc) gone.IRou
|
||||
}
|
||||
|
||||
// DELETE indicates an expected call of DELETE.
|
||||
func (mr *MockRouteGroupMockRecorder) DELETE(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockRouteGroupMockRecorder) DELETE(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DELETE", reflect.TypeOf((*MockRouteGroup)(nil).DELETE), varargs...)
|
||||
}
|
||||
|
||||
// GET mocks base method.
|
||||
func (m *MockRouteGroup) GET(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -559,9 +567,9 @@ func (m *MockRouteGroup) GET(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes
|
||||
}
|
||||
|
||||
// GET indicates an expected call of GET.
|
||||
func (mr *MockRouteGroupMockRecorder) GET(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockRouteGroupMockRecorder) GET(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GET", reflect.TypeOf((*MockRouteGroup)(nil).GET), varargs...)
|
||||
}
|
||||
|
||||
@ -582,7 +590,7 @@ func (mr *MockRouteGroupMockRecorder) GetGinRouter() *gomock.Call {
|
||||
// Group mocks base method.
|
||||
func (m *MockRouteGroup) Group(arg0 string, arg1 ...gone.HandlerFunc) gone.RouteGroup {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -592,16 +600,16 @@ func (m *MockRouteGroup) Group(arg0 string, arg1 ...gone.HandlerFunc) gone.Route
|
||||
}
|
||||
|
||||
// Group indicates an expected call of Group.
|
||||
func (mr *MockRouteGroupMockRecorder) Group(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockRouteGroupMockRecorder) Group(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Group", reflect.TypeOf((*MockRouteGroup)(nil).Group), varargs...)
|
||||
}
|
||||
|
||||
// HEAD mocks base method.
|
||||
func (m *MockRouteGroup) HEAD(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -611,16 +619,16 @@ func (m *MockRouteGroup) HEAD(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoute
|
||||
}
|
||||
|
||||
// HEAD indicates an expected call of HEAD.
|
||||
func (mr *MockRouteGroupMockRecorder) HEAD(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockRouteGroupMockRecorder) HEAD(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HEAD", reflect.TypeOf((*MockRouteGroup)(nil).HEAD), varargs...)
|
||||
}
|
||||
|
||||
// Handle mocks base method.
|
||||
func (m *MockRouteGroup) Handle(arg0, arg1 string, arg2 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0, arg1}
|
||||
varargs := []any{arg0, arg1}
|
||||
for _, a := range arg2 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -630,9 +638,9 @@ func (m *MockRouteGroup) Handle(arg0, arg1 string, arg2 ...gone.HandlerFunc) gon
|
||||
}
|
||||
|
||||
// Handle indicates an expected call of Handle.
|
||||
func (mr *MockRouteGroupMockRecorder) Handle(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
|
||||
func (mr *MockRouteGroupMockRecorder) Handle(arg0, arg1 any, arg2 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0, arg1}, arg2...)
|
||||
varargs := append([]any{arg0, arg1}, arg2...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Handle", reflect.TypeOf((*MockRouteGroup)(nil).Handle), varargs...)
|
||||
}
|
||||
|
||||
@ -643,7 +651,7 @@ func (m *MockRouteGroup) LoadHTMLGlob(pattern string) {
|
||||
}
|
||||
|
||||
// LoadHTMLGlob indicates an expected call of LoadHTMLGlob.
|
||||
func (mr *MockRouteGroupMockRecorder) LoadHTMLGlob(pattern interface{}) *gomock.Call {
|
||||
func (mr *MockRouteGroupMockRecorder) LoadHTMLGlob(pattern any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LoadHTMLGlob", reflect.TypeOf((*MockRouteGroup)(nil).LoadHTMLGlob), pattern)
|
||||
}
|
||||
@ -651,7 +659,7 @@ func (mr *MockRouteGroupMockRecorder) LoadHTMLGlob(pattern interface{}) *gomock.
|
||||
// OPTIONS mocks base method.
|
||||
func (m *MockRouteGroup) OPTIONS(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -661,16 +669,16 @@ func (m *MockRouteGroup) OPTIONS(arg0 string, arg1 ...gone.HandlerFunc) gone.IRo
|
||||
}
|
||||
|
||||
// OPTIONS indicates an expected call of OPTIONS.
|
||||
func (mr *MockRouteGroupMockRecorder) OPTIONS(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockRouteGroupMockRecorder) OPTIONS(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OPTIONS", reflect.TypeOf((*MockRouteGroup)(nil).OPTIONS), varargs...)
|
||||
}
|
||||
|
||||
// PATCH mocks base method.
|
||||
func (m *MockRouteGroup) PATCH(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -680,16 +688,16 @@ func (m *MockRouteGroup) PATCH(arg0 string, arg1 ...gone.HandlerFunc) gone.IRout
|
||||
}
|
||||
|
||||
// PATCH indicates an expected call of PATCH.
|
||||
func (mr *MockRouteGroupMockRecorder) PATCH(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockRouteGroupMockRecorder) PATCH(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PATCH", reflect.TypeOf((*MockRouteGroup)(nil).PATCH), varargs...)
|
||||
}
|
||||
|
||||
// POST mocks base method.
|
||||
func (m *MockRouteGroup) POST(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -699,16 +707,16 @@ func (m *MockRouteGroup) POST(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoute
|
||||
}
|
||||
|
||||
// POST indicates an expected call of POST.
|
||||
func (mr *MockRouteGroupMockRecorder) POST(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockRouteGroupMockRecorder) POST(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "POST", reflect.TypeOf((*MockRouteGroup)(nil).POST), varargs...)
|
||||
}
|
||||
|
||||
// PUT mocks base method.
|
||||
func (m *MockRouteGroup) PUT(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -718,16 +726,16 @@ func (m *MockRouteGroup) PUT(arg0 string, arg1 ...gone.HandlerFunc) gone.IRoutes
|
||||
}
|
||||
|
||||
// PUT indicates an expected call of PUT.
|
||||
func (mr *MockRouteGroupMockRecorder) PUT(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockRouteGroupMockRecorder) PUT(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PUT", reflect.TypeOf((*MockRouteGroup)(nil).PUT), varargs...)
|
||||
}
|
||||
|
||||
// Use mocks base method.
|
||||
func (m *MockRouteGroup) Use(arg0 ...gone.HandlerFunc) gone.IRoutes {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range arg0 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -737,7 +745,7 @@ func (m *MockRouteGroup) Use(arg0 ...gone.HandlerFunc) gone.IRoutes {
|
||||
}
|
||||
|
||||
// Use indicates an expected call of Use.
|
||||
func (mr *MockRouteGroupMockRecorder) Use(arg0 ...interface{}) *gomock.Call {
|
||||
func (mr *MockRouteGroupMockRecorder) Use(arg0 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Use", reflect.TypeOf((*MockRouteGroup)(nil).Use), arg0...)
|
||||
}
|
||||
@ -747,6 +755,7 @@ type MockGinMiddleware struct {
|
||||
goneMock.Flag
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockGinMiddlewareMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockGinMiddlewareMockRecorder is the mock recorder for MockGinMiddleware.
|
||||
@ -775,7 +784,7 @@ func (m *MockGinMiddleware) Process(ctx *gone.Context) error {
|
||||
}
|
||||
|
||||
// Process indicates an expected call of Process.
|
||||
func (mr *MockGinMiddlewareMockRecorder) Process(ctx interface{}) *gomock.Call {
|
||||
func (mr *MockGinMiddlewareMockRecorder) Process(ctx any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Process", reflect.TypeOf((*MockGinMiddleware)(nil).Process), ctx)
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4,10 +4,10 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/gone-io/gone/internal/json"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"gopkg.in/yaml.v3"
|
||||
"io"
|
||||
"net/http"
|
||||
|
@ -1,5 +1,10 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: interface.go
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -package=gin -self_package=github.com/gone-io/gone/goner/gin -source=interface.go
|
||||
//
|
||||
|
||||
// Package gin is a generated GoMock package.
|
||||
package gin
|
||||
@ -9,7 +14,7 @@ import (
|
||||
reflect "reflect"
|
||||
|
||||
gin "github.com/gin-gonic/gin"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockController is a mock of Controller interface.
|
||||
@ -17,6 +22,7 @@ type MockController struct {
|
||||
goneMock.Flag
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockControllerMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockControllerMockRecorder is the mock recorder for MockController.
|
||||
@ -55,6 +61,7 @@ type MockHandleProxyToGin struct {
|
||||
goneMock.Flag
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockHandleProxyToGinMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockHandleProxyToGinMockRecorder is the mock recorder for MockHandleProxyToGin.
|
||||
@ -77,7 +84,7 @@ func (m *MockHandleProxyToGin) EXPECT() *MockHandleProxyToGinMockRecorder {
|
||||
// Proxy mocks base method.
|
||||
func (m *MockHandleProxyToGin) Proxy(handler ...HandlerFunc) []gin.HandlerFunc {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range handler {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -87,7 +94,7 @@ func (m *MockHandleProxyToGin) Proxy(handler ...HandlerFunc) []gin.HandlerFunc {
|
||||
}
|
||||
|
||||
// Proxy indicates an expected call of Proxy.
|
||||
func (mr *MockHandleProxyToGinMockRecorder) Proxy(handler ...interface{}) *gomock.Call {
|
||||
func (mr *MockHandleProxyToGinMockRecorder) Proxy(handler ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Proxy", reflect.TypeOf((*MockHandleProxyToGin)(nil).Proxy), handler...)
|
||||
}
|
||||
@ -95,7 +102,7 @@ func (mr *MockHandleProxyToGinMockRecorder) Proxy(handler ...interface{}) *gomoc
|
||||
// ProxyForMiddleware mocks base method.
|
||||
func (m *MockHandleProxyToGin) ProxyForMiddleware(handlers ...HandlerFunc) []gin.HandlerFunc {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range handlers {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -105,7 +112,7 @@ func (m *MockHandleProxyToGin) ProxyForMiddleware(handlers ...HandlerFunc) []gin
|
||||
}
|
||||
|
||||
// ProxyForMiddleware indicates an expected call of ProxyForMiddleware.
|
||||
func (mr *MockHandleProxyToGinMockRecorder) ProxyForMiddleware(handlers ...interface{}) *gomock.Call {
|
||||
func (mr *MockHandleProxyToGinMockRecorder) ProxyForMiddleware(handlers ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProxyForMiddleware", reflect.TypeOf((*MockHandleProxyToGin)(nil).ProxyForMiddleware), handlers...)
|
||||
}
|
||||
@ -115,6 +122,7 @@ type MockXContext struct {
|
||||
goneMock.Flag
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockXContextMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockXContextMockRecorder is the mock recorder for MockXContext.
|
||||
@ -153,7 +161,7 @@ func (m *MockXContext) JSON(code int, obj any) {
|
||||
}
|
||||
|
||||
// JSON indicates an expected call of JSON.
|
||||
func (mr *MockXContextMockRecorder) JSON(code, obj interface{}) *gomock.Call {
|
||||
func (mr *MockXContextMockRecorder) JSON(code, obj any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "JSON", reflect.TypeOf((*MockXContext)(nil).JSON), code, obj)
|
||||
}
|
||||
@ -161,7 +169,7 @@ func (mr *MockXContextMockRecorder) JSON(code, obj interface{}) *gomock.Call {
|
||||
// String mocks base method.
|
||||
func (m *MockXContext) String(code int, format string, values ...any) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{code, format}
|
||||
varargs := []any{code, format}
|
||||
for _, a := range values {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -169,9 +177,9 @@ func (m *MockXContext) String(code int, format string, values ...any) {
|
||||
}
|
||||
|
||||
// String indicates an expected call of String.
|
||||
func (mr *MockXContextMockRecorder) String(code, format interface{}, values ...interface{}) *gomock.Call {
|
||||
func (mr *MockXContextMockRecorder) String(code, format any, values ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{code, format}, values...)
|
||||
varargs := append([]any{code, format}, values...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "String", reflect.TypeOf((*MockXContext)(nil).String), varargs...)
|
||||
}
|
||||
|
||||
@ -180,6 +188,7 @@ type MockResponser struct {
|
||||
goneMock.Flag
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockResponserMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockResponserMockRecorder is the mock recorder for MockResponser.
|
||||
@ -206,7 +215,7 @@ func (m *MockResponser) Failed(ctx XContext, err error) {
|
||||
}
|
||||
|
||||
// Failed indicates an expected call of Failed.
|
||||
func (mr *MockResponserMockRecorder) Failed(ctx, err interface{}) *gomock.Call {
|
||||
func (mr *MockResponserMockRecorder) Failed(ctx, err any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Failed", reflect.TypeOf((*MockResponser)(nil).Failed), ctx, err)
|
||||
}
|
||||
@ -214,7 +223,7 @@ func (mr *MockResponserMockRecorder) Failed(ctx, err interface{}) *gomock.Call {
|
||||
// ProcessResults mocks base method.
|
||||
func (m *MockResponser) ProcessResults(context XContext, writer gin.ResponseWriter, last bool, funcName string, results ...any) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{context, writer, last, funcName}
|
||||
varargs := []any{context, writer, last, funcName}
|
||||
for _, a := range results {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -222,9 +231,9 @@ func (m *MockResponser) ProcessResults(context XContext, writer gin.ResponseWrit
|
||||
}
|
||||
|
||||
// ProcessResults indicates an expected call of ProcessResults.
|
||||
func (mr *MockResponserMockRecorder) ProcessResults(context, writer, last, funcName interface{}, results ...interface{}) *gomock.Call {
|
||||
func (mr *MockResponserMockRecorder) ProcessResults(context, writer, last, funcName any, results ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{context, writer, last, funcName}, results...)
|
||||
varargs := append([]any{context, writer, last, funcName}, results...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessResults", reflect.TypeOf((*MockResponser)(nil).ProcessResults), varargs...)
|
||||
}
|
||||
|
||||
@ -235,7 +244,7 @@ func (m *MockResponser) Success(ctx XContext, data any) {
|
||||
}
|
||||
|
||||
// Success indicates an expected call of Success.
|
||||
func (mr *MockResponserMockRecorder) Success(ctx, data interface{}) *gomock.Call {
|
||||
func (mr *MockResponserMockRecorder) Success(ctx, data any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Success", reflect.TypeOf((*MockResponser)(nil).Success), ctx, data)
|
||||
}
|
||||
@ -245,6 +254,7 @@ type MockHttInjector struct {
|
||||
goneMock.Flag
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockHttInjectorMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockHttInjectorMockRecorder is the mock recorder for MockHttInjector.
|
||||
@ -295,6 +305,7 @@ type MockMiddleware struct {
|
||||
goneMock.Flag
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockMiddlewareMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockMiddlewareMockRecorder is the mock recorder for MockMiddleware.
|
||||
@ -321,7 +332,7 @@ func (m *MockMiddleware) Process(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
// Process indicates an expected call of Process.
|
||||
func (mr *MockMiddlewareMockRecorder) Process(ctx interface{}) *gomock.Call {
|
||||
func (mr *MockMiddlewareMockRecorder) Process(ctx any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Process", reflect.TypeOf((*MockMiddleware)(nil).Process), ctx)
|
||||
}
|
||||
|
@ -1,5 +1,10 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: net (interfaces: Listener)
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -package=gin net Listener
|
||||
//
|
||||
|
||||
// Package gin is a generated GoMock package.
|
||||
package gin
|
||||
@ -8,13 +13,14 @@ import (
|
||||
net "net"
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockListener is a mock of Listener interface.
|
||||
type MockListener struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockListenerMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockListenerMockRecorder is the mock recorder for MockListener.
|
||||
|
@ -1,7 +1,6 @@
|
||||
package gin_test
|
||||
|
||||
import (
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/gone-io/gone/goner/config"
|
||||
"github.com/gone-io/gone/goner/gin"
|
||||
@ -9,6 +8,7 @@ import (
|
||||
"github.com/gone-io/gone/goner/tracer"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
@ -2,9 +2,9 @@ package gin
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/gone-io/gone/internal/json"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
@ -2,8 +2,8 @@ package gin
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
@ -2,9 +2,9 @@ package gin
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
@ -2,9 +2,9 @@ package gin
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"net/http"
|
||||
"testing"
|
||||
)
|
||||
|
@ -4,12 +4,12 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/gone-io/gone/goner/logrus"
|
||||
"github.com/gone-io/gone/internal/json"
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"golang.org/x/time/rate"
|
||||
"io"
|
||||
"net/http"
|
||||
|
@ -2,12 +2,12 @@ package gone_grpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/gone-io/gone/goner/config"
|
||||
"github.com/gone-io/gone/goner/logrus"
|
||||
"github.com/gone-io/gone/goner/tracer"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"google.golang.org/grpc/metadata"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,10 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: interface.go
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -package=gone_grpc -self_package=github.com/gone-io/gone/goner/grpc -source=interface.go -destination=mock_test.go
|
||||
//
|
||||
|
||||
// Package gone_grpc is a generated GoMock package.
|
||||
package gone_grpc
|
||||
@ -7,7 +12,7 @@ package gone_grpc
|
||||
import (
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
@ -15,6 +20,7 @@ import (
|
||||
type MockClient struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockClientMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockClientMockRecorder is the mock recorder for MockClient.
|
||||
@ -55,7 +61,7 @@ func (m *MockClient) Stub(conn *grpc.ClientConn) {
|
||||
}
|
||||
|
||||
// Stub indicates an expected call of Stub.
|
||||
func (mr *MockClientMockRecorder) Stub(conn interface{}) *gomock.Call {
|
||||
func (mr *MockClientMockRecorder) Stub(conn any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stub", reflect.TypeOf((*MockClient)(nil).Stub), conn)
|
||||
}
|
||||
@ -64,6 +70,7 @@ func (mr *MockClientMockRecorder) Stub(conn interface{}) *gomock.Call {
|
||||
type MockService struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockServiceMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockServiceMockRecorder is the mock recorder for MockService.
|
||||
@ -90,7 +97,7 @@ func (m *MockService) RegisterGrpcServer(server *grpc.Server) {
|
||||
}
|
||||
|
||||
// RegisterGrpcServer indicates an expected call of RegisterGrpcServer.
|
||||
func (mr *MockServiceMockRecorder) RegisterGrpcServer(server interface{}) *gomock.Call {
|
||||
func (mr *MockServiceMockRecorder) RegisterGrpcServer(server any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterGrpcServer", reflect.TypeOf((*MockService)(nil).RegisterGrpcServer), server)
|
||||
}
|
||||
|
@ -1,5 +1,10 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: net (interfaces: Listener)
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -package=gone_grpc net Listener
|
||||
//
|
||||
|
||||
// Package gone_grpc is a generated GoMock package.
|
||||
package gone_grpc
|
||||
@ -8,13 +13,14 @@ import (
|
||||
net "net"
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockListener is a mock of Listener interface.
|
||||
type MockListener struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockListenerMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockListenerMockRecorder is the mock recorder for MockListener.
|
||||
|
@ -3,12 +3,12 @@ package gone_grpc
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/gone-io/gone/goner/config"
|
||||
"github.com/gone-io/gone/goner/logrus"
|
||||
"github.com/gone-io/gone/goner/tracer"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"testing"
|
||||
|
@ -2,12 +2,12 @@ package redis
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/gone-io/gone/goner/config"
|
||||
"github.com/gone-io/gone/goner/logrus"
|
||||
"github.com/gone-io/gone/goner/tracer"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
@ -1,5 +1,10 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: interface.go
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -package=redis -self_package=github.com/gone-io/gone/goner/redis -source=interface.go -destination=mock_test.go
|
||||
//
|
||||
|
||||
// Package redis is a generated GoMock package.
|
||||
package redis
|
||||
@ -8,14 +13,15 @@ import (
|
||||
reflect "reflect"
|
||||
time "time"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
redis "github.com/gomodule/redigo/redis"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockCache is a mock of Cache interface.
|
||||
type MockCache struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockCacheMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockCacheMockRecorder is the mock recorder for MockCache.
|
||||
@ -44,24 +50,24 @@ func (m *MockCache) Get(key string, value any) error {
|
||||
}
|
||||
|
||||
// Get indicates an expected call of Get.
|
||||
func (mr *MockCacheMockRecorder) Get(key, value interface{}) *gomock.Call {
|
||||
func (mr *MockCacheMockRecorder) Get(key, value any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockCache)(nil).Get), key, value)
|
||||
}
|
||||
|
||||
// Keys mocks base method.
|
||||
func (m *MockCache) Keys(key string) ([]string, error) {
|
||||
func (m *MockCache) Keys(pattern string) ([]string, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Keys", key)
|
||||
ret := m.ctrl.Call(m, "Keys", pattern)
|
||||
ret0, _ := ret[0].([]string)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Keys indicates an expected call of Keys.
|
||||
func (mr *MockCacheMockRecorder) Keys(key interface{}) *gomock.Call {
|
||||
func (mr *MockCacheMockRecorder) Keys(pattern any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Keys", reflect.TypeOf((*MockCache)(nil).Keys), key)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Keys", reflect.TypeOf((*MockCache)(nil).Keys), pattern)
|
||||
}
|
||||
|
||||
// Prefix mocks base method.
|
||||
@ -81,7 +87,7 @@ func (mr *MockCacheMockRecorder) Prefix() *gomock.Call {
|
||||
// Put mocks base method.
|
||||
func (m *MockCache) Put(key string, value any, ttl ...time.Duration) error {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{key, value}
|
||||
varargs := []any{key, value}
|
||||
for _, a := range ttl {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -91,9 +97,9 @@ func (m *MockCache) Put(key string, value any, ttl ...time.Duration) error {
|
||||
}
|
||||
|
||||
// Put indicates an expected call of Put.
|
||||
func (mr *MockCacheMockRecorder) Put(key, value interface{}, ttl ...interface{}) *gomock.Call {
|
||||
func (mr *MockCacheMockRecorder) Put(key, value any, ttl ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{key, value}, ttl...)
|
||||
varargs := append([]any{key, value}, ttl...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockCache)(nil).Put), varargs...)
|
||||
}
|
||||
|
||||
@ -106,7 +112,7 @@ func (m *MockCache) Remove(key string) error {
|
||||
}
|
||||
|
||||
// Remove indicates an expected call of Remove.
|
||||
func (mr *MockCacheMockRecorder) Remove(key interface{}) *gomock.Call {
|
||||
func (mr *MockCacheMockRecorder) Remove(key any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Remove", reflect.TypeOf((*MockCache)(nil).Remove), key)
|
||||
}
|
||||
@ -114,7 +120,7 @@ func (mr *MockCacheMockRecorder) Remove(key interface{}) *gomock.Call {
|
||||
// Set mocks base method.
|
||||
func (m *MockCache) Set(key string, value any, ttl ...time.Duration) error {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{key, value}
|
||||
varargs := []any{key, value}
|
||||
for _, a := range ttl {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -124,9 +130,9 @@ func (m *MockCache) Set(key string, value any, ttl ...time.Duration) error {
|
||||
}
|
||||
|
||||
// Set indicates an expected call of Set.
|
||||
func (mr *MockCacheMockRecorder) Set(key, value interface{}, ttl ...interface{}) *gomock.Call {
|
||||
func (mr *MockCacheMockRecorder) Set(key, value any, ttl ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{key, value}, ttl...)
|
||||
varargs := append([]any{key, value}, ttl...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Set", reflect.TypeOf((*MockCache)(nil).Set), varargs...)
|
||||
}
|
||||
|
||||
@ -134,6 +140,7 @@ func (mr *MockCacheMockRecorder) Set(key, value interface{}, ttl ...interface{})
|
||||
type MockKey struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockKeyMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockKeyMockRecorder is the mock recorder for MockKey.
|
||||
@ -162,7 +169,7 @@ func (m *MockKey) Del(key string) error {
|
||||
}
|
||||
|
||||
// Del indicates an expected call of Del.
|
||||
func (mr *MockKeyMockRecorder) Del(key interface{}) *gomock.Call {
|
||||
func (mr *MockKeyMockRecorder) Del(key any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Del", reflect.TypeOf((*MockKey)(nil).Del), key)
|
||||
}
|
||||
@ -176,7 +183,7 @@ func (m *MockKey) Expire(key string, ttl time.Duration) error {
|
||||
}
|
||||
|
||||
// Expire indicates an expected call of Expire.
|
||||
func (mr *MockKeyMockRecorder) Expire(key, ttl interface{}) *gomock.Call {
|
||||
func (mr *MockKeyMockRecorder) Expire(key, ttl any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Expire", reflect.TypeOf((*MockKey)(nil).Expire), key, ttl)
|
||||
}
|
||||
@ -190,7 +197,7 @@ func (m *MockKey) ExpireAt(key string, time time.Time) error {
|
||||
}
|
||||
|
||||
// ExpireAt indicates an expected call of ExpireAt.
|
||||
func (mr *MockKeyMockRecorder) ExpireAt(key, time interface{}) *gomock.Call {
|
||||
func (mr *MockKeyMockRecorder) ExpireAt(key, time any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExpireAt", reflect.TypeOf((*MockKey)(nil).ExpireAt), key, time)
|
||||
}
|
||||
@ -205,24 +212,24 @@ func (m *MockKey) Incr(field string, increment int64) (int64, error) {
|
||||
}
|
||||
|
||||
// Incr indicates an expected call of Incr.
|
||||
func (mr *MockKeyMockRecorder) Incr(field, increment interface{}) *gomock.Call {
|
||||
func (mr *MockKeyMockRecorder) Incr(field, increment any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Incr", reflect.TypeOf((*MockKey)(nil).Incr), field, increment)
|
||||
}
|
||||
|
||||
// Keys mocks base method.
|
||||
func (m *MockKey) Keys(key string) ([]string, error) {
|
||||
func (m *MockKey) Keys(pattern string) ([]string, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Keys", key)
|
||||
ret := m.ctrl.Call(m, "Keys", pattern)
|
||||
ret0, _ := ret[0].([]string)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Keys indicates an expected call of Keys.
|
||||
func (mr *MockKeyMockRecorder) Keys(key interface{}) *gomock.Call {
|
||||
func (mr *MockKeyMockRecorder) Keys(pattern any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Keys", reflect.TypeOf((*MockKey)(nil).Keys), key)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Keys", reflect.TypeOf((*MockKey)(nil).Keys), pattern)
|
||||
}
|
||||
|
||||
// Prefix mocks base method.
|
||||
@ -249,7 +256,7 @@ func (m *MockKey) Ttl(key string) (time.Duration, error) {
|
||||
}
|
||||
|
||||
// Ttl indicates an expected call of Ttl.
|
||||
func (mr *MockKeyMockRecorder) Ttl(key interface{}) *gomock.Call {
|
||||
func (mr *MockKeyMockRecorder) Ttl(key any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ttl", reflect.TypeOf((*MockKey)(nil).Ttl), key)
|
||||
}
|
||||
@ -258,6 +265,7 @@ func (mr *MockKeyMockRecorder) Ttl(key interface{}) *gomock.Call {
|
||||
type MockHash struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockHashMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockHashMockRecorder is the mock recorder for MockHash.
|
||||
@ -286,13 +294,13 @@ func (m *MockHash) Del(field string) error {
|
||||
}
|
||||
|
||||
// Del indicates an expected call of Del.
|
||||
func (mr *MockHashMockRecorder) Del(field interface{}) *gomock.Call {
|
||||
func (mr *MockHashMockRecorder) Del(field any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Del", reflect.TypeOf((*MockHash)(nil).Del), field)
|
||||
}
|
||||
|
||||
// Get mocks base method.
|
||||
func (m *MockHash) Get(field string, v interface{}) error {
|
||||
func (m *MockHash) Get(field string, v any) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Get", field, v)
|
||||
ret0, _ := ret[0].(error)
|
||||
@ -300,7 +308,7 @@ func (m *MockHash) Get(field string, v interface{}) error {
|
||||
}
|
||||
|
||||
// Get indicates an expected call of Get.
|
||||
func (mr *MockHashMockRecorder) Get(field, v interface{}) *gomock.Call {
|
||||
func (mr *MockHashMockRecorder) Get(field, v any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockHash)(nil).Get), field, v)
|
||||
}
|
||||
@ -315,7 +323,7 @@ func (m *MockHash) Incr(field string, increment int64) (int64, error) {
|
||||
}
|
||||
|
||||
// Incr indicates an expected call of Incr.
|
||||
func (mr *MockHashMockRecorder) Incr(field, increment interface{}) *gomock.Call {
|
||||
func (mr *MockHashMockRecorder) Incr(field, increment any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Incr", reflect.TypeOf((*MockHash)(nil).Incr), field, increment)
|
||||
}
|
||||
@ -329,13 +337,13 @@ func (m *MockHash) Scan(arg0 func(string, []byte)) error {
|
||||
}
|
||||
|
||||
// Scan indicates an expected call of Scan.
|
||||
func (mr *MockHashMockRecorder) Scan(arg0 interface{}) *gomock.Call {
|
||||
func (mr *MockHashMockRecorder) Scan(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Scan", reflect.TypeOf((*MockHash)(nil).Scan), arg0)
|
||||
}
|
||||
|
||||
// Set mocks base method.
|
||||
func (m *MockHash) Set(field string, v interface{}) error {
|
||||
func (m *MockHash) Set(field string, v any) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Set", field, v)
|
||||
ret0, _ := ret[0].(error)
|
||||
@ -343,7 +351,7 @@ func (m *MockHash) Set(field string, v interface{}) error {
|
||||
}
|
||||
|
||||
// Set indicates an expected call of Set.
|
||||
func (mr *MockHashMockRecorder) Set(field, v interface{}) *gomock.Call {
|
||||
func (mr *MockHashMockRecorder) Set(field, v any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Set", reflect.TypeOf((*MockHash)(nil).Set), field, v)
|
||||
}
|
||||
@ -352,6 +360,7 @@ func (mr *MockHashMockRecorder) Set(field, v interface{}) *gomock.Call {
|
||||
type MockLocker struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockLockerMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockLockerMockRecorder is the mock recorder for MockLocker.
|
||||
@ -380,7 +389,7 @@ func (m *MockLocker) LockAndDo(key string, fn func(), lockTime, checkPeriod time
|
||||
}
|
||||
|
||||
// LockAndDo indicates an expected call of LockAndDo.
|
||||
func (mr *MockLockerMockRecorder) LockAndDo(key, fn, lockTime, checkPeriod interface{}) *gomock.Call {
|
||||
func (mr *MockLockerMockRecorder) LockAndDo(key, fn, lockTime, checkPeriod any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LockAndDo", reflect.TypeOf((*MockLocker)(nil).LockAndDo), key, fn, lockTime, checkPeriod)
|
||||
}
|
||||
@ -395,7 +404,7 @@ func (m *MockLocker) TryLock(key string, ttl time.Duration) (Unlock, error) {
|
||||
}
|
||||
|
||||
// TryLock indicates an expected call of TryLock.
|
||||
func (mr *MockLockerMockRecorder) TryLock(key, ttl interface{}) *gomock.Call {
|
||||
func (mr *MockLockerMockRecorder) TryLock(key, ttl any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TryLock", reflect.TypeOf((*MockLocker)(nil).TryLock), key, ttl)
|
||||
}
|
||||
@ -404,6 +413,7 @@ func (mr *MockLockerMockRecorder) TryLock(key, ttl interface{}) *gomock.Call {
|
||||
type MockPool struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockPoolMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockPoolMockRecorder is the mock recorder for MockPool.
|
||||
@ -430,7 +440,7 @@ func (m *MockPool) Close(conn redis.Conn) {
|
||||
}
|
||||
|
||||
// Close indicates an expected call of Close.
|
||||
func (mr *MockPoolMockRecorder) Close(conn interface{}) *gomock.Call {
|
||||
func (mr *MockPoolMockRecorder) Close(conn any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockPool)(nil).Close), conn)
|
||||
}
|
||||
|
@ -1,5 +1,10 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/gomodule/redigo/redis (interfaces: Conn)
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -package=redis github.com/gomodule/redigo/redis Conn
|
||||
//
|
||||
|
||||
// Package redis is a generated GoMock package.
|
||||
package redis
|
||||
@ -7,13 +12,14 @@ package redis
|
||||
import (
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockConn is a mock of Conn interface.
|
||||
type MockConn struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockConnMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockConnMockRecorder is the mock recorder for MockConn.
|
||||
@ -48,22 +54,22 @@ func (mr *MockConnMockRecorder) Close() *gomock.Call {
|
||||
}
|
||||
|
||||
// Do mocks base method.
|
||||
func (m *MockConn) Do(arg0 string, arg1 ...interface{}) (interface{}, error) {
|
||||
func (m *MockConn) Do(commandName string, args ...any) (any, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs := []any{commandName}
|
||||
for _, a := range args {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "Do", varargs...)
|
||||
ret0, _ := ret[0].(interface{})
|
||||
ret0, _ := ret[0].(any)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Do indicates an expected call of Do.
|
||||
func (mr *MockConnMockRecorder) Do(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockConnMockRecorder) Do(commandName any, args ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{commandName}, args...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Do", reflect.TypeOf((*MockConn)(nil).Do), varargs...)
|
||||
}
|
||||
|
||||
@ -96,10 +102,10 @@ func (mr *MockConnMockRecorder) Flush() *gomock.Call {
|
||||
}
|
||||
|
||||
// Receive mocks base method.
|
||||
func (m *MockConn) Receive() (interface{}, error) {
|
||||
func (m *MockConn) Receive() (any, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Receive")
|
||||
ret0, _ := ret[0].(interface{})
|
||||
ret0, _ := ret[0].(any)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
@ -111,10 +117,10 @@ func (mr *MockConnMockRecorder) Receive() *gomock.Call {
|
||||
}
|
||||
|
||||
// Send mocks base method.
|
||||
func (m *MockConn) Send(arg0 string, arg1 ...interface{}) error {
|
||||
func (m *MockConn) Send(commandName string, args ...any) error {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs := []any{commandName}
|
||||
for _, a := range args {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "Send", varargs...)
|
||||
@ -123,8 +129,8 @@ func (m *MockConn) Send(arg0 string, arg1 ...interface{}) error {
|
||||
}
|
||||
|
||||
// Send indicates an expected call of Send.
|
||||
func (mr *MockConnMockRecorder) Send(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockConnMockRecorder) Send(commandName any, args ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{commandName}, args...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockConn)(nil).Send), varargs...)
|
||||
}
|
||||
|
@ -1,5 +1,10 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: interface.go
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -package=schedule -self_package=github.com/gone-io/gone/goner/schedule -source=interface.go
|
||||
//
|
||||
|
||||
// Package schedule is a generated GoMock package.
|
||||
package schedule
|
||||
@ -8,7 +13,7 @@ import (
|
||||
goneMock "github.com/gone-io/gone"
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockScheduler is a mock of Scheduler interface.
|
||||
@ -16,6 +21,7 @@ type MockScheduler struct {
|
||||
goneMock.Flag
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockSchedulerMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockSchedulerMockRecorder is the mock recorder for MockScheduler.
|
||||
@ -42,7 +48,7 @@ func (m *MockScheduler) Cron(run RunFuncOnceAt) {
|
||||
}
|
||||
|
||||
// Cron indicates an expected call of Cron.
|
||||
func (mr *MockSchedulerMockRecorder) Cron(run interface{}) *gomock.Call {
|
||||
func (mr *MockSchedulerMockRecorder) Cron(run any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Cron", reflect.TypeOf((*MockScheduler)(nil).Cron), run)
|
||||
}
|
||||
@ -52,6 +58,7 @@ type MockSchedule struct {
|
||||
goneMock.Flag
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockScheduleMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockScheduleMockRecorder is the mock recorder for MockSchedule.
|
||||
|
@ -1,13 +1,13 @@
|
||||
package schedule
|
||||
|
||||
import (
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/gone-io/gone/goner/config"
|
||||
"github.com/gone-io/gone/goner/logrus"
|
||||
"github.com/gone-io/gone/goner/redis"
|
||||
"github.com/gone-io/gone/goner/tracer"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -1,5 +1,10 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/imroc/req/v3 (interfaces: RoundTripper)
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -package=urllib github.com/imroc/req/v3 RoundTripper
|
||||
//
|
||||
|
||||
// Package urllib is a generated GoMock package.
|
||||
package urllib
|
||||
@ -7,14 +12,15 @@ package urllib
|
||||
import (
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
req "github.com/imroc/req/v3"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockRoundTripper is a mock of RoundTripper interface.
|
||||
type MockRoundTripper struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockRoundTripperMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockRoundTripperMockRecorder is the mock recorder for MockRoundTripper.
|
||||
@ -44,7 +50,7 @@ func (m *MockRoundTripper) RoundTrip(arg0 *req.Request) (*req.Response, error) {
|
||||
}
|
||||
|
||||
// RoundTrip indicates an expected call of RoundTrip.
|
||||
func (mr *MockRoundTripperMockRecorder) RoundTrip(arg0 interface{}) *gomock.Call {
|
||||
func (mr *MockRoundTripperMockRecorder) RoundTrip(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RoundTrip", reflect.TypeOf((*MockRoundTripper)(nil).RoundTrip), arg0)
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
package urllib
|
||||
|
||||
import (
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/gone-io/gone/goner/config"
|
||||
"github.com/gone-io/gone/goner/logrus"
|
||||
"github.com/gone-io/gone/goner/tracer"
|
||||
"github.com/imroc/req/v3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,7 @@ func newEngine(driverName string, dataSourceName string) (xorm.EngineInterface,
|
||||
return xorm.NewEngine(driverName, dataSourceName)
|
||||
}
|
||||
|
||||
//go:generate mockgen -package xorm xorm.io/xorm EngineInterface > ./engine_mock_test.go
|
||||
//go:generate mockgen -package xorm -destination=./engine_mock_test.go xorm.io/xorm EngineInterface
|
||||
type engine struct {
|
||||
gone.Flag
|
||||
xorm.EngineInterface
|
||||
|
@ -2,11 +2,11 @@ package xorm
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/gone-io/gone/goner/config"
|
||||
"github.com/gone-io/gone/goner/logrus"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"testing"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
@ -1,5 +1,10 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: transaction.go
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -package xorm -destination=./session_mock_test.go -source transaction.go XInterface
|
||||
//
|
||||
|
||||
// Package xorm is a generated GoMock package.
|
||||
package xorm
|
||||
@ -8,7 +13,7 @@ import (
|
||||
sql "database/sql"
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
xorm "xorm.io/xorm"
|
||||
)
|
||||
|
||||
@ -16,6 +21,7 @@ import (
|
||||
type MockXInterface struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockXInterfaceMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockXInterfaceMockRecorder is the mock recorder for MockXInterface.
|
||||
@ -44,7 +50,7 @@ func (m *MockXInterface) Alias(alias string) *xorm.Session {
|
||||
}
|
||||
|
||||
// Alias indicates an expected call of Alias.
|
||||
func (mr *MockXInterfaceMockRecorder) Alias(alias interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Alias(alias any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Alias", reflect.TypeOf((*MockXInterface)(nil).Alias), alias)
|
||||
}
|
||||
@ -66,7 +72,7 @@ func (mr *MockXInterfaceMockRecorder) AllCols() *gomock.Call {
|
||||
// Asc mocks base method.
|
||||
func (m *MockXInterface) Asc(colNames ...string) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range colNames {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -76,7 +82,7 @@ func (m *MockXInterface) Asc(colNames ...string) *xorm.Session {
|
||||
}
|
||||
|
||||
// Asc indicates an expected call of Asc.
|
||||
func (mr *MockXInterfaceMockRecorder) Asc(colNames ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Asc(colNames ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Asc", reflect.TypeOf((*MockXInterface)(nil).Asc), colNames...)
|
||||
}
|
||||
@ -104,7 +110,7 @@ func (m *MockXInterface) BufferSize(size int) *xorm.Session {
|
||||
}
|
||||
|
||||
// BufferSize indicates an expected call of BufferSize.
|
||||
func (mr *MockXInterfaceMockRecorder) BufferSize(size interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) BufferSize(size any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BufferSize", reflect.TypeOf((*MockXInterface)(nil).BufferSize), size)
|
||||
}
|
||||
@ -126,7 +132,7 @@ func (mr *MockXInterfaceMockRecorder) Close() *gomock.Call {
|
||||
// Cols mocks base method.
|
||||
func (m *MockXInterface) Cols(columns ...string) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range columns {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -136,7 +142,7 @@ func (m *MockXInterface) Cols(columns ...string) *xorm.Session {
|
||||
}
|
||||
|
||||
// Cols indicates an expected call of Cols.
|
||||
func (mr *MockXInterfaceMockRecorder) Cols(columns ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Cols(columns ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Cols", reflect.TypeOf((*MockXInterface)(nil).Cols), columns...)
|
||||
}
|
||||
@ -156,9 +162,9 @@ func (mr *MockXInterfaceMockRecorder) Commit() *gomock.Call {
|
||||
}
|
||||
|
||||
// Count mocks base method.
|
||||
func (m *MockXInterface) Count(arg0 ...interface{}) (int64, error) {
|
||||
func (m *MockXInterface) Count(arg0 ...any) (int64, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range arg0 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -169,13 +175,13 @@ func (m *MockXInterface) Count(arg0 ...interface{}) (int64, error) {
|
||||
}
|
||||
|
||||
// Count indicates an expected call of Count.
|
||||
func (mr *MockXInterfaceMockRecorder) Count(arg0 ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Count(arg0 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Count", reflect.TypeOf((*MockXInterface)(nil).Count), arg0...)
|
||||
}
|
||||
|
||||
// CreateIndexes mocks base method.
|
||||
func (m *MockXInterface) CreateIndexes(bean interface{}) error {
|
||||
func (m *MockXInterface) CreateIndexes(bean any) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "CreateIndexes", bean)
|
||||
ret0, _ := ret[0].(error)
|
||||
@ -183,13 +189,13 @@ func (m *MockXInterface) CreateIndexes(bean interface{}) error {
|
||||
}
|
||||
|
||||
// CreateIndexes indicates an expected call of CreateIndexes.
|
||||
func (mr *MockXInterfaceMockRecorder) CreateIndexes(bean interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) CreateIndexes(bean any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateIndexes", reflect.TypeOf((*MockXInterface)(nil).CreateIndexes), bean)
|
||||
}
|
||||
|
||||
// CreateUniques mocks base method.
|
||||
func (m *MockXInterface) CreateUniques(bean interface{}) error {
|
||||
func (m *MockXInterface) CreateUniques(bean any) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "CreateUniques", bean)
|
||||
ret0, _ := ret[0].(error)
|
||||
@ -197,15 +203,15 @@ func (m *MockXInterface) CreateUniques(bean interface{}) error {
|
||||
}
|
||||
|
||||
// CreateUniques indicates an expected call of CreateUniques.
|
||||
func (mr *MockXInterfaceMockRecorder) CreateUniques(bean interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) CreateUniques(bean any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateUniques", reflect.TypeOf((*MockXInterface)(nil).CreateUniques), bean)
|
||||
}
|
||||
|
||||
// Decr mocks base method.
|
||||
func (m *MockXInterface) Decr(column string, arg ...interface{}) *xorm.Session {
|
||||
func (m *MockXInterface) Decr(column string, arg ...any) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{column}
|
||||
varargs := []any{column}
|
||||
for _, a := range arg {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -215,16 +221,16 @@ func (m *MockXInterface) Decr(column string, arg ...interface{}) *xorm.Session {
|
||||
}
|
||||
|
||||
// Decr indicates an expected call of Decr.
|
||||
func (mr *MockXInterfaceMockRecorder) Decr(column interface{}, arg ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Decr(column any, arg ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{column}, arg...)
|
||||
varargs := append([]any{column}, arg...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Decr", reflect.TypeOf((*MockXInterface)(nil).Decr), varargs...)
|
||||
}
|
||||
|
||||
// Delete mocks base method.
|
||||
func (m *MockXInterface) Delete(arg0 ...interface{}) (int64, error) {
|
||||
func (m *MockXInterface) Delete(arg0 ...any) (int64, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range arg0 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -235,7 +241,7 @@ func (m *MockXInterface) Delete(arg0 ...interface{}) (int64, error) {
|
||||
}
|
||||
|
||||
// Delete indicates an expected call of Delete.
|
||||
func (mr *MockXInterfaceMockRecorder) Delete(arg0 ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Delete(arg0 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockXInterface)(nil).Delete), arg0...)
|
||||
}
|
||||
@ -243,7 +249,7 @@ func (mr *MockXInterfaceMockRecorder) Delete(arg0 ...interface{}) *gomock.Call {
|
||||
// Desc mocks base method.
|
||||
func (m *MockXInterface) Desc(arg0 ...string) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range arg0 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -253,7 +259,7 @@ func (m *MockXInterface) Desc(arg0 ...string) *xorm.Session {
|
||||
}
|
||||
|
||||
// Desc indicates an expected call of Desc.
|
||||
func (mr *MockXInterfaceMockRecorder) Desc(arg0 ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Desc(arg0 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Desc", reflect.TypeOf((*MockXInterface)(nil).Desc), arg0...)
|
||||
}
|
||||
@ -261,7 +267,7 @@ func (mr *MockXInterfaceMockRecorder) Desc(arg0 ...interface{}) *gomock.Call {
|
||||
// Distinct mocks base method.
|
||||
func (m *MockXInterface) Distinct(columns ...string) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range columns {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -271,13 +277,13 @@ func (m *MockXInterface) Distinct(columns ...string) *xorm.Session {
|
||||
}
|
||||
|
||||
// Distinct indicates an expected call of Distinct.
|
||||
func (mr *MockXInterfaceMockRecorder) Distinct(columns ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Distinct(columns ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Distinct", reflect.TypeOf((*MockXInterface)(nil).Distinct), columns...)
|
||||
}
|
||||
|
||||
// DropIndexes mocks base method.
|
||||
func (m *MockXInterface) DropIndexes(bean interface{}) error {
|
||||
func (m *MockXInterface) DropIndexes(bean any) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "DropIndexes", bean)
|
||||
ret0, _ := ret[0].(error)
|
||||
@ -285,15 +291,15 @@ func (m *MockXInterface) DropIndexes(bean interface{}) error {
|
||||
}
|
||||
|
||||
// DropIndexes indicates an expected call of DropIndexes.
|
||||
func (mr *MockXInterfaceMockRecorder) DropIndexes(bean interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) DropIndexes(bean any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DropIndexes", reflect.TypeOf((*MockXInterface)(nil).DropIndexes), bean)
|
||||
}
|
||||
|
||||
// Exec mocks base method.
|
||||
func (m *MockXInterface) Exec(sqlOrArgs ...interface{}) (sql.Result, error) {
|
||||
func (m *MockXInterface) Exec(sqlOrArgs ...any) (sql.Result, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range sqlOrArgs {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -304,15 +310,15 @@ func (m *MockXInterface) Exec(sqlOrArgs ...interface{}) (sql.Result, error) {
|
||||
}
|
||||
|
||||
// Exec indicates an expected call of Exec.
|
||||
func (mr *MockXInterfaceMockRecorder) Exec(sqlOrArgs ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Exec(sqlOrArgs ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exec", reflect.TypeOf((*MockXInterface)(nil).Exec), sqlOrArgs...)
|
||||
}
|
||||
|
||||
// Exist mocks base method.
|
||||
func (m *MockXInterface) Exist(bean ...interface{}) (bool, error) {
|
||||
func (m *MockXInterface) Exist(bean ...any) (bool, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range bean {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -323,15 +329,15 @@ func (m *MockXInterface) Exist(bean ...interface{}) (bool, error) {
|
||||
}
|
||||
|
||||
// Exist indicates an expected call of Exist.
|
||||
func (mr *MockXInterfaceMockRecorder) Exist(bean ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Exist(bean ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exist", reflect.TypeOf((*MockXInterface)(nil).Exist), bean...)
|
||||
}
|
||||
|
||||
// Find mocks base method.
|
||||
func (m *MockXInterface) Find(arg0 interface{}, arg1 ...interface{}) error {
|
||||
func (m *MockXInterface) Find(arg0 any, arg1 ...any) error {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -341,16 +347,16 @@ func (m *MockXInterface) Find(arg0 interface{}, arg1 ...interface{}) error {
|
||||
}
|
||||
|
||||
// Find indicates an expected call of Find.
|
||||
func (mr *MockXInterfaceMockRecorder) Find(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Find(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Find", reflect.TypeOf((*MockXInterface)(nil).Find), varargs...)
|
||||
}
|
||||
|
||||
// FindAndCount mocks base method.
|
||||
func (m *MockXInterface) FindAndCount(arg0 interface{}, arg1 ...interface{}) (int64, error) {
|
||||
func (m *MockXInterface) FindAndCount(arg0 any, arg1 ...any) (int64, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -361,16 +367,16 @@ func (m *MockXInterface) FindAndCount(arg0 interface{}, arg1 ...interface{}) (in
|
||||
}
|
||||
|
||||
// FindAndCount indicates an expected call of FindAndCount.
|
||||
func (mr *MockXInterfaceMockRecorder) FindAndCount(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) FindAndCount(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindAndCount", reflect.TypeOf((*MockXInterface)(nil).FindAndCount), varargs...)
|
||||
}
|
||||
|
||||
// Get mocks base method.
|
||||
func (m *MockXInterface) Get(arg0 ...interface{}) (bool, error) {
|
||||
func (m *MockXInterface) Get(arg0 ...any) (bool, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range arg0 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -381,7 +387,7 @@ func (m *MockXInterface) Get(arg0 ...interface{}) (bool, error) {
|
||||
}
|
||||
|
||||
// Get indicates an expected call of Get.
|
||||
func (mr *MockXInterfaceMockRecorder) Get(arg0 ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Get(arg0 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockXInterface)(nil).Get), arg0...)
|
||||
}
|
||||
@ -395,13 +401,13 @@ func (m *MockXInterface) GroupBy(keys string) *xorm.Session {
|
||||
}
|
||||
|
||||
// GroupBy indicates an expected call of GroupBy.
|
||||
func (mr *MockXInterfaceMockRecorder) GroupBy(keys interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) GroupBy(keys any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GroupBy", reflect.TypeOf((*MockXInterface)(nil).GroupBy), keys)
|
||||
}
|
||||
|
||||
// ID mocks base method.
|
||||
func (m *MockXInterface) ID(arg0 interface{}) *xorm.Session {
|
||||
func (m *MockXInterface) ID(arg0 any) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ID", arg0)
|
||||
ret0, _ := ret[0].(*xorm.Session)
|
||||
@ -409,15 +415,15 @@ func (m *MockXInterface) ID(arg0 interface{}) *xorm.Session {
|
||||
}
|
||||
|
||||
// ID indicates an expected call of ID.
|
||||
func (mr *MockXInterfaceMockRecorder) ID(arg0 interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) ID(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ID", reflect.TypeOf((*MockXInterface)(nil).ID), arg0)
|
||||
}
|
||||
|
||||
// In mocks base method.
|
||||
func (m *MockXInterface) In(arg0 string, arg1 ...interface{}) *xorm.Session {
|
||||
func (m *MockXInterface) In(arg0 string, arg1 ...any) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -427,16 +433,16 @@ func (m *MockXInterface) In(arg0 string, arg1 ...interface{}) *xorm.Session {
|
||||
}
|
||||
|
||||
// In indicates an expected call of In.
|
||||
func (mr *MockXInterfaceMockRecorder) In(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) In(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "In", reflect.TypeOf((*MockXInterface)(nil).In), varargs...)
|
||||
}
|
||||
|
||||
// Incr mocks base method.
|
||||
func (m *MockXInterface) Incr(column string, arg ...interface{}) *xorm.Session {
|
||||
func (m *MockXInterface) Incr(column string, arg ...any) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{column}
|
||||
varargs := []any{column}
|
||||
for _, a := range arg {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -446,16 +452,16 @@ func (m *MockXInterface) Incr(column string, arg ...interface{}) *xorm.Session {
|
||||
}
|
||||
|
||||
// Incr indicates an expected call of Incr.
|
||||
func (mr *MockXInterfaceMockRecorder) Incr(column interface{}, arg ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Incr(column any, arg ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{column}, arg...)
|
||||
varargs := append([]any{column}, arg...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Incr", reflect.TypeOf((*MockXInterface)(nil).Incr), varargs...)
|
||||
}
|
||||
|
||||
// Insert mocks base method.
|
||||
func (m *MockXInterface) Insert(arg0 ...interface{}) (int64, error) {
|
||||
func (m *MockXInterface) Insert(arg0 ...any) (int64, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range arg0 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -466,13 +472,13 @@ func (m *MockXInterface) Insert(arg0 ...interface{}) (int64, error) {
|
||||
}
|
||||
|
||||
// Insert indicates an expected call of Insert.
|
||||
func (mr *MockXInterfaceMockRecorder) Insert(arg0 ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Insert(arg0 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Insert", reflect.TypeOf((*MockXInterface)(nil).Insert), arg0...)
|
||||
}
|
||||
|
||||
// InsertOne mocks base method.
|
||||
func (m *MockXInterface) InsertOne(arg0 interface{}) (int64, error) {
|
||||
func (m *MockXInterface) InsertOne(arg0 any) (int64, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "InsertOne", arg0)
|
||||
ret0, _ := ret[0].(int64)
|
||||
@ -481,13 +487,13 @@ func (m *MockXInterface) InsertOne(arg0 interface{}) (int64, error) {
|
||||
}
|
||||
|
||||
// InsertOne indicates an expected call of InsertOne.
|
||||
func (mr *MockXInterfaceMockRecorder) InsertOne(arg0 interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) InsertOne(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InsertOne", reflect.TypeOf((*MockXInterface)(nil).InsertOne), arg0)
|
||||
}
|
||||
|
||||
// IsTableEmpty mocks base method.
|
||||
func (m *MockXInterface) IsTableEmpty(bean interface{}) (bool, error) {
|
||||
func (m *MockXInterface) IsTableEmpty(bean any) (bool, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "IsTableEmpty", bean)
|
||||
ret0, _ := ret[0].(bool)
|
||||
@ -496,13 +502,13 @@ func (m *MockXInterface) IsTableEmpty(bean interface{}) (bool, error) {
|
||||
}
|
||||
|
||||
// IsTableEmpty indicates an expected call of IsTableEmpty.
|
||||
func (mr *MockXInterfaceMockRecorder) IsTableEmpty(bean interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) IsTableEmpty(bean any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsTableEmpty", reflect.TypeOf((*MockXInterface)(nil).IsTableEmpty), bean)
|
||||
}
|
||||
|
||||
// IsTableExist mocks base method.
|
||||
func (m *MockXInterface) IsTableExist(beanOrTableName interface{}) (bool, error) {
|
||||
func (m *MockXInterface) IsTableExist(beanOrTableName any) (bool, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "IsTableExist", beanOrTableName)
|
||||
ret0, _ := ret[0].(bool)
|
||||
@ -511,13 +517,13 @@ func (m *MockXInterface) IsTableExist(beanOrTableName interface{}) (bool, error)
|
||||
}
|
||||
|
||||
// IsTableExist indicates an expected call of IsTableExist.
|
||||
func (mr *MockXInterfaceMockRecorder) IsTableExist(beanOrTableName interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) IsTableExist(beanOrTableName any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsTableExist", reflect.TypeOf((*MockXInterface)(nil).IsTableExist), beanOrTableName)
|
||||
}
|
||||
|
||||
// Iterate mocks base method.
|
||||
func (m *MockXInterface) Iterate(arg0 interface{}, arg1 xorm.IterFunc) error {
|
||||
func (m *MockXInterface) Iterate(arg0 any, arg1 xorm.IterFunc) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Iterate", arg0, arg1)
|
||||
ret0, _ := ret[0].(error)
|
||||
@ -525,15 +531,15 @@ func (m *MockXInterface) Iterate(arg0 interface{}, arg1 xorm.IterFunc) error {
|
||||
}
|
||||
|
||||
// Iterate indicates an expected call of Iterate.
|
||||
func (mr *MockXInterfaceMockRecorder) Iterate(arg0, arg1 interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Iterate(arg0, arg1 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Iterate", reflect.TypeOf((*MockXInterface)(nil).Iterate), arg0, arg1)
|
||||
}
|
||||
|
||||
// Join mocks base method.
|
||||
func (m *MockXInterface) Join(joinOperator string, tablename interface{}, condition string, args ...interface{}) *xorm.Session {
|
||||
func (m *MockXInterface) Join(joinOperator string, tablename any, condition string, args ...any) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{joinOperator, tablename, condition}
|
||||
varargs := []any{joinOperator, tablename, condition}
|
||||
for _, a := range args {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -543,16 +549,16 @@ func (m *MockXInterface) Join(joinOperator string, tablename interface{}, condit
|
||||
}
|
||||
|
||||
// Join indicates an expected call of Join.
|
||||
func (mr *MockXInterfaceMockRecorder) Join(joinOperator, tablename, condition interface{}, args ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Join(joinOperator, tablename, condition any, args ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{joinOperator, tablename, condition}, args...)
|
||||
varargs := append([]any{joinOperator, tablename, condition}, args...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Join", reflect.TypeOf((*MockXInterface)(nil).Join), varargs...)
|
||||
}
|
||||
|
||||
// Limit mocks base method.
|
||||
func (m *MockXInterface) Limit(arg0 int, arg1 ...int) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -562,16 +568,16 @@ func (m *MockXInterface) Limit(arg0 int, arg1 ...int) *xorm.Session {
|
||||
}
|
||||
|
||||
// Limit indicates an expected call of Limit.
|
||||
func (mr *MockXInterfaceMockRecorder) Limit(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Limit(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Limit", reflect.TypeOf((*MockXInterface)(nil).Limit), varargs...)
|
||||
}
|
||||
|
||||
// MustCols mocks base method.
|
||||
func (m *MockXInterface) MustCols(columns ...string) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range columns {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -581,7 +587,7 @@ func (m *MockXInterface) MustCols(columns ...string) *xorm.Session {
|
||||
}
|
||||
|
||||
// MustCols indicates an expected call of MustCols.
|
||||
func (mr *MockXInterfaceMockRecorder) MustCols(columns ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) MustCols(columns ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MustCols", reflect.TypeOf((*MockXInterface)(nil).MustCols), columns...)
|
||||
}
|
||||
@ -589,7 +595,7 @@ func (mr *MockXInterfaceMockRecorder) MustCols(columns ...interface{}) *gomock.C
|
||||
// NoAutoCondition mocks base method.
|
||||
func (m *MockXInterface) NoAutoCondition(arg0 ...bool) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range arg0 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -599,15 +605,15 @@ func (m *MockXInterface) NoAutoCondition(arg0 ...bool) *xorm.Session {
|
||||
}
|
||||
|
||||
// NoAutoCondition indicates an expected call of NoAutoCondition.
|
||||
func (mr *MockXInterfaceMockRecorder) NoAutoCondition(arg0 ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) NoAutoCondition(arg0 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NoAutoCondition", reflect.TypeOf((*MockXInterface)(nil).NoAutoCondition), arg0...)
|
||||
}
|
||||
|
||||
// NotIn mocks base method.
|
||||
func (m *MockXInterface) NotIn(arg0 string, arg1 ...interface{}) *xorm.Session {
|
||||
func (m *MockXInterface) NotIn(arg0 string, arg1 ...any) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -617,16 +623,16 @@ func (m *MockXInterface) NotIn(arg0 string, arg1 ...interface{}) *xorm.Session {
|
||||
}
|
||||
|
||||
// NotIn indicates an expected call of NotIn.
|
||||
func (mr *MockXInterfaceMockRecorder) NotIn(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) NotIn(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotIn", reflect.TypeOf((*MockXInterface)(nil).NotIn), varargs...)
|
||||
}
|
||||
|
||||
// Nullable mocks base method.
|
||||
func (m *MockXInterface) Nullable(arg0 ...string) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range arg0 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -636,7 +642,7 @@ func (m *MockXInterface) Nullable(arg0 ...string) *xorm.Session {
|
||||
}
|
||||
|
||||
// Nullable indicates an expected call of Nullable.
|
||||
func (mr *MockXInterfaceMockRecorder) Nullable(arg0 ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Nullable(arg0 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Nullable", reflect.TypeOf((*MockXInterface)(nil).Nullable), arg0...)
|
||||
}
|
||||
@ -644,7 +650,7 @@ func (mr *MockXInterfaceMockRecorder) Nullable(arg0 ...interface{}) *gomock.Call
|
||||
// Omit mocks base method.
|
||||
func (m *MockXInterface) Omit(columns ...string) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range columns {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -654,15 +660,15 @@ func (m *MockXInterface) Omit(columns ...string) *xorm.Session {
|
||||
}
|
||||
|
||||
// Omit indicates an expected call of Omit.
|
||||
func (mr *MockXInterfaceMockRecorder) Omit(columns ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Omit(columns ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Omit", reflect.TypeOf((*MockXInterface)(nil).Omit), columns...)
|
||||
}
|
||||
|
||||
// OrderBy mocks base method.
|
||||
func (m *MockXInterface) OrderBy(order interface{}, args ...interface{}) *xorm.Session {
|
||||
func (m *MockXInterface) OrderBy(order any, args ...any) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{order}
|
||||
varargs := []any{order}
|
||||
for _, a := range args {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -672,9 +678,9 @@ func (m *MockXInterface) OrderBy(order interface{}, args ...interface{}) *xorm.S
|
||||
}
|
||||
|
||||
// OrderBy indicates an expected call of OrderBy.
|
||||
func (mr *MockXInterfaceMockRecorder) OrderBy(order interface{}, args ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) OrderBy(order any, args ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{order}, args...)
|
||||
varargs := append([]any{order}, args...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OrderBy", reflect.TypeOf((*MockXInterface)(nil).OrderBy), varargs...)
|
||||
}
|
||||
|
||||
@ -693,9 +699,9 @@ func (mr *MockXInterfaceMockRecorder) Ping() *gomock.Call {
|
||||
}
|
||||
|
||||
// Query mocks base method.
|
||||
func (m *MockXInterface) Query(sqlOrArgs ...interface{}) ([]map[string][]byte, error) {
|
||||
func (m *MockXInterface) Query(sqlOrArgs ...any) ([]map[string][]byte, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range sqlOrArgs {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -706,34 +712,34 @@ func (m *MockXInterface) Query(sqlOrArgs ...interface{}) ([]map[string][]byte, e
|
||||
}
|
||||
|
||||
// Query indicates an expected call of Query.
|
||||
func (mr *MockXInterfaceMockRecorder) Query(sqlOrArgs ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Query(sqlOrArgs ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Query", reflect.TypeOf((*MockXInterface)(nil).Query), sqlOrArgs...)
|
||||
}
|
||||
|
||||
// QueryInterface mocks base method.
|
||||
func (m *MockXInterface) QueryInterface(sqlOrArgs ...interface{}) ([]map[string]interface{}, error) {
|
||||
func (m *MockXInterface) QueryInterface(sqlOrArgs ...any) ([]map[string]any, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range sqlOrArgs {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "QueryInterface", varargs...)
|
||||
ret0, _ := ret[0].([]map[string]interface{})
|
||||
ret0, _ := ret[0].([]map[string]any)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// QueryInterface indicates an expected call of QueryInterface.
|
||||
func (mr *MockXInterfaceMockRecorder) QueryInterface(sqlOrArgs ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) QueryInterface(sqlOrArgs ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryInterface", reflect.TypeOf((*MockXInterface)(nil).QueryInterface), sqlOrArgs...)
|
||||
}
|
||||
|
||||
// QueryString mocks base method.
|
||||
func (m *MockXInterface) QueryString(sqlOrArgs ...interface{}) ([]map[string]string, error) {
|
||||
func (m *MockXInterface) QueryString(sqlOrArgs ...any) ([]map[string]string, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range sqlOrArgs {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -744,7 +750,7 @@ func (m *MockXInterface) QueryString(sqlOrArgs ...interface{}) ([]map[string]str
|
||||
}
|
||||
|
||||
// QueryString indicates an expected call of QueryString.
|
||||
func (mr *MockXInterfaceMockRecorder) QueryString(sqlOrArgs ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) QueryString(sqlOrArgs ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryString", reflect.TypeOf((*MockXInterface)(nil).QueryString), sqlOrArgs...)
|
||||
}
|
||||
@ -764,7 +770,7 @@ func (mr *MockXInterfaceMockRecorder) Rollback() *gomock.Call {
|
||||
}
|
||||
|
||||
// Rows mocks base method.
|
||||
func (m *MockXInterface) Rows(bean interface{}) (*xorm.Rows, error) {
|
||||
func (m *MockXInterface) Rows(bean any) (*xorm.Rows, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Rows", bean)
|
||||
ret0, _ := ret[0].(*xorm.Rows)
|
||||
@ -773,15 +779,15 @@ func (m *MockXInterface) Rows(bean interface{}) (*xorm.Rows, error) {
|
||||
}
|
||||
|
||||
// Rows indicates an expected call of Rows.
|
||||
func (mr *MockXInterfaceMockRecorder) Rows(bean interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Rows(bean any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Rows", reflect.TypeOf((*MockXInterface)(nil).Rows), bean)
|
||||
}
|
||||
|
||||
// SQL mocks base method.
|
||||
func (m *MockXInterface) SQL(arg0 interface{}, arg1 ...interface{}) *xorm.Session {
|
||||
func (m *MockXInterface) SQL(arg0 any, arg1 ...any) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -791,9 +797,9 @@ func (m *MockXInterface) SQL(arg0 interface{}, arg1 ...interface{}) *xorm.Sessio
|
||||
}
|
||||
|
||||
// SQL indicates an expected call of SQL.
|
||||
func (mr *MockXInterfaceMockRecorder) SQL(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) SQL(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SQL", reflect.TypeOf((*MockXInterface)(nil).SQL), varargs...)
|
||||
}
|
||||
|
||||
@ -806,13 +812,13 @@ func (m *MockXInterface) Select(arg0 string) *xorm.Session {
|
||||
}
|
||||
|
||||
// Select indicates an expected call of Select.
|
||||
func (mr *MockXInterfaceMockRecorder) Select(arg0 interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Select(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Select", reflect.TypeOf((*MockXInterface)(nil).Select), arg0)
|
||||
}
|
||||
|
||||
// SetExpr mocks base method.
|
||||
func (m *MockXInterface) SetExpr(arg0 string, arg1 interface{}) *xorm.Session {
|
||||
func (m *MockXInterface) SetExpr(arg0 string, arg1 any) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SetExpr", arg0, arg1)
|
||||
ret0, _ := ret[0].(*xorm.Session)
|
||||
@ -820,13 +826,13 @@ func (m *MockXInterface) SetExpr(arg0 string, arg1 interface{}) *xorm.Session {
|
||||
}
|
||||
|
||||
// SetExpr indicates an expected call of SetExpr.
|
||||
func (mr *MockXInterfaceMockRecorder) SetExpr(arg0, arg1 interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) SetExpr(arg0, arg1 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetExpr", reflect.TypeOf((*MockXInterface)(nil).SetExpr), arg0, arg1)
|
||||
}
|
||||
|
||||
// Sum mocks base method.
|
||||
func (m *MockXInterface) Sum(bean interface{}, colName string) (float64, error) {
|
||||
func (m *MockXInterface) Sum(bean any, colName string) (float64, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Sum", bean, colName)
|
||||
ret0, _ := ret[0].(float64)
|
||||
@ -835,13 +841,13 @@ func (m *MockXInterface) Sum(bean interface{}, colName string) (float64, error)
|
||||
}
|
||||
|
||||
// Sum indicates an expected call of Sum.
|
||||
func (mr *MockXInterfaceMockRecorder) Sum(bean, colName interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Sum(bean, colName any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sum", reflect.TypeOf((*MockXInterface)(nil).Sum), bean, colName)
|
||||
}
|
||||
|
||||
// SumInt mocks base method.
|
||||
func (m *MockXInterface) SumInt(bean interface{}, colName string) (int64, error) {
|
||||
func (m *MockXInterface) SumInt(bean any, colName string) (int64, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SumInt", bean, colName)
|
||||
ret0, _ := ret[0].(int64)
|
||||
@ -850,15 +856,15 @@ func (m *MockXInterface) SumInt(bean interface{}, colName string) (int64, error)
|
||||
}
|
||||
|
||||
// SumInt indicates an expected call of SumInt.
|
||||
func (mr *MockXInterfaceMockRecorder) SumInt(bean, colName interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) SumInt(bean, colName any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SumInt", reflect.TypeOf((*MockXInterface)(nil).SumInt), bean, colName)
|
||||
}
|
||||
|
||||
// Sums mocks base method.
|
||||
func (m *MockXInterface) Sums(bean interface{}, colNames ...string) ([]float64, error) {
|
||||
func (m *MockXInterface) Sums(bean any, colNames ...string) ([]float64, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{bean}
|
||||
varargs := []any{bean}
|
||||
for _, a := range colNames {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -869,16 +875,16 @@ func (m *MockXInterface) Sums(bean interface{}, colNames ...string) ([]float64,
|
||||
}
|
||||
|
||||
// Sums indicates an expected call of Sums.
|
||||
func (mr *MockXInterfaceMockRecorder) Sums(bean interface{}, colNames ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Sums(bean any, colNames ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{bean}, colNames...)
|
||||
varargs := append([]any{bean}, colNames...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sums", reflect.TypeOf((*MockXInterface)(nil).Sums), varargs...)
|
||||
}
|
||||
|
||||
// SumsInt mocks base method.
|
||||
func (m *MockXInterface) SumsInt(bean interface{}, colNames ...string) ([]int64, error) {
|
||||
func (m *MockXInterface) SumsInt(bean any, colNames ...string) ([]int64, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{bean}
|
||||
varargs := []any{bean}
|
||||
for _, a := range colNames {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -889,14 +895,14 @@ func (m *MockXInterface) SumsInt(bean interface{}, colNames ...string) ([]int64,
|
||||
}
|
||||
|
||||
// SumsInt indicates an expected call of SumsInt.
|
||||
func (mr *MockXInterfaceMockRecorder) SumsInt(bean interface{}, colNames ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) SumsInt(bean any, colNames ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{bean}, colNames...)
|
||||
varargs := append([]any{bean}, colNames...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SumsInt", reflect.TypeOf((*MockXInterface)(nil).SumsInt), varargs...)
|
||||
}
|
||||
|
||||
// Table mocks base method.
|
||||
func (m *MockXInterface) Table(tableNameOrBean interface{}) *xorm.Session {
|
||||
func (m *MockXInterface) Table(tableNameOrBean any) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Table", tableNameOrBean)
|
||||
ret0, _ := ret[0].(*xorm.Session)
|
||||
@ -904,7 +910,7 @@ func (m *MockXInterface) Table(tableNameOrBean interface{}) *xorm.Session {
|
||||
}
|
||||
|
||||
// Table indicates an expected call of Table.
|
||||
func (mr *MockXInterfaceMockRecorder) Table(tableNameOrBean interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Table(tableNameOrBean any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Table", reflect.TypeOf((*MockXInterface)(nil).Table), tableNameOrBean)
|
||||
}
|
||||
@ -924,9 +930,9 @@ func (mr *MockXInterfaceMockRecorder) Unscoped() *gomock.Call {
|
||||
}
|
||||
|
||||
// Update mocks base method.
|
||||
func (m *MockXInterface) Update(bean interface{}, condiBeans ...interface{}) (int64, error) {
|
||||
func (m *MockXInterface) Update(bean any, condiBeans ...any) (int64, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{bean}
|
||||
varargs := []any{bean}
|
||||
for _, a := range condiBeans {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -937,16 +943,16 @@ func (m *MockXInterface) Update(bean interface{}, condiBeans ...interface{}) (in
|
||||
}
|
||||
|
||||
// Update indicates an expected call of Update.
|
||||
func (mr *MockXInterfaceMockRecorder) Update(bean interface{}, condiBeans ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Update(bean any, condiBeans ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{bean}, condiBeans...)
|
||||
varargs := append([]any{bean}, condiBeans...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockXInterface)(nil).Update), varargs...)
|
||||
}
|
||||
|
||||
// UseBool mocks base method.
|
||||
func (m *MockXInterface) UseBool(arg0 ...string) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{}
|
||||
varargs := []any{}
|
||||
for _, a := range arg0 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -956,15 +962,15 @@ func (m *MockXInterface) UseBool(arg0 ...string) *xorm.Session {
|
||||
}
|
||||
|
||||
// UseBool indicates an expected call of UseBool.
|
||||
func (mr *MockXInterfaceMockRecorder) UseBool(arg0 ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) UseBool(arg0 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UseBool", reflect.TypeOf((*MockXInterface)(nil).UseBool), arg0...)
|
||||
}
|
||||
|
||||
// Where mocks base method.
|
||||
func (m *MockXInterface) Where(arg0 interface{}, arg1 ...interface{}) *xorm.Session {
|
||||
func (m *MockXInterface) Where(arg0 any, arg1 ...any) *xorm.Session {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
@ -974,8 +980,8 @@ func (m *MockXInterface) Where(arg0 interface{}, arg1 ...interface{}) *xorm.Sess
|
||||
}
|
||||
|
||||
// Where indicates an expected call of Where.
|
||||
func (mr *MockXInterfaceMockRecorder) Where(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockXInterfaceMockRecorder) Where(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Where", reflect.TypeOf((*MockXInterface)(nil).Where), varargs...)
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
|
||||
var sessionMap = sync.Map{}
|
||||
|
||||
//go:generate mockgen -package xorm -source transaction.go XInterface > session_mock_test.go
|
||||
//go:generate mockgen -package xorm -destination=./session_mock_test.go -source transaction.go XInterface
|
||||
type XInterface interface {
|
||||
xorm.Interface
|
||||
driver.Tx
|
||||
|
@ -2,11 +2,11 @@ package xorm
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/gone-io/gone/goner/config"
|
||||
"github.com/gone-io/gone/goner/logrus"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"testing"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
@ -2,8 +2,8 @@ package gone
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
766
mock_test.go
766
mock_test.go
File diff suppressed because it is too large
Load Diff
1
templates/.gitignore
vendored
1
templates/.gitignore
vendored
@ -1 +0,0 @@
|
||||
*/go.sum
|
@ -1,8 +0,0 @@
|
||||
package templates
|
||||
|
||||
import "embed"
|
||||
|
||||
//go:embed *
|
||||
//go:embed */.dockerignore
|
||||
//go:embed */.gitignore
|
||||
var F embed.FS
|
@ -1,2 +0,0 @@
|
||||
tests
|
||||
*.md
|
3
templates/web+mysql/.gitignore
vendored
3
templates/web+mysql/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
bin
|
||||
data
|
||||
internal/priest.go
|
@ -1,35 +0,0 @@
|
||||
FROM golang:1.22-alpine3.19 as builder
|
||||
WORKDIR /app
|
||||
|
||||
RUN sed 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' -i /etc/apk/repositories && \
|
||||
apk add make git
|
||||
|
||||
ENV GO111MODULE=on \
|
||||
GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
COPY ["go.mod", "go.sum", "Makefile", "./"]
|
||||
|
||||
RUN --mount=type=cache,target=/go,id=go go mod download
|
||||
|
||||
COPY cmd cmd
|
||||
COPY internal internal
|
||||
|
||||
#编译
|
||||
RUN --mount=type=cache,target=/go,id=go make build
|
||||
|
||||
FROM alpine:3.19
|
||||
RUN sed 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' -i /etc/apk/repositories && \
|
||||
apk update && \
|
||||
apk add tzdata && \
|
||||
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
||||
echo "Asia/Shanghai" > /etc/timezone
|
||||
|
||||
WORKDIR /app
|
||||
COPY config config
|
||||
COPY --from=builder /app/bin/server /app/server
|
||||
|
||||
ARG ENVIRONMENT=dev
|
||||
ENV ENV=${ENVIRONMENT}
|
||||
|
||||
CMD ./server
|
||||
EXPOSE 8080
|
@ -1,32 +0,0 @@
|
||||
gone:
|
||||
make install-gone
|
||||
go mod tidy
|
||||
go generate ./...
|
||||
|
||||
run:
|
||||
make gone
|
||||
go run cmd/server/main.go
|
||||
|
||||
build:
|
||||
make gone
|
||||
go build -ldflags="-w -s" -tags musl -o bin/server cmd/server/main.go
|
||||
|
||||
|
||||
build-docker:
|
||||
docker compose build
|
||||
|
||||
run-in-docker:
|
||||
docker compose up
|
||||
|
||||
|
||||
# for test
|
||||
test:
|
||||
make install-mockgen
|
||||
make gone
|
||||
go test ./... -v
|
||||
|
||||
install-gone:
|
||||
go install github.com/gone-io/gone/tools/gone@latest
|
||||
|
||||
install-mockgen:
|
||||
go install github.com/golang/mock/mockgen@latest
|
@ -1,79 +0,0 @@
|
||||
# web-mysql
|
||||
|
||||
|
||||
## 目录结构:
|
||||
|
||||
```
|
||||
.
|
||||
├── README.md
|
||||
├── go.mod
|
||||
├── go.sum
|
||||
├── docker-compose.yaml # compose文件,通过在当前目录执行 `docker-compose up` 可以运行代码
|
||||
├── Dockerfile # 用于镜像编译
|
||||
├── Makefile # Makefile,定义了 run、build、test 等命令
|
||||
├── bin
|
||||
│ └── server # 项目编译后的二进制文件
|
||||
├── cmd
|
||||
│ └── server
|
||||
│ └── main.go
|
||||
├── config # 配置目录
|
||||
│ ├── default.properties # 默认配置
|
||||
│ ├── local.properties # 本地开发配置,不设置环境变量,会使用该配置
|
||||
│ ├── dev.properties # 开发环境配置,可以用于部署到开发环境的服务器上
|
||||
│ └── prod.properties # 生产环境配置,用于部署到生产环境使用
|
||||
├── internal
|
||||
│ ├── master.go # 主 Preist 函数,用于加载框架基础依赖(本项目只依赖了 goner/gin ) 和 内部 Priest 函数
|
||||
│ ├── priest.go # 运行 make gone 生成的文件,包括一个Priest函数,用于安葬(加载)所有内部的Goner组件
|
||||
│ ├── interface # 接口包,可以包含 domain 、event、 service 等子包
|
||||
│ │ ├── domain # 用于定义业务对象(实体对象、值对象、聚合根等)
|
||||
│ │ │ ├── demo.go
|
||||
│ │ │ └── user.go
|
||||
│ │ └── service # 内部接口包,用于管理内部接口定义
|
||||
│ │ └── i_demo.go # IDemo 接口
|
||||
│ ├── middleware # 中间件包,用于定义中间件
|
||||
│ │ ├── authorize.go
|
||||
│ │ └── pub.go
|
||||
│ ├── module # 模块
|
||||
│ │ └── demo # demo模块,一般情况下,一个模块与service包下的一个文件对应,实现其中定义的接口
|
||||
│ │ ├── demo_svc.go # 实现 IDemo 接口
|
||||
│ │ └── error.go # 模块内的错误编码定义
|
||||
│ ├── controller # controller目录,用于定义http服务接口
|
||||
│ │ └── demo_ctr.go # demo controller
|
||||
│ ├── pkg
|
||||
│ │ └── utils
|
||||
│ │ └── error.go # 定义全局错误编码
|
||||
│ └── router
|
||||
│ ├── auth_router.go # 定义需要鉴权的路由
|
||||
│ └── pub_router.go # 定义不需要鉴权的路由
|
||||
└── tests # 全局测试目录
|
||||
└── api # 接口测试
|
||||
└── demo.http # demo接口测试
|
||||
```
|
||||
|
||||
## 命令
|
||||
|
||||
> 假设已经安装了Golang环境
|
||||
> 下列命令使用Makefile定义,系统中需要安装Make(参考[安装make](https://blog.csdn.net/waitdeng/article/details/138849321))
|
||||
|
||||
- `make gone`
|
||||
用于生成Priest代码,在IED中运行前**⚠️必须先执行**该命令,否则代码不完整无法运行
|
||||
|
||||
- `make run`
|
||||
运行代码,已经集成了`make gone`
|
||||
|
||||
- `make build`
|
||||
编译项目
|
||||
- `make build-docker`
|
||||
编译docker镜像,假设已经安装 [docker](https://www.docker.com/)
|
||||
和 [docker-compose](https://docs.docker.com/compose/install/)
|
||||
- `make run-in-docker`
|
||||
在docker中运行,假设已经安装 [docker](https://www.docker.com/)
|
||||
和 [docker-compose](https://docs.docker.com/compose/install/)
|
||||
|
||||
## 数据库
|
||||
在`docker-compose.yaml`中定义了数据库,默认使用`mysql`,默认用户名密码为`root/123456`,启动方法:
|
||||
|
||||
```bash
|
||||
docker compose up -d mysql
|
||||
```
|
||||
如果另外使用数据库,请修改`config/default.properties`中的相关信息
|
@ -1,42 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/gone-io/gone"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"web-mysql/internal"
|
||||
)
|
||||
|
||||
func main() {
|
||||
////给启动流程增加traceId
|
||||
//tracer.SetTraceId("", func() {
|
||||
// gone.Serve(internal.MasterPriest)
|
||||
//})
|
||||
|
||||
// 直接启动服务
|
||||
//gone.Serve(internal.MasterPriest)
|
||||
|
||||
// 启动前注册Hook函数;更多内容参考文档:https://goner.fun/zh/guide/hooks.html
|
||||
//Hook可以注册多次;支持的Hook函数有:BeforeStart、AfterStart、BeforeStop、AfterStop;
|
||||
// 注意:BeforeStart、BeforeStop **后注册先执行**; AfterStart、AfterStop **先注册先执行**;
|
||||
gone.
|
||||
Prepare(internal.MasterPriest).
|
||||
BeforeStart(func(in struct {
|
||||
// 在 BeforeStart、AfterStart、BeforeStop、AfterStop Hook中,可以注入任何需要的依赖;
|
||||
cemetery gone.Cemetery `gone:"gone-cemetery"`
|
||||
log gone.Logger `gone:"gone-logger"`
|
||||
}) {
|
||||
log.Info("before start")
|
||||
// 启动前执行的代码
|
||||
}).
|
||||
AfterStart(func() {
|
||||
// 启动后执行的代码
|
||||
}).
|
||||
BeforeStop(func() {
|
||||
// 停止前执行的代码
|
||||
}).
|
||||
AfterStop(func() {
|
||||
// 停止后执行的代码
|
||||
}).
|
||||
Serve()
|
||||
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
# 服务监听主机地址,默认为空
|
||||
#server.host
|
||||
|
||||
# 服务端口,默认为8080
|
||||
# server.port=8080
|
||||
|
||||
# gin服务模式,可选值 debug,test,release,默认为release
|
||||
server.mode=debug
|
||||
|
||||
# 静态服务目录/文件,支持通配符,默认无
|
||||
#server.html-tpl-pattern=
|
||||
|
||||
# 健康检查监听路径,默认无
|
||||
server.health-check=/api/health-check
|
||||
|
||||
# 是否打印access log,默认true
|
||||
# server.log.show-access-log=true
|
||||
|
||||
# 打印access log 长度限制,0为不限制,默认为0
|
||||
# server.log.data-max-length=100
|
||||
|
||||
# 是否打印请求耗时,默认true
|
||||
# server.log.show-request-time=true
|
||||
|
||||
# 开启返回数据封装,开启后响应内容会封装到 json`{"code": 0, "msg": "err msg", data: $data }`中,默认true
|
||||
# server.return.wrapped-data=true
|
||||
|
||||
#业务代码自定义配置:http上下文中保存userId的Key
|
||||
auth.user-key=user
|
||||
|
||||
# 使用mysql
|
||||
database.driver-name=mysql
|
||||
|
||||
db.host=localhost
|
||||
db.port=3306
|
||||
db.name=demo
|
||||
db.username=root
|
||||
db.password=123456
|
||||
|
||||
# 数据源配置 配置中,使用${key}来引用配置文件中的值
|
||||
database.dsn=${db.username}:${db.password}@tcp(${db.host}:${db.port})/${db.name}?charset=utf8mb4&loc=Local
|
@ -1 +0,0 @@
|
||||
server.env=dev
|
@ -1,4 +0,0 @@
|
||||
# 本地开发环境会读取该文件的配置
|
||||
server.env=dev
|
||||
|
||||
log.level=debug
|
@ -1,3 +0,0 @@
|
||||
server.env=prod
|
||||
|
||||
db.host=mysql
|
@ -1,31 +0,0 @@
|
||||
version: '3.8'
|
||||
services:
|
||||
web:
|
||||
image: web
|
||||
restart: unless-stopped
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
ENVIRONMENT: prod
|
||||
ports:
|
||||
- "8080:8080"
|
||||
depends_on:
|
||||
- mysql
|
||||
healthcheck: # 添加健康检测
|
||||
test: [ "CMD", "curl", "-f", "http://localhost:8080/api/health-check" ]
|
||||
interval: 30s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 20s
|
||||
|
||||
mysql:
|
||||
image: mysql:8.3
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: 123456
|
||||
MYSQL_DATABASE: demo
|
||||
volumes:
|
||||
- ./data/mysql:/var/lib/mysql
|
||||
- ./scripts/mysql/initdb.d:/docker-entrypoint-initdb.d
|
||||
ports:
|
||||
- "3306:3306"
|
@ -1,10 +0,0 @@
|
||||
module web-mysql
|
||||
|
||||
go 1.21
|
||||
|
||||
toolchain go1.21.1
|
||||
|
||||
require (
|
||||
github.com/go-sql-driver/mysql v1.6.0
|
||||
github.com/gone-io/gone latest
|
||||
)
|
@ -1,159 +0,0 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/gone-io/gone"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"web-mysql/internal/interface/domain"
|
||||
"web-mysql/internal/interface/service"
|
||||
"web-mysql/internal/pkg/utils"
|
||||
)
|
||||
|
||||
//go:gone
|
||||
func NewDemoController() gone.Goner {
|
||||
return &demoController{}
|
||||
}
|
||||
|
||||
type demoController struct {
|
||||
gone.Flag
|
||||
demoSvc service.IDemo `gone:"*"`
|
||||
gone.Logger `gone:"*"`
|
||||
|
||||
authRouter gone.IRouter `gone:"router-auth"`
|
||||
pubRouter gone.IRouter `gone:"router-pub"`
|
||||
}
|
||||
|
||||
func (ctr *demoController) Mount() gone.GinMountError {
|
||||
|
||||
//需要鉴权的路由分组
|
||||
ctr.
|
||||
authRouter.
|
||||
Group("/demo").
|
||||
GET("/show", ctr.showDemo)
|
||||
|
||||
//不需要鉴权的路由分组
|
||||
ctr.
|
||||
pubRouter.
|
||||
Group("/demo2").
|
||||
GET("/show", ctr.showDemo).
|
||||
GET("/error", ctr.error).
|
||||
GET("/echo", ctr.echo)
|
||||
|
||||
// http注入 演示组
|
||||
ctr.
|
||||
pubRouter.
|
||||
GET("/inject-query", ctr.injectQuery).
|
||||
GET("/inject/:key", ctr.injectUrlParam).
|
||||
POST("/inject-http-body", ctr.injectHttpBody).
|
||||
GET("/inject-http-struct", ctr.injectHttpStruct)
|
||||
|
||||
// demo数据 user 的增删改查,挂载到authRouter只为方便演示
|
||||
ctr.
|
||||
pubRouter.
|
||||
Group("/users").
|
||||
POST("", func(in struct {
|
||||
req *domain.User `gone:"http,body"`
|
||||
}) error {
|
||||
return ctr.demoSvc.CreateUser(in.req)
|
||||
}).
|
||||
GET("", func() (any, error) {
|
||||
return ctr.demoSvc.ListUsers()
|
||||
}).
|
||||
GET("/page", func(in struct {
|
||||
query domain.PageQuery `gone:"http,query"`
|
||||
}) (any, error) {
|
||||
return ctr.demoSvc.PageUsers(in.query)
|
||||
}).
|
||||
GET("/:id", func(in struct {
|
||||
id int64 `gone:"http,param"`
|
||||
}) (any, error) {
|
||||
return ctr.demoSvc.GetUserById(in.id)
|
||||
}).
|
||||
PUT("/:id", func(in struct {
|
||||
id int64 `gone:"http,param"`
|
||||
req *domain.User `gone:"http,body"`
|
||||
}) error {
|
||||
return ctr.demoSvc.UpdateUserById(in.id, in.req)
|
||||
}).
|
||||
DELETE("/:id", func(in struct {
|
||||
id int64 `gone:"http,param"`
|
||||
}) error {
|
||||
return ctr.demoSvc.DeleteUser(in.id)
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type QueryReq struct {
|
||||
Key string `form:"key"`
|
||||
}
|
||||
|
||||
// http注入query参数
|
||||
func (ctr *demoController) injectQuery(in struct {
|
||||
key string `gone:"http,query"` //参数类型为string,标签中没有指定参数名时取属性名
|
||||
keyFloat float64 `gone:"http,query=key"` //参数类型为float64,标签中指定了参数名为key
|
||||
keyArr []int `gone:"http,query=key"` //参数类型为[]int,标签中指定了参数名为key
|
||||
|
||||
//参数类型为*QueryReq;
|
||||
//类型为一个结构体或者结构体指针时,会尝试将query中的参数值注入到结构体中;结构体的属性标注和gin框架的标签标注一致
|
||||
query *QueryReq `gone:"http,query"`
|
||||
}) (string, error) {
|
||||
query := fmt.Sprintf("key:%s;keyFloat:%f;keyArr:%v", in.key, in.keyFloat, in.keyArr)
|
||||
ctr.Infof("query=> %s", query)
|
||||
ctr.Infof("query=> %v", in.query)
|
||||
return query, nil
|
||||
}
|
||||
|
||||
func (ctr *demoController) injectUrlParam(in struct {
|
||||
key string `gone:"http,param"`
|
||||
keyInt int `gone:"http,param=key"`
|
||||
}) (any, error) {
|
||||
ctr.Infof("key: %s;keyInt: %d", in.key, in.keyInt)
|
||||
return in.key, nil
|
||||
}
|
||||
|
||||
func (ctr *demoController) injectHttpBody(in struct {
|
||||
req *Req `gone:"http,body"`
|
||||
}) (any, error) {
|
||||
ctr.Infof("req.Echo: %s", in.req.Echo)
|
||||
return in.req, nil
|
||||
}
|
||||
|
||||
func (ctr *demoController) injectHttpStruct(in struct {
|
||||
ctx *gone.Context `gone:"http"`
|
||||
req *http.Request `gone:"http"`
|
||||
url *url.URL `gone:"http"`
|
||||
header http.Header `gone:"http"`
|
||||
}) (any, error) {
|
||||
ctr.Infof("remote ip:%s", in.ctx.RemoteIP())
|
||||
ctr.Infof("method: %s", in.req.Method)
|
||||
ctr.Infof("url path:%s", in.url.Path)
|
||||
ctr.Infof("header: %v", in.header)
|
||||
|
||||
return "ok", nil
|
||||
}
|
||||
|
||||
type Req struct {
|
||||
Echo string `form:"echo" json:"echo" xml:"echo"`
|
||||
}
|
||||
|
||||
func (ctr *demoController) showDemo(ctx *gone.Context) (any, error) {
|
||||
return ctr.demoSvc.Show()
|
||||
}
|
||||
|
||||
func (ctr *demoController) error(ctx *gone.Context) (any, error) {
|
||||
return ctr.demoSvc.Error()
|
||||
}
|
||||
|
||||
func (ctr *demoController) echo(ctx *gone.Context) (any, error) {
|
||||
type Req struct {
|
||||
Echo string `form:"echo"`
|
||||
}
|
||||
|
||||
var req Req
|
||||
if err := ctx.Bind(&req); err != nil {
|
||||
return nil, gone.NewParameterError(err.Error(), utils.ParameterParseError)
|
||||
}
|
||||
return ctr.demoSvc.Echo(req.Echo)
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package domain
|
||||
|
||||
type DemoEntity struct {
|
||||
Info string `json:"info"`
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package domain
|
||||
|
||||
// Page 分页
|
||||
type Page[T any] struct {
|
||||
List []*T `json:"list,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type PageQuery struct {
|
||||
Page int `form:"page"`
|
||||
PageSize int `form:"pageSize"`
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package domain
|
||||
|
||||
type User struct {
|
||||
Id int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty" binding:"required"`
|
||||
Email string `json:"email,omitempty"`
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package entity
|
||||
|
||||
import "time"
|
||||
|
||||
type User struct {
|
||||
Id int64
|
||||
Name string
|
||||
Email string
|
||||
|
||||
CreatedAt *time.Time `xorm:"created"`
|
||||
UpdatedAt *time.Time `xorm:"updated"`
|
||||
DeletedAt *time.Time `xorm:"deleted"`
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package service
|
||||
|
||||
import "web-mysql/internal/interface/domain"
|
||||
|
||||
type IDemo interface {
|
||||
Show() (*domain.DemoEntity, error)
|
||||
Echo(input string) (string, error)
|
||||
Error() (any, error)
|
||||
|
||||
CreateUser(user *domain.User) error
|
||||
GetUserById(userId int64) (*domain.User, error)
|
||||
ListUsers() ([]*domain.User, error)
|
||||
UpdateUserById(userId int64, user *domain.User) error
|
||||
DeleteUser(userId int64) error
|
||||
PageUsers(query domain.PageQuery) (*domain.Page[domain.User], error)
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
_ "github.com/go-sql-driver/mysql" //导入mysql驱动
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/gone-io/gone/goner"
|
||||
)
|
||||
|
||||
//go:generate gone priest -s . -p $GOPACKAGE -f Priest -o priest.go
|
||||
func MasterPriest(cemetery gone.Cemetery) error {
|
||||
_ = goner.XormPriest(cemetery)
|
||||
_ = goner.GinPriest(cemetery)
|
||||
|
||||
_ = Priest(cemetery)
|
||||
return nil
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/gone-io/gone/goner/gin"
|
||||
"net/http"
|
||||
"web-mysql/internal/interface/domain"
|
||||
"web-mysql/internal/pkg/utils"
|
||||
)
|
||||
|
||||
//go:gone
|
||||
func NewAuthorizeMiddleware() gone.Goner {
|
||||
return &AuthorizeMiddleware{}
|
||||
}
|
||||
|
||||
type AuthorizeMiddleware struct {
|
||||
gone.Flag
|
||||
gone.Logger `gone:"*"`
|
||||
userKey string `gone:"config,auth.user-key"`
|
||||
}
|
||||
|
||||
func (m *AuthorizeMiddleware) Next(ctx *gone.Context) (any, error) {
|
||||
if userId, err := checkToken(ctx); err != nil {
|
||||
ctx.JSON(http.StatusUnauthorized, map[string]any{
|
||||
"code": err.Code(),
|
||||
"msg": err.Msg(),
|
||||
})
|
||||
ctx.Abort()
|
||||
} else {
|
||||
m.Debugf("userId:%v", userId)
|
||||
ctx.Set(m.userKey, userId)
|
||||
ctx.Next()
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func checkToken(ctx *gin.Context) (*domain.User, gone.Error) {
|
||||
//todo 修改该函数,实现鉴权的相关逻辑
|
||||
|
||||
if ctx.Query("auth") == "pass" {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, gone.NewParameterError("Unauthorized", utils.Unauthorized)
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/gone-io/gone"
|
||||
)
|
||||
|
||||
//go:gone
|
||||
func NewPlantMiddleware() gone.Goner {
|
||||
return &PubMiddleware{}
|
||||
}
|
||||
|
||||
// PubMiddleware 公共中间件
|
||||
type PubMiddleware struct {
|
||||
gone.Flag
|
||||
gone.Logger `gone:"*"`
|
||||
}
|
||||
|
||||
func (m *PubMiddleware) Next(ctx *gone.Context) (interface{}, error) {
|
||||
m.Infof("public middleware: %s", ctx.Request.URL)
|
||||
//todo
|
||||
return nil, nil
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
package demo
|
||||
|
||||
import (
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/gone-io/gone/goner/gin"
|
||||
"web-mysql/internal/interface/entity"
|
||||
)
|
||||
|
||||
//go:gone
|
||||
func NewDb() gone.Goner {
|
||||
return &db{}
|
||||
}
|
||||
|
||||
type db struct {
|
||||
gone.Flag
|
||||
gone.XormEngine `gone:"*"`
|
||||
}
|
||||
|
||||
func (d *db) createUser(user *entity.User) error {
|
||||
_, err := d.Insert(user)
|
||||
|
||||
//使用gone.ToError(err)来处理错误,如果err不为nil,将返回一个携带堆栈的错误,框架中间件会拦截并打印堆栈
|
||||
return gone.ToError(err)
|
||||
}
|
||||
|
||||
func (d *db) getUser(id int64) (*entity.User, error) {
|
||||
user := &entity.User{}
|
||||
has, err := d.ID(id).Get(user)
|
||||
if err != nil {
|
||||
return nil, gone.ToError(err)
|
||||
}
|
||||
if !has {
|
||||
return nil, nil
|
||||
}
|
||||
return user, nil
|
||||
}
|
||||
|
||||
func (d *db) updateUser(user *entity.User) error {
|
||||
_, err := d.ID(user.Id).Update(user)
|
||||
return gone.ToError(err)
|
||||
}
|
||||
|
||||
func (d *db) deleteUser(id int64) error {
|
||||
_, err := d.ID(id).Delete(&entity.User{})
|
||||
return gone.ToError(err)
|
||||
}
|
||||
|
||||
func (d *db) getUserList() ([]*entity.User, error) {
|
||||
users := make([]*entity.User, 0)
|
||||
err := d.Find(&users)
|
||||
if err != nil {
|
||||
return nil, gone.ToError(err)
|
||||
}
|
||||
return users, nil
|
||||
}
|
||||
|
||||
func (d *db) getUsersPage(page, pageSize int) (list []*entity.User, total int64, err error) {
|
||||
count, err := d.Limit(pageSize, page*pageSize).FindAndCount(&list)
|
||||
return list, count, gin.ToError(err)
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
package demo
|
||||
|
||||
import (
|
||||
"github.com/gone-io/gone"
|
||||
"net/http"
|
||||
"web-mysql/internal/interface/domain"
|
||||
"web-mysql/internal/interface/entity"
|
||||
)
|
||||
|
||||
//go:gone
|
||||
func NewDemoService() gone.Goner {
|
||||
return &demoService{}
|
||||
}
|
||||
|
||||
type demoService struct {
|
||||
gone.Flag
|
||||
db iDb `gone:"*"`
|
||||
}
|
||||
|
||||
func (svc *demoService) Show() (*domain.DemoEntity, error) {
|
||||
return &domain.DemoEntity{Info: "hello, this is a demo."}, nil
|
||||
}
|
||||
|
||||
func (svc *demoService) Error() (any, error) {
|
||||
return nil, gone.NewParameterError("parameter error1", Error1)
|
||||
}
|
||||
|
||||
func (svc *demoService) Echo(input string) (string, error) {
|
||||
return input, nil
|
||||
}
|
||||
|
||||
func (svc *demoService) CreateUser(user *domain.User) error {
|
||||
return svc.db.createUser(&entity.User{
|
||||
Id: user.Id,
|
||||
Name: user.Name,
|
||||
Email: user.Email,
|
||||
})
|
||||
}
|
||||
func (svc *demoService) GetUserById(userId int64) (*domain.User, error) {
|
||||
user, err := svc.db.getUser(userId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if user == nil {
|
||||
return nil, gone.NewParameterError("user not found", UserNotFound, http.StatusFound)
|
||||
}
|
||||
return &domain.User{
|
||||
Id: user.Id,
|
||||
Name: user.Name,
|
||||
Email: user.Email,
|
||||
}, nil
|
||||
}
|
||||
func (svc *demoService) ListUsers() ([]*domain.User, error) {
|
||||
users, err := svc.db.getUserList()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var list []*domain.User
|
||||
for _, user := range users {
|
||||
list = append(list, &domain.User{
|
||||
Id: user.Id,
|
||||
Name: user.Name,
|
||||
Email: user.Email,
|
||||
})
|
||||
}
|
||||
return list, nil
|
||||
}
|
||||
func (svc *demoService) UpdateUserById(userId int64, user *domain.User) error {
|
||||
return svc.db.updateUser(&entity.User{
|
||||
Id: userId,
|
||||
Name: user.Name,
|
||||
Email: user.Email,
|
||||
})
|
||||
}
|
||||
func (svc *demoService) DeleteUser(userId int64) error {
|
||||
return svc.db.deleteUser(userId)
|
||||
}
|
||||
|
||||
func (svc *demoService) PageUsers(query domain.PageQuery) (*domain.Page[domain.User], error) {
|
||||
list, total, err := svc.db.getUsersPage(query.Page, query.PageSize)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var page domain.Page[domain.User]
|
||||
|
||||
page.Total = total
|
||||
|
||||
for _, user := range list {
|
||||
page.List = append(page.List, &domain.User{
|
||||
Id: user.Id,
|
||||
Name: user.Name,
|
||||
Email: user.Email,
|
||||
})
|
||||
|
||||
}
|
||||
return &page, nil
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
package demo
|
||||
|
||||
import "web-mysql/internal/pkg/utils"
|
||||
|
||||
const ModuleId = 1
|
||||
|
||||
const (
|
||||
Error1 = utils.AppId*utils.AppModuleNumber*utils.ModuleErrNumber + ModuleId*utils.ModuleErrNumber + iota
|
||||
UserNotFound
|
||||
)
|
@ -1,12 +0,0 @@
|
||||
package demo
|
||||
|
||||
import "web-mysql/internal/interface/entity"
|
||||
|
||||
type iDb interface {
|
||||
createUser(user *entity.User) error
|
||||
getUser(id int64) (*entity.User, error)
|
||||
updateUser(user *entity.User) error
|
||||
deleteUser(id int64) error
|
||||
getUserList() ([]*entity.User, error)
|
||||
getUsersPage(page, pageSize int) (list []*entity.User, total int64, err error)
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package utils
|
||||
|
||||
// AppId 定义应用Id
|
||||
const AppId = 1
|
||||
|
||||
const AppModuleNumber = 1000
|
||||
const ModuleErrNumber = 1000
|
||||
|
||||
// PubModuleId 公共错误空间的模块Id
|
||||
const PubModuleId = 0
|
||||
|
||||
const (
|
||||
//Unauthorized 未授权
|
||||
Unauthorized = AppId*AppModuleNumber*ModuleErrNumber + PubModuleId*ModuleErrNumber + iota
|
||||
|
||||
//ParameterParseError 参数解析错误
|
||||
ParameterParseError
|
||||
)
|
@ -1,20 +0,0 @@
|
||||
// Code generated by gone; DO NOT EDIT.
|
||||
package internal
|
||||
import (
|
||||
"web-mysql/internal/controller"
|
||||
"web-mysql/internal/middleware"
|
||||
"web-mysql/internal/module/demo"
|
||||
"web-mysql/internal/router"
|
||||
"github.com/gone-io/gone"
|
||||
)
|
||||
|
||||
func Priest(cemetery gone.Cemetery) error {
|
||||
cemetery.Bury(controller.NewDemoController())
|
||||
cemetery.Bury(middleware.NewAuthorizeMiddleware())
|
||||
cemetery.Bury(middleware.NewPlantMiddleware())
|
||||
cemetery.Bury(demo.NewDb())
|
||||
cemetery.Bury(demo.NewDemoService())
|
||||
cemetery.Bury(router.NewAuth())
|
||||
cemetery.Bury(router.NewPubRouter())
|
||||
return nil
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/gone-io/gone"
|
||||
"web-mysql/internal/middleware"
|
||||
)
|
||||
|
||||
const IdAuthRouter = "router-auth"
|
||||
|
||||
//go:gone
|
||||
func NewAuth() (gone.Goner, gone.GonerId) {
|
||||
return &authRouter{}, IdAuthRouter
|
||||
}
|
||||
|
||||
type authRouter struct {
|
||||
gone.Flag
|
||||
gone.IRouter
|
||||
root gone.RouteGroup `gone:"*"`
|
||||
|
||||
auth *middleware.AuthorizeMiddleware `gone:"*"`
|
||||
pub *middleware.PubMiddleware `gone:"*"`
|
||||
}
|
||||
|
||||
func (r *authRouter) AfterRevive() gone.AfterReviveError {
|
||||
r.IRouter = r.root.Group("/api", r.pub.Next, r.auth.Next)
|
||||
return nil
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/gone-io/gone"
|
||||
"web-mysql/internal/middleware"
|
||||
)
|
||||
|
||||
const IdRouterPub = "router-pub"
|
||||
|
||||
//go:gone
|
||||
func NewPubRouter() (gone.Goner, gone.GonerId) {
|
||||
return &pubRouter{}, IdRouterPub
|
||||
}
|
||||
|
||||
type pubRouter struct {
|
||||
gone.Flag
|
||||
gone.IRouter
|
||||
root gone.RouteGroup `gone:"*"`
|
||||
pub *middleware.PubMiddleware `gone:"*"`
|
||||
}
|
||||
|
||||
func (r *pubRouter) AfterRevive() gone.AfterReviveError {
|
||||
r.IRouter = r.root.Group("/api", r.pub.Next)
|
||||
return nil
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
create table user
|
||||
(
|
||||
id int primary key auto_increment,
|
||||
name varchar(64),
|
||||
email varchar(255),
|
||||
created_at datetime default current_timestamp,
|
||||
updated_at datetime default current_timestamp on update current_timestamp,
|
||||
deleted_at datetime
|
||||
);
|
@ -1,115 +0,0 @@
|
||||
### 鉴权失败
|
||||
GET http://localhost:8080/api/demo/show
|
||||
|
||||
> {%
|
||||
client.test("Request executed successfully", function() {
|
||||
client.assert(response.status === 401, "Response status is not 401");
|
||||
});
|
||||
|
||||
|
||||
client.test("error code is 1000000", function() {
|
||||
client.assert(1000000 == response.body.code, "code is error");
|
||||
});
|
||||
%}
|
||||
|
||||
### 鉴权成功
|
||||
GET http://localhost:8080/api/demo/show?auth=pass
|
||||
|
||||
> {%
|
||||
client.test("Request executed successfully", function() {
|
||||
client.assert(response.status === 200, "Response status is not 200");
|
||||
});
|
||||
|
||||
|
||||
client.test("error code is 1000000", function() {
|
||||
client.assert(0 == response.body.code, "code is error");
|
||||
});
|
||||
%}
|
||||
|
||||
### 无需鉴权
|
||||
GET http://localhost:8080/api/demo2/show
|
||||
|
||||
> {%
|
||||
client.test("Request executed successfully", function() {
|
||||
client.assert(response.status === 200, "Response status is not 200");
|
||||
});
|
||||
|
||||
|
||||
client.test("error code is 1000000", function() {
|
||||
client.assert(0 == response.body.code, "code is error");
|
||||
});
|
||||
%}
|
||||
|
||||
|
||||
### 错误
|
||||
GET http://localhost:8080/api/demo2/error
|
||||
|
||||
> {%
|
||||
client.test("Request executed successfully", function() {
|
||||
client.assert(response.status === 400, "Response status is not 400");
|
||||
});
|
||||
|
||||
|
||||
client.test("error code is 1000000", function() {
|
||||
client.assert(1001000 == response.body.code, "code is error");
|
||||
});
|
||||
%}
|
||||
|
||||
### echo api
|
||||
GET http://localhost:8080/api/demo2/echo?echo=info
|
||||
|
||||
> {%
|
||||
client.test("Request executed successfully", function() {
|
||||
client.assert(response.status === 200, "Response status is not 200");
|
||||
});
|
||||
|
||||
|
||||
client.test("error code is 1000000", function() {
|
||||
client.assert(0 == response.body.code, "code is error");
|
||||
});
|
||||
|
||||
client.test("echo data is info", function() {
|
||||
client.assert('info' == response.body.data, "code is error");
|
||||
});
|
||||
%}
|
||||
|
||||
### inject-query
|
||||
GET http://localhost:8080/api/inject-query?key=100&key=200
|
||||
|
||||
### inject-url-define-param
|
||||
GET http://localhost:8080/api/inject/100
|
||||
|
||||
### inject-http-body json
|
||||
POST http://localhost:8080/api/inject-http-body
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"echo":"hello"
|
||||
}
|
||||
|
||||
### inject-http-body xml
|
||||
POST http://localhost:8080/api/inject-http-body
|
||||
Content-Type: application/xml
|
||||
|
||||
<xml>
|
||||
<echo>hello</echo>
|
||||
</xml>
|
||||
|
||||
### inject-http-body form-data
|
||||
POST http://localhost:8080/api/inject-http-body
|
||||
Content-Type: multipart/form-data; boundary=WebAppBoundary
|
||||
|
||||
--WebAppBoundary
|
||||
Content-Disposition: form-data; name="echo"
|
||||
|
||||
hello
|
||||
|
||||
|
||||
### inject-http-body x-www-form-urlencoded
|
||||
POST http://localhost:8080/api/inject-http-body
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
|
||||
echo=hello
|
||||
|
||||
### inject-http-struct
|
||||
GET http://localhost:8080/api/inject-http-struct
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"dev": {
|
||||
"host": "http://localhost:8080"
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
### 创建用户
|
||||
POST {{host}}/api/users HTTP/1.1
|
||||
content-type: application/json
|
||||
|
||||
{
|
||||
"name": "degfy",
|
||||
"email": "degfy@hotmail.com"
|
||||
}
|
||||
|
||||
### 获取用户
|
||||
GET {{host}}/api/users/1 HTTP/1.1
|
||||
|
||||
### 获取用户列表
|
||||
GET {{host}}/api/users HTTP/1.1
|
||||
|
||||
### 获取用户分页
|
||||
GET {{host}}/api/users/page?page=0&pageSize=10 HTTP/1.1
|
||||
|
||||
### 更新用户
|
||||
PUT {{host}}/api/users/1 HTTP/1.1
|
||||
content-type: application/json
|
||||
|
||||
{
|
||||
"name": "dapeng",
|
||||
"email": "degfy@hotmail.com"
|
||||
}
|
||||
|
||||
### 删除用户
|
||||
DELETE {{host}}/api/users/1 HTTP/1.1
|
@ -1,2 +0,0 @@
|
||||
tests
|
||||
*.md
|
2
templates/web/.gitignore
vendored
2
templates/web/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
bin
|
||||
internal/priest.go
|
@ -1,35 +0,0 @@
|
||||
FROM golang:1.22-alpine3.19 as builder
|
||||
WORKDIR /app
|
||||
|
||||
RUN sed 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' -i /etc/apk/repositories && \
|
||||
apk add make git
|
||||
|
||||
ENV GO111MODULE=on \
|
||||
GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
COPY ["go.mod", "go.sum", "Makefile", "./"]
|
||||
|
||||
RUN --mount=type=cache,target=/go,id=go go mod download
|
||||
|
||||
COPY cmd cmd
|
||||
COPY internal internal
|
||||
|
||||
#编译
|
||||
RUN --mount=type=cache,target=/go,id=go make build
|
||||
|
||||
FROM alpine:3.19
|
||||
RUN sed 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' -i /etc/apk/repositories && \
|
||||
apk update && \
|
||||
apk add tzdata && \
|
||||
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
||||
echo "Asia/Shanghai" > /etc/timezone
|
||||
|
||||
WORKDIR /app
|
||||
COPY config config
|
||||
COPY --from=builder /app/bin/server /app/server
|
||||
|
||||
ARG ENVIRONMENT=dev
|
||||
ENV ENV=${ENVIRONMENT}
|
||||
|
||||
CMD ./server
|
||||
EXPOSE 8080
|
@ -1,32 +0,0 @@
|
||||
gone:
|
||||
make install-gone
|
||||
go mod tidy
|
||||
go generate ./...
|
||||
|
||||
run:
|
||||
make gone
|
||||
go run cmd/server/main.go
|
||||
|
||||
build:
|
||||
make gone
|
||||
go build -ldflags="-w -s" -tags musl -o bin/server cmd/server/main.go
|
||||
|
||||
|
||||
build-docker:
|
||||
docker-compose build
|
||||
|
||||
run-in-docker:
|
||||
docker-comopose up
|
||||
|
||||
|
||||
# for test
|
||||
test:
|
||||
make install-mockgen
|
||||
make gone
|
||||
go test ./... -v
|
||||
|
||||
install-gone:
|
||||
go install github.com/gone-io/gone/tools/gone@latest
|
||||
|
||||
install-mockgen:
|
||||
go install github.com/golang/mock/mockgen@latest
|
@ -1,71 +0,0 @@
|
||||
# ${{appName}}
|
||||
|
||||
|
||||
## 目录结构:
|
||||
|
||||
```
|
||||
.
|
||||
├── README.md
|
||||
├── go.mod
|
||||
├── go.sum
|
||||
├── docker-compose.yaml # compose文件,通过在当前目录执行 `docker-compose up` 可以运行代码
|
||||
├── Dockerfile # 用于镜像编译
|
||||
├── Makefile # Makefile,定义了 run、build、test 等命令
|
||||
├── bin
|
||||
│ └── server # 项目编译后的二进制文件
|
||||
├── cmd
|
||||
│ └── server
|
||||
│ └── main.go
|
||||
├── config # 配置目录
|
||||
│ ├── default.properties # 默认配置
|
||||
│ ├── local.properties # 本地开发配置,不设置环境变量,会使用该配置
|
||||
│ ├── dev.properties # 开发环境配置,可以用于部署到开发环境的服务器上
|
||||
│ └── prod.properties # 生产环境配置,用于部署到生产环境使用
|
||||
├── internal
|
||||
│ ├── master.go # 主 Preist 函数,用于加载框架基础依赖(本项目只依赖了 goner/gin ) 和 内部 Priest 函数
|
||||
│ ├── priest.go # 运行 make gone 生成的文件,包括一个Priest函数,用于安葬(加载)所有内部的Goner组件
|
||||
│ ├── interface # 接口包,可以包含 domain 、event、 service 等子包
|
||||
│ │ ├── domain # 用于定义业务对象(实体对象、值对象、聚合根等)
|
||||
│ │ │ ├── demo.go
|
||||
│ │ │ └── user.go
|
||||
│ │ └── service # 内部接口包,用于管理内部接口定义
|
||||
│ │ └── i_demo.go # IDemo 接口
|
||||
│ ├── middleware # 中间件包,用于定义中间件
|
||||
│ │ ├── authorize.go
|
||||
│ │ └── pub.go
|
||||
│ ├── module # 模块
|
||||
│ │ └── demo # demo模块,一般情况下,一个模块与service包下的一个文件对应,实现其中定义的接口
|
||||
│ │ ├── demo_svc.go # 实现 IDemo 接口
|
||||
│ │ └── error.go # 模块内的错误编码定义
|
||||
│ ├── controller # controller目录,用于定义http服务接口
|
||||
│ │ └── demo_ctr.go # demo controller
|
||||
│ ├── pkg
|
||||
│ │ └── utils
|
||||
│ │ └── error.go # 定义全局错误编码
|
||||
│ └── router
|
||||
│ ├── auth_router.go # 定义需要鉴权的路由
|
||||
│ └── pub_router.go # 定义不需要鉴权的路由
|
||||
└── tests # 全局测试目录
|
||||
└── api # 接口测试
|
||||
└── demo.http # demo接口测试
|
||||
```
|
||||
|
||||
## 命令
|
||||
|
||||
> 假设已经安装了Golang环境
|
||||
> 下列命令使用Makefile定义,系统中需要安装Make(参考[安装make](https://blog.csdn.net/waitdeng/article/details/138849321))
|
||||
|
||||
- `make gone`
|
||||
用于生成Priest代码,在IED中运行前**⚠️必须先执行**该命令,否则代码不完整无法运行
|
||||
|
||||
- `make run`
|
||||
运行代码,已经集成了`make gone`
|
||||
|
||||
- `make build`
|
||||
编译项目
|
||||
- `make build-docker`
|
||||
编译docker镜像,假设已经安装 [docker](https://www.docker.com/)
|
||||
和 [docker-compose](https://docs.docker.com/compose/install/)
|
||||
- `make run-in-docker`
|
||||
在docker中运行,假设已经安装 [docker](https://www.docker.com/)
|
||||
和 [docker-compose](https://docs.docker.com/compose/install/)
|
@ -1,13 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"demo-structure/internal"
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/gone-io/gone/goner/tracer"
|
||||
)
|
||||
|
||||
func main() {
|
||||
tracer.SetTraceId("", func() {
|
||||
gone.Serve(internal.MasterPriest)
|
||||
})
|
||||
}
|
@ -1 +0,0 @@
|
||||
auth.user-key=user
|
@ -1 +0,0 @@
|
||||
server.env=dev
|
@ -1,2 +0,0 @@
|
||||
# 本地开发环境会读取该文件的配置
|
||||
server.env=dev
|
@ -1 +0,0 @@
|
||||
server.env=prod
|
@ -1,11 +0,0 @@
|
||||
version: '3'
|
||||
services:
|
||||
web:
|
||||
image: demo-structure
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
ENVIRONMENT: prod
|
||||
restart: always
|
||||
ports:
|
||||
- "8080:8080"
|
@ -1,7 +0,0 @@
|
||||
module demo-structure
|
||||
|
||||
go 1.21
|
||||
|
||||
toolchain go1.21.1
|
||||
|
||||
require github.com/gone-io/gone latest
|
@ -1,59 +0,0 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"demo-structure/internal/interface/service"
|
||||
"demo-structure/internal/pkg/utils"
|
||||
"github.com/gone-io/gone"
|
||||
)
|
||||
|
||||
//go:gone
|
||||
func NewDemoController() gone.Goner {
|
||||
return &demoController{}
|
||||
}
|
||||
|
||||
type demoController struct {
|
||||
gone.Flag
|
||||
demoSvc service.IDemo `gone:"*"`
|
||||
|
||||
authRouter gone.IRouter `gone:"router-auth"`
|
||||
pubRouter gone.IRouter `gone:"router-pub"`
|
||||
}
|
||||
|
||||
func (ctr *demoController) Mount() gone.GinMountError {
|
||||
|
||||
//需要鉴权的路由分组
|
||||
ctr.
|
||||
authRouter.
|
||||
Group("/demo").
|
||||
GET("/show", ctr.showDemo)
|
||||
|
||||
//不需要鉴权的路由分组
|
||||
ctr.
|
||||
pubRouter.
|
||||
Group("/demo2").
|
||||
GET("/show", ctr.showDemo).
|
||||
GET("/error", ctr.error).
|
||||
GET("/echo", ctr.echo)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ctr *demoController) showDemo(ctx *gone.Context) (any, error) {
|
||||
return ctr.demoSvc.Show()
|
||||
}
|
||||
|
||||
func (ctr *demoController) error(ctx *gone.Context) (any, error) {
|
||||
return ctr.demoSvc.Error()
|
||||
}
|
||||
|
||||
func (ctr *demoController) echo(ctx *gone.Context) (any, error) {
|
||||
type Req struct {
|
||||
Echo string `form:"echo"`
|
||||
}
|
||||
|
||||
var req Req
|
||||
if err := ctx.Bind(&req); err != nil {
|
||||
return nil, gone.NewParameterError(err.Error(), utils.ParameterParseError)
|
||||
}
|
||||
return ctr.demoSvc.Echo(req.Echo)
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package domain
|
||||
|
||||
type DemoEntity struct {
|
||||
Info string `json:"info"`
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package domain
|
||||
|
||||
type User struct {
|
||||
Id int64
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package service
|
||||
|
||||
import "demo-structure/internal/interface/domain"
|
||||
|
||||
type IDemo interface {
|
||||
Show() (*domain.DemoEntity, error)
|
||||
Echo(input string) (string, error)
|
||||
Error() (any, error)
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"github.com/gone-io/gone"
|
||||
"github.com/gone-io/gone/goner"
|
||||
)
|
||||
|
||||
//go:generate gone priest -s . -p $GOPACKAGE -f Priest -o priest.go
|
||||
func MasterPriest(cemetery gone.Cemetery) error {
|
||||
_ = goner.GinPriest(cemetery)
|
||||
|
||||
_ = Priest(cemetery)
|
||||
return nil
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"demo-structure/internal/interface/domain"
|
||||
"demo-structure/internal/pkg/utils"
|
||||
"github.com/gone-io/gone"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
//go:gone
|
||||
func NewAuthorizeMiddleware() gone.Goner {
|
||||
return &AuthorizeMiddleware{}
|
||||
}
|
||||
|
||||
type AuthorizeMiddleware struct {
|
||||
gone.Flag
|
||||
gone.Logger `gone:"*"`
|
||||
userKey string `gone:"config,auth.user-key"`
|
||||
}
|
||||
|
||||
func (m *AuthorizeMiddleware) Next(ctx *gone.Context) (any, error) {
|
||||
if userId, err := checkToken(ctx); err != nil {
|
||||
ctx.JSON(http.StatusUnauthorized, map[string]any{
|
||||
"code": err.Code(),
|
||||
"msg": err.Msg(),
|
||||
})
|
||||
ctx.Abort()
|
||||
} else {
|
||||
m.Debugf("userId:%v", userId)
|
||||
ctx.Set(m.userKey, userId)
|
||||
ctx.Next()
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func checkToken(ctx *gone.Context) (*domain.User, gone.Error) {
|
||||
//todo 修改该函数,实现鉴权的相关逻辑
|
||||
|
||||
if ctx.Query("auth") == "pass" {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, gone.NewParameterError("Unauthorized", utils.Unauthorized)
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/gone-io/gone"
|
||||
)
|
||||
|
||||
//go:gone
|
||||
func NewPlantMiddleware() gone.Goner {
|
||||
return &PubMiddleware{}
|
||||
}
|
||||
|
||||
// PubMiddleware 公共中间件
|
||||
type PubMiddleware struct {
|
||||
gone.Flag
|
||||
gone.Logger `gone:"*"`
|
||||
}
|
||||
|
||||
func (m *PubMiddleware) Next(ctx *gone.Context) (interface{}, error) {
|
||||
m.Infof("public middleware: %s", ctx.Request.URL)
|
||||
//todo
|
||||
return nil, nil
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package demo
|
||||
|
||||
import (
|
||||
"demo-structure/internal/interface/domain"
|
||||
"github.com/gone-io/gone"
|
||||
)
|
||||
|
||||
//go:gone
|
||||
func NewDemoService() gone.Goner {
|
||||
return &demoService{}
|
||||
}
|
||||
|
||||
type demoService struct {
|
||||
gone.Flag
|
||||
}
|
||||
|
||||
func (svc *demoService) Show() (*domain.DemoEntity, error) {
|
||||
return &domain.DemoEntity{Info: "hello, this is a demo."}, nil
|
||||
}
|
||||
|
||||
func (svc *demoService) Error() (any, error) {
|
||||
return nil, gone.NewParameterError("parameter error1", Error1)
|
||||
}
|
||||
|
||||
func (svc *demoService) Echo(input string) (string, error) {
|
||||
return input, nil
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package demo
|
||||
|
||||
import "demo-structure/internal/pkg/utils"
|
||||
|
||||
const ModuleId = 1
|
||||
|
||||
const (
|
||||
Error1 = utils.AppId*utils.AppModuleNumber*utils.ModuleErrNumber + ModuleId*utils.ModuleErrNumber + iota
|
||||
Error2
|
||||
Error3
|
||||
)
|
@ -1,18 +0,0 @@
|
||||
package utils
|
||||
|
||||
// AppId 定义应用Id
|
||||
const AppId = 1
|
||||
|
||||
const AppModuleNumber = 1000
|
||||
const ModuleErrNumber = 1000
|
||||
|
||||
// PubModuleId 公共错误空间的模块Id
|
||||
const PubModuleId = 0
|
||||
|
||||
const (
|
||||
//Unauthorized 未授权
|
||||
Unauthorized = AppId*AppModuleNumber*ModuleErrNumber + PubModuleId*ModuleErrNumber + iota
|
||||
|
||||
//ParameterParseError 参数解析错误
|
||||
ParameterParseError
|
||||
)
|
@ -1,27 +0,0 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"demo-structure/internal/middleware"
|
||||
"github.com/gone-io/gone"
|
||||
)
|
||||
|
||||
const IdAuthRouter = "router-auth"
|
||||
|
||||
//go:gone
|
||||
func NewAuth() (gone.Goner, gone.GonerId) {
|
||||
return &authRouter{}, IdAuthRouter
|
||||
}
|
||||
|
||||
type authRouter struct {
|
||||
gone.Flag
|
||||
gone.IRouter
|
||||
root gone.RouteGroup `gone:"*"`
|
||||
|
||||
auth *middleware.AuthorizeMiddleware `gone:"*"`
|
||||
pub *middleware.PubMiddleware `gone:"*"`
|
||||
}
|
||||
|
||||
func (r *authRouter) AfterRevive() gone.AfterReviveError {
|
||||
r.IRouter = r.root.Group("/api", r.pub.Next, r.auth.Next)
|
||||
return nil
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"demo-structure/internal/middleware"
|
||||
"github.com/gone-io/gone"
|
||||
)
|
||||
|
||||
const IdRouterPub = "router-pub"
|
||||
|
||||
//go:gone
|
||||
func NewPubRouter() (gone.Goner, gone.GonerId) {
|
||||
return &pubRouter{}, IdRouterPub
|
||||
}
|
||||
|
||||
type pubRouter struct {
|
||||
gone.Flag
|
||||
gone.IRouter
|
||||
root gone.IRouter `gone:"gone-gin-router"`
|
||||
pub *middleware.PubMiddleware `gone:"*"`
|
||||
}
|
||||
|
||||
func (r *pubRouter) AfterRevive() gone.AfterReviveError {
|
||||
r.IRouter = r.root.Group("/api", r.pub.Next)
|
||||
return nil
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
### 鉴权失败
|
||||
GET http://localhost:8080/api/demo/show
|
||||
|
||||
> {%
|
||||
client.test("Request executed successfully", function() {
|
||||
client.assert(response.status === 401, "Response status is not 401");
|
||||
});
|
||||
|
||||
|
||||
client.test("error code is 1000000", function() {
|
||||
client.assert(1000000 == response.body.code, "code is error");
|
||||
});
|
||||
%}
|
||||
|
||||
### 鉴权成功
|
||||
GET http://localhost:8080/api/demo/show?auth=pass
|
||||
|
||||
> {%
|
||||
client.test("Request executed successfully", function() {
|
||||
client.assert(response.status === 200, "Response status is not 200");
|
||||
});
|
||||
|
||||
|
||||
client.test("error code is 1000000", function() {
|
||||
client.assert(0 == response.body.code, "code is error");
|
||||
});
|
||||
%}
|
||||
|
||||
### 无需鉴权
|
||||
GET http://localhost:8080/api/demo2/show
|
||||
|
||||
> {%
|
||||
client.test("Request executed successfully", function() {
|
||||
client.assert(response.status === 200, "Response status is not 200");
|
||||
});
|
||||
|
||||
|
||||
client.test("error code is 1000000", function() {
|
||||
client.assert(0 == response.body.code, "code is error");
|
||||
});
|
||||
%}
|
||||
|
||||
|
||||
### 错误
|
||||
GET http://localhost:8080/api/demo2/error
|
||||
|
||||
> {%
|
||||
client.test("Request executed successfully", function() {
|
||||
client.assert(response.status === 400, "Response status is not 400");
|
||||
});
|
||||
|
||||
|
||||
client.test("error code is 1000000", function() {
|
||||
client.assert(1001000 == response.body.code, "code is error");
|
||||
});
|
||||
%}
|
||||
|
||||
### echo api
|
||||
GET http://localhost:8080/api/demo2/echo?echo=info
|
||||
|
||||
> {%
|
||||
client.test("Request executed successfully", function() {
|
||||
client.assert(response.status === 200, "Response status is not 200");
|
||||
});
|
||||
|
||||
|
||||
client.test("error code is 1000000", function() {
|
||||
client.assert(0 == response.body.code, "code is error");
|
||||
});
|
||||
|
||||
client.test("echo data is info", function() {
|
||||
client.assert('info' == response.body.data, "code is error");
|
||||
});
|
||||
%}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user