mirror of
https://github.com/zhufuyi/sponge.git
synced 2025-10-05 16:57:07 +08:00
adjustment code
This commit is contained in:
4
.github/RELEASE.md
vendored
4
.github/RELEASE.md
vendored
@@ -1,4 +1,4 @@
|
|||||||
## Change log
|
## Change log
|
||||||
|
|
||||||
- Fix `⓶ create grpc service based on sql`, selecting multiple tables to generate code reports **unsupported db driver error**.
|
- Upgrade `go.opentelemetry.io/otel` and `golang.org/x/crypto` third-party libraries.
|
||||||
- The mongodb json tag supports both shake case and camel case naming.
|
- Adjusting the order of import packages.
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
If you are develop RESTful web service or microservice with a simple CRUD API interface, you don't need to write any Go code can be compiled and deployed to the linux server, docker, k8s, just need to connect to the database (mysql、mongodb、postgresql、tidb、sqlite) to generate a complete service code.
|
If you are develop RESTful web service or microservice with a simple CRUD API interface, you don't need to write any Go code can be compiled and deployed to the linux server, docker, k8s, just need to connect to the database (mysql、mongodb、postgresql、tidb、sqlite) to generate a complete service code.
|
||||||
|
|
||||||
If you develop generic web or microservices, just focus on the three core parts of `define database tables`, `define api interfaces in proto files`, `fill in business logic code in the generated template files`, and the rest of the go code is automatically generated by sponge.
|
If you develop generic web or microservices, just focus on the three core parts of `define tables in the database`, `define api interfaces in the proto files`, `fill in business logic code in the generated template files`, and the rest of the go code is automatically generated by sponge.
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
如果开发只有简单CRUD api接口的web或微服务,不需要编写任何go代码就可以编译并部署到linux服务器、docker、k8s上,只需要连接到数据库(mysql、mongodb、postgresql、tidb、sqlite)就可以一键自动生成完整的服务代码。
|
如果开发只有简单CRUD api接口的web或微服务,不需要编写任何go代码就可以编译并部署到linux服务器、docker、k8s上,只需要连接到数据库(mysql、mongodb、postgresql、tidb、sqlite)就可以一键自动生成完整的服务代码。
|
||||||
|
|
||||||
如果开发通用的web或微服务,只需聚焦在`定义数据库表`、`在proto文件定义api接口`、`在生成的模板文件填写业务逻辑代码`三个核心部分,其他go代码都由sponge自动生成。
|
如果开发通用的web或微服务,只需聚焦在`在数据库定义表`、`在proto文件定义api接口`、`在生成的模板文件填写业务逻辑代码`三个核心部分,其他go代码都由sponge自动生成。
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
@@ -4,9 +4,9 @@ package handler
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/parse"
|
|
||||||
|
|
||||||
"google.golang.org/protobuf/compiler/protogen"
|
"google.golang.org/protobuf/compiler/protogen"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/parse"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GenerateFiles generate handler logic, router, error code files.
|
// GenerateFiles generate handler logic, router, error code files.
|
||||||
|
@@ -5,10 +5,10 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/parse"
|
|
||||||
|
|
||||||
"google.golang.org/protobuf/compiler/protogen"
|
"google.golang.org/protobuf/compiler/protogen"
|
||||||
"google.golang.org/protobuf/types/descriptorpb"
|
"google.golang.org/protobuf/types/descriptorpb"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/parse"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@@ -4,9 +4,9 @@ package service
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/parse"
|
|
||||||
|
|
||||||
"google.golang.org/protobuf/compiler/protogen"
|
"google.golang.org/protobuf/compiler/protogen"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/parse"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GenerateFiles generate service logic, router, error code files.
|
// GenerateFiles generate service logic, router, error code files.
|
||||||
|
@@ -10,12 +10,12 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"google.golang.org/protobuf/compiler/protogen"
|
||||||
|
"google.golang.org/protobuf/types/pluginpb"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/generate/handler"
|
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/generate/handler"
|
||||||
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/generate/router"
|
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/generate/router"
|
||||||
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/generate/service"
|
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/generate/service"
|
||||||
|
|
||||||
"google.golang.org/protobuf/compiler/protogen"
|
|
||||||
"google.golang.org/protobuf/types/pluginpb"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@@ -6,9 +6,9 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-rpc-tmpl/internal/parse"
|
|
||||||
|
|
||||||
"google.golang.org/protobuf/compiler/protogen"
|
"google.golang.org/protobuf/compiler/protogen"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-rpc-tmpl/internal/parse"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GenerateFiles generate service template code and error codes
|
// GenerateFiles generate service template code and error codes
|
||||||
|
@@ -10,10 +10,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-rpc-tmpl/internal/generate/service"
|
|
||||||
|
|
||||||
"google.golang.org/protobuf/compiler/protogen"
|
"google.golang.org/protobuf/compiler/protogen"
|
||||||
"google.golang.org/protobuf/types/pluginpb"
|
"google.golang.org/protobuf/types/pluginpb"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-rpc-tmpl/internal/generate/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@@ -4,11 +4,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Close releasing resources after service exit
|
// Close releasing resources after service exit
|
||||||
|
@@ -5,15 +5,15 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
"github.com/zhufuyi/sponge/internal/server"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
"github.com/zhufuyi/sponge/internal/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateServices create grpc or http service
|
// CreateServices create grpc or http service
|
||||||
|
@@ -8,9 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/configs"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/conf"
|
"github.com/zhufuyi/sponge/pkg/conf"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
@@ -18,7 +16,9 @@ import (
|
|||||||
"github.com/zhufuyi/sponge/pkg/stat"
|
"github.com/zhufuyi/sponge/pkg/stat"
|
||||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||||
|
|
||||||
"github.com/jinzhu/copier"
|
"github.com/zhufuyi/sponge/configs"
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/zhufuyi/sponge/cmd/serverNameExample_grpcExample/initial"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/serverNameExample_grpcExample/initial"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@@ -4,11 +4,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
//"github.com/zhufuyi/sponge/internal/rpcclient"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
//"github.com/zhufuyi/sponge/internal/rpcclient"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Close releasing resources after service exit
|
// Close releasing resources after service exit
|
||||||
|
@@ -5,15 +5,15 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
"github.com/zhufuyi/sponge/internal/server"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
"github.com/zhufuyi/sponge/internal/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateServices create grpc or http service
|
// CreateServices create grpc or http service
|
||||||
|
@@ -8,10 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/configs"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
|
|
||||||
//"github.com/zhufuyi/sponge/internal/rpcclient"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/conf"
|
"github.com/zhufuyi/sponge/pkg/conf"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
@@ -19,7 +16,9 @@ import (
|
|||||||
"github.com/zhufuyi/sponge/pkg/stat"
|
"github.com/zhufuyi/sponge/pkg/stat"
|
||||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||||
|
|
||||||
"github.com/jinzhu/copier"
|
"github.com/zhufuyi/sponge/configs"
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
//"github.com/zhufuyi/sponge/internal/rpcclient"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/zhufuyi/sponge/cmd/serverNameExample_grpcGwPbExample/initial"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/serverNameExample_grpcGwPbExample/initial"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@@ -4,11 +4,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
//"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
//"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Close releasing resources after service exit
|
// Close releasing resources after service exit
|
||||||
|
@@ -5,15 +5,15 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
"github.com/zhufuyi/sponge/internal/server"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
"github.com/zhufuyi/sponge/internal/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateServices create grpc or http service
|
// CreateServices create grpc or http service
|
||||||
|
@@ -8,10 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/configs"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
|
|
||||||
//"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/conf"
|
"github.com/zhufuyi/sponge/pkg/conf"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
@@ -19,7 +16,9 @@ import (
|
|||||||
"github.com/zhufuyi/sponge/pkg/stat"
|
"github.com/zhufuyi/sponge/pkg/stat"
|
||||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||||
|
|
||||||
"github.com/jinzhu/copier"
|
"github.com/zhufuyi/sponge/configs"
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
//"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/zhufuyi/sponge/cmd/serverNameExample_grpcPbExample/initial"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/serverNameExample_grpcPbExample/initial"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@@ -4,11 +4,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Close releasing resources after service exit
|
// Close releasing resources after service exit
|
||||||
|
@@ -5,15 +5,15 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
"github.com/zhufuyi/sponge/internal/server"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
"github.com/zhufuyi/sponge/internal/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateServices create grpc or http service
|
// CreateServices create grpc or http service
|
||||||
|
@@ -8,9 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/configs"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/conf"
|
"github.com/zhufuyi/sponge/pkg/conf"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
@@ -18,7 +16,9 @@ import (
|
|||||||
"github.com/zhufuyi/sponge/pkg/stat"
|
"github.com/zhufuyi/sponge/pkg/stat"
|
||||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||||
|
|
||||||
"github.com/jinzhu/copier"
|
"github.com/zhufuyi/sponge/configs"
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/zhufuyi/sponge/cmd/serverNameExample_httpExample/initial"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/serverNameExample_httpExample/initial"
|
||||||
)
|
)
|
||||||
|
|
||||||
// @title serverNameExample api docs
|
// @title serverNameExample api docs
|
||||||
|
@@ -4,11 +4,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
//"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
//"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Close releasing resources after service exit
|
// Close releasing resources after service exit
|
||||||
|
@@ -5,15 +5,15 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
"github.com/zhufuyi/sponge/internal/server"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
"github.com/zhufuyi/sponge/internal/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateServices create grpc or http service
|
// CreateServices create grpc or http service
|
||||||
|
@@ -8,10 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/configs"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
|
|
||||||
//"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/conf"
|
"github.com/zhufuyi/sponge/pkg/conf"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
@@ -19,7 +16,9 @@ import (
|
|||||||
"github.com/zhufuyi/sponge/pkg/stat"
|
"github.com/zhufuyi/sponge/pkg/stat"
|
||||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||||
|
|
||||||
"github.com/jinzhu/copier"
|
"github.com/zhufuyi/sponge/configs"
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
//"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/zhufuyi/sponge/cmd/serverNameExample_httpPbExample/initial"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/serverNameExample_httpPbExample/initial"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@@ -4,11 +4,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Close releasing resources after service exit
|
// Close releasing resources after service exit
|
||||||
|
@@ -5,15 +5,15 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
"github.com/zhufuyi/sponge/internal/server"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
"github.com/zhufuyi/sponge/internal/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateServices create grpc or http service
|
// CreateServices create grpc or http service
|
||||||
|
@@ -8,9 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/configs"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/conf"
|
"github.com/zhufuyi/sponge/pkg/conf"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
@@ -18,7 +16,9 @@ import (
|
|||||||
"github.com/zhufuyi/sponge/pkg/stat"
|
"github.com/zhufuyi/sponge/pkg/stat"
|
||||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||||
|
|
||||||
"github.com/jinzhu/copier"
|
"github.com/zhufuyi/sponge/configs"
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/zhufuyi/sponge/cmd/serverNameExample_mixExample/initial"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/serverNameExample_mixExample/initial"
|
||||||
)
|
)
|
||||||
|
|
||||||
// @title serverNameExample api docs
|
// @title serverNameExample api docs
|
||||||
|
@@ -4,9 +4,9 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CacheCommand generate cache code
|
// CacheCommand generate cache code
|
||||||
|
@@ -11,10 +11,10 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/huandu/xstrings"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
|
|
||||||
"github.com/huandu/xstrings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@@ -8,10 +8,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||||
"github.com/zhufuyi/sponge/pkg/jy2struct"
|
"github.com/zhufuyi/sponge/pkg/jy2struct"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ConfigCommand convert yaml to struct command
|
// ConfigCommand convert yaml to struct command
|
||||||
|
@@ -4,10 +4,10 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
|
||||||
|
|
||||||
"github.com/huandu/xstrings"
|
"github.com/huandu/xstrings"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ConfigmapCommand generate k8s configmap command
|
// ConfigmapCommand generate k8s configmap command
|
||||||
|
@@ -5,11 +5,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
"github.com/zhufuyi/sponge/pkg/sql2code"
|
"github.com/zhufuyi/sponge/pkg/sql2code"
|
||||||
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// DaoCommand generate dao code
|
// DaoCommand generate dao code
|
||||||
|
@@ -6,12 +6,12 @@ import (
|
|||||||
"math/rand"
|
"math/rand"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
"github.com/zhufuyi/sponge/pkg/sql2code"
|
"github.com/zhufuyi/sponge/pkg/sql2code"
|
||||||
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// HandlerPbCommand generate handler and protobuf code
|
// HandlerPbCommand generate handler and protobuf code
|
||||||
|
@@ -6,11 +6,11 @@ import (
|
|||||||
"math/rand"
|
"math/rand"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
"github.com/zhufuyi/sponge/pkg/sql2code"
|
"github.com/zhufuyi/sponge/pkg/sql2code"
|
||||||
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// HandlerCommand generate handler code
|
// HandlerCommand generate handler code
|
||||||
|
@@ -4,10 +4,10 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
|
||||||
|
|
||||||
"github.com/huandu/xstrings"
|
"github.com/huandu/xstrings"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HTTPPbCommand generate web service code based on protobuf file
|
// HTTPPbCommand generate web service code based on protobuf file
|
||||||
|
@@ -6,12 +6,12 @@ import (
|
|||||||
"math/rand"
|
"math/rand"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/huandu/xstrings"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
"github.com/zhufuyi/sponge/pkg/sql2code"
|
"github.com/zhufuyi/sponge/pkg/sql2code"
|
||||||
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
||||||
|
|
||||||
"github.com/huandu/xstrings"
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// HTTPCommand generate web service code
|
// HTTPCommand generate web service code
|
||||||
|
@@ -5,11 +5,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
"github.com/zhufuyi/sponge/pkg/sql2code"
|
"github.com/zhufuyi/sponge/pkg/sql2code"
|
||||||
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ModelCommand generate model code
|
// ModelCommand generate model code
|
||||||
|
@@ -5,12 +5,12 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
"github.com/zhufuyi/sponge/pkg/sql2code"
|
"github.com/zhufuyi/sponge/pkg/sql2code"
|
||||||
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ProtobufCommand generate protobuf code
|
// ProtobufCommand generate protobuf code
|
||||||
|
@@ -5,9 +5,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GRPCConnectionCommand generate grpc connection code
|
// GRPCConnectionCommand generate grpc connection code
|
||||||
|
@@ -4,10 +4,10 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
|
||||||
|
|
||||||
"github.com/huandu/xstrings"
|
"github.com/huandu/xstrings"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RPCGwPbCommand generate grpc gateway service code base on protobuf file
|
// RPCGwPbCommand generate grpc gateway service code base on protobuf file
|
||||||
|
@@ -4,10 +4,10 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
|
||||||
|
|
||||||
"github.com/huandu/xstrings"
|
"github.com/huandu/xstrings"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RPCPbCommand generate grpc service code bash on protobuf file
|
// RPCPbCommand generate grpc service code bash on protobuf file
|
||||||
|
@@ -6,13 +6,13 @@ import (
|
|||||||
"math/rand"
|
"math/rand"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/huandu/xstrings"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
"github.com/zhufuyi/sponge/pkg/sql2code"
|
"github.com/zhufuyi/sponge/pkg/sql2code"
|
||||||
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
||||||
|
|
||||||
"github.com/huandu/xstrings"
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// RPCCommand generate grpc service code
|
// RPCCommand generate grpc service code
|
||||||
|
@@ -6,12 +6,12 @@ import (
|
|||||||
"math/rand"
|
"math/rand"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
"github.com/zhufuyi/sponge/pkg/sql2code"
|
"github.com/zhufuyi/sponge/pkg/sql2code"
|
||||||
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServiceCommand generate service code
|
// ServiceCommand generate service code
|
||||||
|
@@ -8,9 +8,9 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ConvertSwagJSONCommand convert 64-bit fields type string to integer
|
// ConvertSwagJSONCommand convert 64-bit fields type string to integer
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
package commands
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/merge"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/sponge/commands/merge"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MergeCommand merge the generated code
|
// MergeCommand merge the generated code
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
package commands
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GenMicroCommand generate micro service code
|
// GenMicroCommand generate micro service code
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
package commands
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/patch"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/sponge/commands/patch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PatchCommand patch server code
|
// PatchCommand patch server code
|
||||||
|
@@ -11,10 +11,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gobash"
|
"github.com/zhufuyi/sponge/pkg/gobash"
|
||||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var copyCount = 0
|
var copyCount = 0
|
||||||
|
@@ -5,9 +5,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeleteJSONOmitemptyCommand delete json omitempty
|
// DeleteJSONOmitemptyCommand delete json omitempty
|
||||||
|
@@ -5,11 +5,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
||||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// GenerateDBInitCommand generate database initialization code
|
// GenerateDBInitCommand generate database initialization code
|
||||||
|
@@ -5,11 +5,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
||||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// GenMysqlInitCommand generate mysql initialization code
|
// GenMysqlInitCommand generate mysql initialization code
|
||||||
|
@@ -5,11 +5,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
||||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// GenTypesPbCommand generate types.proto code
|
// GenTypesPbCommand generate types.proto code
|
||||||
|
@@ -10,10 +10,10 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||||
"github.com/zhufuyi/sponge/pkg/krand"
|
"github.com/zhufuyi/sponge/pkg/krand"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@@ -8,9 +8,9 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gobash"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/pkg/gobash"
|
||||||
)
|
)
|
||||||
|
|
||||||
var pluginNames = []string{
|
var pluginNames = []string{
|
||||||
@@ -31,7 +31,7 @@ var pluginNames = []string{
|
|||||||
|
|
||||||
var installPluginCommands = map[string]string{
|
var installPluginCommands = map[string]string{
|
||||||
"go": "go: please install manually yourself, download url is https://go.dev/dl/ or https://golang.google.cn/dl/",
|
"go": "go: please install manually yourself, download url is https://go.dev/dl/ or https://golang.google.cn/dl/",
|
||||||
"protoc": "protoc: please install manually yourself, download url is https://github.com/protocolbuffers/protobuf/releases/tag/v3.20.3",
|
"protoc": "protoc: please install manually yourself, download url is https://github.com/protocolbuffers/protobuf/releases/tag/v25.2",
|
||||||
"protoc-gen-go": "google.golang.org/protobuf/cmd/protoc-gen-go@latest",
|
"protoc-gen-go": "google.golang.org/protobuf/cmd/protoc-gen-go@latest",
|
||||||
"protoc-gen-go-grpc": "google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest",
|
"protoc-gen-go-grpc": "google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest",
|
||||||
"protoc-gen-validate": "github.com/envoyproxy/protoc-gen-validate@latest",
|
"protoc-gen-validate": "github.com/envoyproxy/protoc-gen-validate@latest",
|
||||||
|
@@ -5,9 +5,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -9,9 +9,9 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/cmd/sponge/server"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/sponge/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OpenUICommand open the sponge UI interface
|
// OpenUICommand open the sponge UI interface
|
||||||
|
@@ -8,11 +8,11 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gobash"
|
"github.com/zhufuyi/sponge/pkg/gobash"
|
||||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// UpgradeCommand upgrade sponge binaries
|
// UpgradeCommand upgrade sponge binaries
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
package commands
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GenWebCommand generate web server code
|
// GenWebCommand generate web server code
|
||||||
|
@@ -8,9 +8,10 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/cmd/sponge/commands"
|
"github.com/zhufuyi/sponge/cmd/sponge/commands"
|
||||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
||||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@@ -13,6 +13,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/errcode"
|
"github.com/zhufuyi/sponge/pkg/errcode"
|
||||||
"github.com/zhufuyi/sponge/pkg/ggorm"
|
"github.com/zhufuyi/sponge/pkg/ggorm"
|
||||||
"github.com/zhufuyi/sponge/pkg/gin/response"
|
"github.com/zhufuyi/sponge/pkg/gin/response"
|
||||||
@@ -21,9 +24,6 @@ import (
|
|||||||
"github.com/zhufuyi/sponge/pkg/krand"
|
"github.com/zhufuyi/sponge/pkg/krand"
|
||||||
"github.com/zhufuyi/sponge/pkg/mgo"
|
"github.com/zhufuyi/sponge/pkg/mgo"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -11,13 +11,13 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/gin-gonic/gin/binding"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gin/handlerfunc"
|
"github.com/zhufuyi/sponge/pkg/gin/handlerfunc"
|
||||||
"github.com/zhufuyi/sponge/pkg/gin/middleware"
|
"github.com/zhufuyi/sponge/pkg/gin/middleware"
|
||||||
"github.com/zhufuyi/sponge/pkg/gin/validator"
|
"github.com/zhufuyi/sponge/pkg/gin/validator"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"github.com/gin-gonic/gin/binding"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed static
|
//go:embed static
|
||||||
|
@@ -85,7 +85,7 @@ logger:
|
|||||||
# delete the templates code start
|
# delete the templates code start
|
||||||
# database setting
|
# database setting
|
||||||
database:
|
database:
|
||||||
driver: "mysql" # database driver, currently support mysql, postgres, tidb, sqlite
|
driver: "mysql" # database driver, currently support mysql, postgresql, tidb, sqlite
|
||||||
# mysql settings
|
# mysql settings
|
||||||
mysql:
|
mysql:
|
||||||
# dsn format, <username>:<password>@(<hostname>:<port>)/<db>?[k=v& ......]
|
# dsn format, <username>:<password>@(<hostname>:<port>)/<db>?[k=v& ......]
|
||||||
|
4
internal/cache/cacheNameExample.go
vendored
4
internal/cache/cacheNameExample.go
vendored
@@ -6,10 +6,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/cache"
|
"github.com/zhufuyi/sponge/pkg/cache"
|
||||||
"github.com/zhufuyi/sponge/pkg/encoding"
|
"github.com/zhufuyi/sponge/pkg/encoding"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
// delete the templates code start
|
// delete the templates code start
|
||||||
|
4
internal/cache/cacheNameExample_test.go
vendored
4
internal/cache/cacheNameExample_test.go
vendored
@@ -4,12 +4,12 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gotest"
|
"github.com/zhufuyi/sponge/pkg/gotest"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
type cacheNameExampleData struct {
|
type cacheNameExampleData struct {
|
||||||
|
4
internal/cache/userExample.go
vendored
4
internal/cache/userExample.go
vendored
@@ -5,11 +5,11 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/cache"
|
"github.com/zhufuyi/sponge/pkg/cache"
|
||||||
"github.com/zhufuyi/sponge/pkg/encoding"
|
"github.com/zhufuyi/sponge/pkg/encoding"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
4
internal/cache/userExample.go.mgo
vendored
4
internal/cache/userExample.go.mgo
vendored
@@ -5,10 +5,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/cache"
|
"github.com/zhufuyi/sponge/pkg/cache"
|
||||||
"github.com/zhufuyi/sponge/pkg/encoding"
|
"github.com/zhufuyi/sponge/pkg/encoding"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
4
internal/cache/userExample_test.go
vendored
4
internal/cache/userExample_test.go
vendored
@@ -4,12 +4,12 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gotest"
|
"github.com/zhufuyi/sponge/pkg/gotest"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newUserExampleCache() *gotest.Cache {
|
func newUserExampleCache() *gotest.Cache {
|
||||||
|
@@ -6,18 +6,18 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/cache"
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
cacheBase "github.com/zhufuyi/sponge/pkg/cache"
|
|
||||||
"github.com/zhufuyi/sponge/pkg/mgo"
|
|
||||||
"github.com/zhufuyi/sponge/pkg/mgo/query"
|
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
"go.mongodb.org/mongo-driver/mongo/options"
|
"go.mongodb.org/mongo-driver/mongo/options"
|
||||||
"golang.org/x/sync/singleflight"
|
"golang.org/x/sync/singleflight"
|
||||||
|
|
||||||
|
cacheBase "github.com/zhufuyi/sponge/pkg/cache"
|
||||||
|
"github.com/zhufuyi/sponge/pkg/mgo"
|
||||||
|
"github.com/zhufuyi/sponge/pkg/mgo/query"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/cache"
|
||||||
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ UserExampleDao = (*userExampleDao)(nil)
|
var _ UserExampleDao = (*userExampleDao)(nil)
|
||||||
|
@@ -5,16 +5,16 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/cache"
|
"github.com/DATA-DOG/go-sqlmock"
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/ggorm/query"
|
"github.com/zhufuyi/sponge/pkg/ggorm/query"
|
||||||
"github.com/zhufuyi/sponge/pkg/gotest"
|
"github.com/zhufuyi/sponge/pkg/gotest"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/DATA-DOG/go-sqlmock"
|
"github.com/zhufuyi/sponge/internal/cache"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func newUserExampleDao() *gotest.Dao {
|
func newUserExampleDao() *gotest.Dao {
|
||||||
|
@@ -4,19 +4,19 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/cache"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/zhufuyi/sponge/internal/dao"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/zhufuyi/sponge/internal/ecode"
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
"github.com/zhufuyi/sponge/internal/types"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gin/middleware"
|
"github.com/zhufuyi/sponge/pkg/gin/middleware"
|
||||||
"github.com/zhufuyi/sponge/pkg/gin/response"
|
"github.com/zhufuyi/sponge/pkg/gin/response"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/zhufuyi/sponge/internal/cache"
|
||||||
"github.com/jinzhu/copier"
|
"github.com/zhufuyi/sponge/internal/dao"
|
||||||
|
"github.com/zhufuyi/sponge/internal/ecode"
|
||||||
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
|
"github.com/zhufuyi/sponge/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ UserExampleHandler = (*userExampleHandler)(nil)
|
var _ UserExampleHandler = (*userExampleHandler)(nil)
|
||||||
|
@@ -3,19 +3,19 @@ package handler
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/cache"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/zhufuyi/sponge/internal/dao"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/zhufuyi/sponge/internal/ecode"
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
"github.com/zhufuyi/sponge/internal/types"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gin/middleware"
|
"github.com/zhufuyi/sponge/pkg/gin/middleware"
|
||||||
"github.com/zhufuyi/sponge/pkg/gin/response"
|
"github.com/zhufuyi/sponge/pkg/gin/response"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/zhufuyi/sponge/internal/cache"
|
||||||
"github.com/jinzhu/copier"
|
"github.com/zhufuyi/sponge/internal/dao"
|
||||||
|
"github.com/zhufuyi/sponge/internal/ecode"
|
||||||
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
|
"github.com/zhufuyi/sponge/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ UserExampleHandler = (*userExampleHandler)(nil)
|
var _ UserExampleHandler = (*userExampleHandler)(nil)
|
||||||
|
@@ -6,17 +6,17 @@ import (
|
|||||||
"math"
|
"math"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/zhufuyi/sponge/internal/cache"
|
|
||||||
"github.com/zhufuyi/sponge/internal/dao"
|
|
||||||
"github.com/zhufuyi/sponge/internal/ecode"
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/ggorm/query"
|
"github.com/zhufuyi/sponge/pkg/ggorm/query"
|
||||||
"github.com/zhufuyi/sponge/pkg/gin/middleware"
|
"github.com/zhufuyi/sponge/pkg/gin/middleware"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
|
|
||||||
"github.com/jinzhu/copier"
|
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
|
||||||
|
"github.com/zhufuyi/sponge/internal/cache"
|
||||||
|
"github.com/zhufuyi/sponge/internal/dao"
|
||||||
|
"github.com/zhufuyi/sponge/internal/ecode"
|
||||||
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ serverNameExampleV1.UserExampleLogicer = (*userExamplePbHandler)(nil)
|
var _ serverNameExampleV1.UserExampleLogicer = (*userExamplePbHandler)(nil)
|
||||||
|
@@ -5,17 +5,17 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/zhufuyi/sponge/internal/cache"
|
|
||||||
"github.com/zhufuyi/sponge/internal/dao"
|
|
||||||
"github.com/zhufuyi/sponge/internal/ecode"
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gin/middleware"
|
"github.com/zhufuyi/sponge/pkg/gin/middleware"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
"github.com/zhufuyi/sponge/pkg/mgo/query"
|
"github.com/zhufuyi/sponge/pkg/mgo/query"
|
||||||
|
|
||||||
"github.com/jinzhu/copier"
|
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
|
||||||
|
"github.com/zhufuyi/sponge/internal/cache"
|
||||||
|
"github.com/zhufuyi/sponge/internal/dao"
|
||||||
|
"github.com/zhufuyi/sponge/internal/ecode"
|
||||||
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ serverNameExampleV1.UserExampleLogicer = (*userExamplePbHandler)(nil)
|
var _ serverNameExampleV1.UserExampleLogicer = (*userExamplePbHandler)(nil)
|
||||||
|
@@ -5,22 +5,22 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
|
"github.com/DATA-DOG/go-sqlmock"
|
||||||
"github.com/zhufuyi/sponge/internal/cache"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/zhufuyi/sponge/internal/dao"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/zhufuyi/sponge/internal/ecode"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
"github.com/zhufuyi/sponge/api/types"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gin/response"
|
"github.com/zhufuyi/sponge/pkg/gin/response"
|
||||||
"github.com/zhufuyi/sponge/pkg/gohttp"
|
"github.com/zhufuyi/sponge/pkg/gohttp"
|
||||||
"github.com/zhufuyi/sponge/pkg/gotest"
|
"github.com/zhufuyi/sponge/pkg/gotest"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/DATA-DOG/go-sqlmock"
|
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/zhufuyi/sponge/internal/cache"
|
||||||
"github.com/jinzhu/copier"
|
"github.com/zhufuyi/sponge/internal/dao"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/zhufuyi/sponge/internal/ecode"
|
||||||
"github.com/zhufuyi/sponge/api/types"
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newUserExamplePbHandler() *gotest.Handler {
|
func newUserExamplePbHandler() *gotest.Handler {
|
||||||
|
@@ -5,19 +5,19 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/cache"
|
"github.com/DATA-DOG/go-sqlmock"
|
||||||
"github.com/zhufuyi/sponge/internal/dao"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/zhufuyi/sponge/internal/types"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/ggorm/query"
|
"github.com/zhufuyi/sponge/pkg/ggorm/query"
|
||||||
"github.com/zhufuyi/sponge/pkg/gohttp"
|
"github.com/zhufuyi/sponge/pkg/gohttp"
|
||||||
"github.com/zhufuyi/sponge/pkg/gotest"
|
"github.com/zhufuyi/sponge/pkg/gotest"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/DATA-DOG/go-sqlmock"
|
"github.com/zhufuyi/sponge/internal/cache"
|
||||||
"github.com/jinzhu/copier"
|
"github.com/zhufuyi/sponge/internal/dao"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
|
"github.com/zhufuyi/sponge/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newUserExampleHandler() *gotest.Handler {
|
func newUserExampleHandler() *gotest.Handler {
|
||||||
|
@@ -6,15 +6,15 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
"github.com/go-redis/redis/v8"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/ggorm"
|
"github.com/zhufuyi/sponge/pkg/ggorm"
|
||||||
"github.com/zhufuyi/sponge/pkg/goredis"
|
"github.com/zhufuyi/sponge/pkg/goredis"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -5,15 +5,15 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
"github.com/go-redis/redis/v8"
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/goredis"
|
"github.com/zhufuyi/sponge/pkg/goredis"
|
||||||
"github.com/zhufuyi/sponge/pkg/mgo"
|
"github.com/zhufuyi/sponge/pkg/mgo"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// MaxObjectID max object id
|
// MaxObjectID max object id
|
||||||
|
@@ -5,12 +5,12 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/configs"
|
"github.com/zhufuyi/sponge/configs"
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetDB(t *testing.T) {
|
func TestGetDB(t *testing.T) {
|
||||||
|
@@ -5,8 +5,10 @@ package routers
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/docs"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
"github.com/gin-gonic/gin/binding"
|
||||||
|
swaggerFiles "github.com/swaggo/files"
|
||||||
|
ginSwagger "github.com/swaggo/gin-swagger"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/errcode"
|
"github.com/zhufuyi/sponge/pkg/errcode"
|
||||||
"github.com/zhufuyi/sponge/pkg/gin/handlerfunc"
|
"github.com/zhufuyi/sponge/pkg/gin/handlerfunc"
|
||||||
@@ -17,10 +19,8 @@ import (
|
|||||||
"github.com/zhufuyi/sponge/pkg/jwt"
|
"github.com/zhufuyi/sponge/pkg/jwt"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/zhufuyi/sponge/docs"
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
swaggerFiles "github.com/swaggo/files"
|
|
||||||
ginSwagger "github.com/swaggo/gin-swagger"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -4,8 +4,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/docs"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
"github.com/gin-gonic/gin/binding"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/errcode"
|
"github.com/zhufuyi/sponge/pkg/errcode"
|
||||||
"github.com/zhufuyi/sponge/pkg/gin/handlerfunc"
|
"github.com/zhufuyi/sponge/pkg/gin/handlerfunc"
|
||||||
@@ -17,8 +17,8 @@ import (
|
|||||||
"github.com/zhufuyi/sponge/pkg/jwt"
|
"github.com/zhufuyi/sponge/pkg/jwt"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/zhufuyi/sponge/docs"
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
type routeFns = []func(r *gin.Engine, groupPathMiddlewares map[string][]gin.HandlerFunc, singlePathMiddlewares map[string][]gin.HandlerFunc)
|
type routeFns = []func(r *gin.Engine, groupPathMiddlewares map[string][]gin.HandlerFunc, singlePathMiddlewares map[string][]gin.HandlerFunc)
|
||||||
|
@@ -5,15 +5,15 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/zhufuyi/sponge/configs"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gin/middleware"
|
"github.com/zhufuyi/sponge/pkg/gin/middleware"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/zhufuyi/sponge/configs"
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewRouter_pbExample(t *testing.T) {
|
func TestNewRouter_pbExample(t *testing.T) {
|
||||||
|
@@ -5,13 +5,13 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/configs"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/zhufuyi/sponge/configs"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewRouter(t *testing.T) {
|
func TestNewRouter(t *testing.T) {
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
package routers
|
package routers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/zhufuyi/sponge/internal/handler"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/internal/handler"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@@ -3,14 +3,14 @@ package routers
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/zhufuyi/sponge/internal/service"
|
"google.golang.org/grpc/metadata"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/gin/middleware"
|
"github.com/zhufuyi/sponge/pkg/gin/middleware"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
|
||||||
"google.golang.org/grpc/metadata"
|
"github.com/zhufuyi/sponge/internal/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@@ -7,7 +7,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/consulcli"
|
"github.com/zhufuyi/sponge/pkg/consulcli"
|
||||||
"github.com/zhufuyi/sponge/pkg/etcdcli"
|
"github.com/zhufuyi/sponge/pkg/etcdcli"
|
||||||
@@ -18,7 +18,7 @@ import (
|
|||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -5,12 +5,12 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/configs"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/zhufuyi/sponge/configs"
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewServerNameExampleRPCConn(t *testing.T) {
|
func TestNewServerNameExampleRPCConn(t *testing.T) {
|
||||||
|
@@ -8,9 +8,10 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
|
||||||
"github.com/zhufuyi/sponge/internal/ecode"
|
"google.golang.org/grpc"
|
||||||
"github.com/zhufuyi/sponge/internal/service"
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
"github.com/zhufuyi/sponge/pkg/errcode"
|
"github.com/zhufuyi/sponge/pkg/errcode"
|
||||||
@@ -21,10 +22,9 @@ import (
|
|||||||
"github.com/zhufuyi/sponge/pkg/prof"
|
"github.com/zhufuyi/sponge/pkg/prof"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
||||||
|
|
||||||
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
"google.golang.org/grpc"
|
"github.com/zhufuyi/sponge/internal/ecode"
|
||||||
"google.golang.org/grpc/codes"
|
"github.com/zhufuyi/sponge/internal/service"
|
||||||
"google.golang.org/grpc/status"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ app.IServer = (*grpcServer)(nil)
|
var _ app.IServer = (*grpcServer)(nil)
|
||||||
|
@@ -7,15 +7,15 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/configs"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/grpc/gtls/certfile"
|
"github.com/zhufuyi/sponge/pkg/grpc/gtls/certfile"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/zhufuyi/sponge/configs"
|
||||||
"google.golang.org/grpc"
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGRPCServer(t *testing.T) {
|
func TestGRPCServer(t *testing.T) {
|
||||||
|
@@ -6,12 +6,12 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/internal/routers"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/app"
|
"github.com/zhufuyi/sponge/pkg/app"
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/zhufuyi/sponge/internal/routers"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ app.IServer = (*httpServer)(nil)
|
var _ app.IServer = (*httpServer)(nil)
|
||||||
@@ -59,7 +59,7 @@ func (s *httpServer) String() string {
|
|||||||
return "http service address " + s.addr
|
return "http service address " + s.addr
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewHTTPServer creates a new web server
|
// NewHTTPServer creates a new http server
|
||||||
func NewHTTPServer(addr string, opts ...HTTPOption) app.IServer {
|
func NewHTTPServer(addr string, opts ...HTTPOption) app.IServer {
|
||||||
o := defaultHTTPOptions()
|
o := defaultHTTPOptions()
|
||||||
o.apply(opts...)
|
o.apply(opts...)
|
||||||
|
@@ -7,14 +7,14 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/configs"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/zhufuyi/sponge/configs"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// need real database to test
|
// need real database to test
|
||||||
|
@@ -6,8 +6,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/configs"
|
"google.golang.org/grpc"
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/consulcli"
|
"github.com/zhufuyi/sponge/pkg/consulcli"
|
||||||
"github.com/zhufuyi/sponge/pkg/etcdcli"
|
"github.com/zhufuyi/sponge/pkg/etcdcli"
|
||||||
@@ -20,7 +19,8 @@ import (
|
|||||||
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
|
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
|
||||||
"github.com/zhufuyi/sponge/pkg/utils"
|
"github.com/zhufuyi/sponge/pkg/utils"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"github.com/zhufuyi/sponge/configs"
|
||||||
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRegisterAllService(t *testing.T) {
|
func TestRegisterAllService(t *testing.T) {
|
||||||
|
@@ -6,18 +6,18 @@ import (
|
|||||||
"math"
|
"math"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/zhufuyi/sponge/internal/cache"
|
"google.golang.org/grpc"
|
||||||
"github.com/zhufuyi/sponge/internal/dao"
|
|
||||||
"github.com/zhufuyi/sponge/internal/ecode"
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/ggorm/query"
|
"github.com/zhufuyi/sponge/pkg/ggorm/query"
|
||||||
"github.com/zhufuyi/sponge/pkg/grpc/interceptor"
|
"github.com/zhufuyi/sponge/pkg/grpc/interceptor"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
|
|
||||||
"github.com/jinzhu/copier"
|
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
|
||||||
"google.golang.org/grpc"
|
"github.com/zhufuyi/sponge/internal/cache"
|
||||||
|
"github.com/zhufuyi/sponge/internal/dao"
|
||||||
|
"github.com/zhufuyi/sponge/internal/ecode"
|
||||||
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@@ -5,18 +5,18 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/zhufuyi/sponge/internal/cache"
|
"google.golang.org/grpc"
|
||||||
"github.com/zhufuyi/sponge/internal/dao"
|
|
||||||
"github.com/zhufuyi/sponge/internal/ecode"
|
|
||||||
"github.com/zhufuyi/sponge/internal/model"
|
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/grpc/interceptor"
|
"github.com/zhufuyi/sponge/pkg/grpc/interceptor"
|
||||||
"github.com/zhufuyi/sponge/pkg/logger"
|
"github.com/zhufuyi/sponge/pkg/logger"
|
||||||
"github.com/zhufuyi/sponge/pkg/mgo/query"
|
"github.com/zhufuyi/sponge/pkg/mgo/query"
|
||||||
|
|
||||||
"github.com/jinzhu/copier"
|
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
|
||||||
"google.golang.org/grpc"
|
"github.com/zhufuyi/sponge/internal/cache"
|
||||||
|
"github.com/zhufuyi/sponge/internal/dao"
|
||||||
|
"github.com/zhufuyi/sponge/internal/ecode"
|
||||||
|
"github.com/zhufuyi/sponge/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@@ -7,12 +7,12 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/zhufuyi/sponge/pkg/grpc/benchmark"
|
||||||
|
|
||||||
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
|
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
|
||||||
"github.com/zhufuyi/sponge/api/types"
|
"github.com/zhufuyi/sponge/api/types"
|
||||||
"github.com/zhufuyi/sponge/configs"
|
"github.com/zhufuyi/sponge/configs"
|
||||||
"github.com/zhufuyi/sponge/internal/config"
|
"github.com/zhufuyi/sponge/internal/config"
|
||||||
|
|
||||||
"github.com/zhufuyi/sponge/pkg/grpc/benchmark"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Test each method of userExample via the rpc client
|
// Test each method of userExample via the rpc client
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user