adjustment code

This commit is contained in:
zhuyasen
2024-03-09 15:14:31 +08:00
parent 289af43d7b
commit 87bae7eee4
198 changed files with 521 additions and 523 deletions

4
.github/RELEASE.md vendored
View File

@@ -1,4 +1,4 @@
## Change log
- Fix `⓶ create grpc service based on sql`, selecting multiple tables to generate code reports **unsupported db driver error**.
- The mongodb json tag supports both shake case and camel case naming.
- Upgrade `go.opentelemetry.io/otel` and `golang.org/x/crypto` third-party libraries.
- Adjusting the order of import packages.

View File

@@ -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 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>

View File

@@ -5,7 +5,7 @@
如果开发只有简单CRUD api接口的web或微服务不需要编写任何go代码就可以编译并部署到linux服务器、docker、k8s上只需要连接到数据库(mysql、mongodb、postgresql、tidb、sqlite)就可以一键自动生成完整的服务代码。
如果开发通用的web或微服务只需聚焦在`定义数据库表``在proto文件定义api接口``在生成的模板文件填写业务逻辑代码`三个核心部分其他go代码都由sponge自动生成。
如果开发通用的web或微服务只需聚焦在`数据库定义表``在proto文件定义api接口``在生成的模板文件填写业务逻辑代码`三个核心部分其他go代码都由sponge自动生成。
<br>

View File

@@ -4,9 +4,9 @@ package handler
import (
"bytes"
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/parse"
"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.

View File

@@ -5,10 +5,10 @@ import (
"bytes"
"strings"
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/parse"
"google.golang.org/protobuf/compiler/protogen"
"google.golang.org/protobuf/types/descriptorpb"
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/parse"
)
const (

View File

@@ -4,9 +4,9 @@ package service
import (
"bytes"
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/parse"
"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.

View File

@@ -10,12 +10,12 @@ import (
"strings"
"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/router"
"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 (

View File

@@ -6,9 +6,9 @@ import (
"runtime"
"strings"
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-rpc-tmpl/internal/parse"
"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

View File

@@ -10,10 +10,10 @@ import (
"strings"
"time"
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-rpc-tmpl/internal/generate/service"
"google.golang.org/protobuf/compiler/protogen"
"google.golang.org/protobuf/types/pluginpb"
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-rpc-tmpl/internal/generate/service"
)
const (

View File

@@ -4,11 +4,11 @@ import (
"context"
"time"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/model"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/pkg/tracer"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/model"
)
// Close releasing resources after service exit

View File

@@ -5,15 +5,15 @@ import (
"strconv"
"time"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/server"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/pkg/logger"
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
"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

View File

@@ -8,9 +8,7 @@ import (
"fmt"
"strconv"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/model"
"github.com/jinzhu/copier"
"github.com/zhufuyi/sponge/pkg/conf"
"github.com/zhufuyi/sponge/pkg/logger"
@@ -18,7 +16,9 @@ import (
"github.com/zhufuyi/sponge/pkg/stat"
"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 (

View File

@@ -2,9 +2,9 @@
package main
import (
"github.com/zhufuyi/sponge/cmd/serverNameExample_grpcExample/initial"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/cmd/serverNameExample_grpcExample/initial"
)
func main() {

View File

@@ -4,11 +4,11 @@ import (
"context"
"time"
"github.com/zhufuyi/sponge/internal/config"
//"github.com/zhufuyi/sponge/internal/rpcclient"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/pkg/tracer"
"github.com/zhufuyi/sponge/internal/config"
//"github.com/zhufuyi/sponge/internal/rpcclient"
)
// Close releasing resources after service exit

View File

@@ -5,15 +5,15 @@ import (
"strconv"
"time"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/server"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/pkg/logger"
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
"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

View File

@@ -8,10 +8,7 @@ import (
"fmt"
"strconv"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
//"github.com/zhufuyi/sponge/internal/rpcclient"
"github.com/jinzhu/copier"
"github.com/zhufuyi/sponge/pkg/conf"
"github.com/zhufuyi/sponge/pkg/logger"
@@ -19,7 +16,9 @@ import (
"github.com/zhufuyi/sponge/pkg/stat"
"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 (

View File

@@ -2,9 +2,9 @@
package main
import (
"github.com/zhufuyi/sponge/cmd/serverNameExample_grpcGwPbExample/initial"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/cmd/serverNameExample_grpcGwPbExample/initial"
)
func main() {

View File

@@ -4,11 +4,11 @@ import (
"context"
"time"
"github.com/zhufuyi/sponge/internal/config"
//"github.com/zhufuyi/sponge/internal/model"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/pkg/tracer"
"github.com/zhufuyi/sponge/internal/config"
//"github.com/zhufuyi/sponge/internal/model"
)
// Close releasing resources after service exit

View File

@@ -5,15 +5,15 @@ import (
"strconv"
"time"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/server"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/pkg/logger"
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
"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

View File

@@ -8,10 +8,7 @@ import (
"fmt"
"strconv"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
//"github.com/zhufuyi/sponge/internal/model"
"github.com/jinzhu/copier"
"github.com/zhufuyi/sponge/pkg/conf"
"github.com/zhufuyi/sponge/pkg/logger"
@@ -19,7 +16,9 @@ import (
"github.com/zhufuyi/sponge/pkg/stat"
"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 (

View File

@@ -2,9 +2,9 @@
package main
import (
"github.com/zhufuyi/sponge/cmd/serverNameExample_grpcPbExample/initial"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/cmd/serverNameExample_grpcPbExample/initial"
)
func main() {

View File

@@ -4,11 +4,11 @@ import (
"context"
"time"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/model"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/pkg/tracer"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/model"
)
// Close releasing resources after service exit

View File

@@ -5,15 +5,15 @@ import (
"strconv"
"time"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/server"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/pkg/logger"
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
"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

View File

@@ -8,9 +8,7 @@ import (
"fmt"
"strconv"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/model"
"github.com/jinzhu/copier"
"github.com/zhufuyi/sponge/pkg/conf"
"github.com/zhufuyi/sponge/pkg/logger"
@@ -18,7 +16,9 @@ import (
"github.com/zhufuyi/sponge/pkg/stat"
"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 (

View File

@@ -2,9 +2,9 @@
package main
import (
"github.com/zhufuyi/sponge/cmd/serverNameExample_httpExample/initial"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/cmd/serverNameExample_httpExample/initial"
)
// @title serverNameExample api docs

View File

@@ -4,11 +4,11 @@ import (
"context"
"time"
"github.com/zhufuyi/sponge/internal/config"
//"github.com/zhufuyi/sponge/internal/model"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/pkg/tracer"
"github.com/zhufuyi/sponge/internal/config"
//"github.com/zhufuyi/sponge/internal/model"
)
// Close releasing resources after service exit

View File

@@ -5,15 +5,15 @@ import (
"strconv"
"time"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/server"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/pkg/logger"
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
"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

View File

@@ -8,10 +8,7 @@ import (
"fmt"
"strconv"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
//"github.com/zhufuyi/sponge/internal/model"
"github.com/jinzhu/copier"
"github.com/zhufuyi/sponge/pkg/conf"
"github.com/zhufuyi/sponge/pkg/logger"
@@ -19,7 +16,9 @@ import (
"github.com/zhufuyi/sponge/pkg/stat"
"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 (

View File

@@ -2,9 +2,9 @@
package main
import (
"github.com/zhufuyi/sponge/cmd/serverNameExample_httpPbExample/initial"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/cmd/serverNameExample_httpPbExample/initial"
)
func main() {

View File

@@ -4,11 +4,11 @@ import (
"context"
"time"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/model"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/pkg/tracer"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/model"
)
// Close releasing resources after service exit

View File

@@ -5,15 +5,15 @@ import (
"strconv"
"time"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/server"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/pkg/logger"
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
"github.com/zhufuyi/sponge/pkg/servicerd/registry/consul"
"github.com/zhufuyi/sponge/pkg/servicerd/registry/etcd"
"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

View File

@@ -8,9 +8,7 @@ import (
"fmt"
"strconv"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/model"
"github.com/jinzhu/copier"
"github.com/zhufuyi/sponge/pkg/conf"
"github.com/zhufuyi/sponge/pkg/logger"
@@ -18,7 +16,9 @@ import (
"github.com/zhufuyi/sponge/pkg/stat"
"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 (

View File

@@ -2,9 +2,9 @@
package main
import (
"github.com/zhufuyi/sponge/cmd/serverNameExample_mixExample/initial"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/cmd/serverNameExample_mixExample/initial"
)
// @title serverNameExample api docs

View File

@@ -4,9 +4,9 @@ import (
"errors"
"fmt"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/replacer"
)
// CacheCommand generate cache code

View File

@@ -11,10 +11,10 @@ import (
"regexp"
"strings"
"github.com/huandu/xstrings"
"github.com/zhufuyi/sponge/pkg/gofile"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/huandu/xstrings"
)
const (

View File

@@ -8,10 +8,10 @@ import (
"strings"
"time"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/gofile"
"github.com/zhufuyi/sponge/pkg/jy2struct"
"github.com/spf13/cobra"
)
// ConfigCommand convert yaml to struct command

View File

@@ -4,10 +4,10 @@ import (
"errors"
"fmt"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/huandu/xstrings"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/replacer"
)
// ConfigmapCommand generate k8s configmap command

View File

@@ -5,11 +5,11 @@ import (
"fmt"
"strings"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/zhufuyi/sponge/pkg/sql2code"
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
"github.com/spf13/cobra"
)
// DaoCommand generate dao code

View File

@@ -6,12 +6,12 @@ import (
"math/rand"
"strings"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/gofile"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/zhufuyi/sponge/pkg/sql2code"
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
"github.com/spf13/cobra"
)
// HandlerPbCommand generate handler and protobuf code

View File

@@ -6,11 +6,11 @@ import (
"math/rand"
"strings"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/zhufuyi/sponge/pkg/sql2code"
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
"github.com/spf13/cobra"
)
// HandlerCommand generate handler code

View File

@@ -4,10 +4,10 @@ import (
"errors"
"fmt"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/huandu/xstrings"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/replacer"
)
// HTTPPbCommand generate web service code based on protobuf file

View File

@@ -6,12 +6,12 @@ import (
"math/rand"
"strings"
"github.com/huandu/xstrings"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/zhufuyi/sponge/pkg/sql2code"
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
"github.com/huandu/xstrings"
"github.com/spf13/cobra"
)
// HTTPCommand generate web service code

View File

@@ -5,11 +5,11 @@ import (
"fmt"
"strings"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/zhufuyi/sponge/pkg/sql2code"
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
"github.com/spf13/cobra"
)
// ModelCommand generate model code

View File

@@ -5,12 +5,12 @@ import (
"fmt"
"strings"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/gofile"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/zhufuyi/sponge/pkg/sql2code"
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
"github.com/spf13/cobra"
)
// ProtobufCommand generate protobuf code

View File

@@ -5,9 +5,9 @@ import (
"fmt"
"strings"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/replacer"
)
// GRPCConnectionCommand generate grpc connection code

View File

@@ -4,10 +4,10 @@ import (
"errors"
"fmt"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/huandu/xstrings"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/replacer"
)
// RPCGwPbCommand generate grpc gateway service code base on protobuf file

View File

@@ -4,10 +4,10 @@ import (
"errors"
"fmt"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/huandu/xstrings"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/replacer"
)
// RPCPbCommand generate grpc service code bash on protobuf file

View File

@@ -6,13 +6,13 @@ import (
"math/rand"
"strings"
"github.com/huandu/xstrings"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/gofile"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/zhufuyi/sponge/pkg/sql2code"
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
"github.com/huandu/xstrings"
"github.com/spf13/cobra"
)
// RPCCommand generate grpc service code

View File

@@ -6,12 +6,12 @@ import (
"math/rand"
"strings"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/gofile"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/zhufuyi/sponge/pkg/sql2code"
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
"github.com/spf13/cobra"
)
// ServiceCommand generate service code

View File

@@ -8,9 +8,9 @@ import (
"os"
"strings"
"github.com/zhufuyi/sponge/pkg/gofile"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/gofile"
)
// ConvertSwagJSONCommand convert 64-bit fields type string to integer

View File

@@ -1,9 +1,9 @@
package commands
import (
"github.com/zhufuyi/sponge/cmd/sponge/commands/merge"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/cmd/sponge/commands/merge"
)
// MergeCommand merge the generated code

View File

@@ -1,9 +1,9 @@
package commands
import (
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
)
// GenMicroCommand generate micro service code

View File

@@ -1,9 +1,9 @@
package commands
import (
"github.com/zhufuyi/sponge/cmd/sponge/commands/patch"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/cmd/sponge/commands/patch"
)
// PatchCommand patch server code

View File

@@ -11,10 +11,10 @@ import (
"strings"
"time"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/gobash"
"github.com/zhufuyi/sponge/pkg/gofile"
"github.com/spf13/cobra"
)
var copyCount = 0

View File

@@ -5,9 +5,9 @@ import (
"fmt"
"os"
"github.com/zhufuyi/sponge/pkg/gofile"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/gofile"
)
// DeleteJSONOmitemptyCommand delete json omitempty

View File

@@ -5,11 +5,11 @@ import (
"fmt"
"strings"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
"github.com/zhufuyi/sponge/pkg/gofile"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/spf13/cobra"
)
// GenerateDBInitCommand generate database initialization code

View File

@@ -5,11 +5,11 @@ import (
"fmt"
"strings"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
"github.com/zhufuyi/sponge/pkg/gofile"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/spf13/cobra"
)
// GenMysqlInitCommand generate mysql initialization code

View File

@@ -5,11 +5,11 @@ import (
"fmt"
"strings"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
"github.com/zhufuyi/sponge/pkg/gofile"
"github.com/zhufuyi/sponge/pkg/replacer"
"github.com/spf13/cobra"
)
// GenTypesPbCommand generate types.proto code

View File

@@ -10,10 +10,10 @@ import (
"strconv"
"strings"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/gofile"
"github.com/zhufuyi/sponge/pkg/krand"
"github.com/spf13/cobra"
)
const (

View File

@@ -8,9 +8,9 @@ import (
"sync"
"time"
"github.com/zhufuyi/sponge/pkg/gobash"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/gobash"
)
var pluginNames = []string{
@@ -31,7 +31,7 @@ var pluginNames = []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/",
"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-grpc": "google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest",
"protoc-gen-validate": "github.com/envoyproxy/protoc-gen-validate@latest",

View File

@@ -5,9 +5,9 @@ import (
"fmt"
"os"
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
)
var (

View File

@@ -9,9 +9,9 @@ import (
"runtime"
"strconv"
"github.com/zhufuyi/sponge/cmd/sponge/server"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/cmd/sponge/server"
)
// OpenUICommand open the sponge UI interface

View File

@@ -8,11 +8,11 @@ import (
"strings"
"time"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/pkg/gobash"
"github.com/zhufuyi/sponge/pkg/gofile"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/spf13/cobra"
)
// UpgradeCommand upgrade sponge binaries

View File

@@ -1,9 +1,9 @@
package commands
import (
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
"github.com/spf13/cobra"
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
)
// GenWebCommand generate web server code

View File

@@ -8,9 +8,10 @@ import (
"fmt"
"os"
"github.com/zhufuyi/sponge/pkg/gofile"
"github.com/zhufuyi/sponge/cmd/sponge/commands"
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
"github.com/zhufuyi/sponge/pkg/gofile"
)
func main() {

View File

@@ -13,6 +13,9 @@ import (
"strings"
"time"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
"github.com/zhufuyi/sponge/pkg/errcode"
"github.com/zhufuyi/sponge/pkg/ggorm"
"github.com/zhufuyi/sponge/pkg/gin/response"
@@ -21,9 +24,6 @@ import (
"github.com/zhufuyi/sponge/pkg/krand"
"github.com/zhufuyi/sponge/pkg/mgo"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
)
var (

View File

@@ -11,13 +11,13 @@ import (
"path/filepath"
"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/middleware"
"github.com/zhufuyi/sponge/pkg/gin/validator"
"github.com/zhufuyi/sponge/pkg/logger"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
)
//go:embed static

View File

@@ -85,7 +85,7 @@ logger:
# delete the templates code start
# database setting
database:
driver: "mysql" # database driver, currently support mysql, postgres, tidb, sqlite
driver: "mysql" # database driver, currently support mysql, postgresql, tidb, sqlite
# mysql settings
mysql:
# dsn format, <username>:<password>@(<hostname>:<port>)/<db>?[k=v& ......]

View File

@@ -6,10 +6,10 @@ import (
"strings"
"time"
"github.com/zhufuyi/sponge/internal/model"
"github.com/zhufuyi/sponge/pkg/cache"
"github.com/zhufuyi/sponge/pkg/encoding"
"github.com/zhufuyi/sponge/internal/model"
)
// delete the templates code start

View File

@@ -4,12 +4,12 @@ import (
"testing"
"time"
"github.com/zhufuyi/sponge/internal/model"
"github.com/stretchr/testify/assert"
"github.com/zhufuyi/sponge/pkg/gotest"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/stretchr/testify/assert"
"github.com/zhufuyi/sponge/internal/model"
)
type cacheNameExampleData struct {

View File

@@ -5,11 +5,11 @@ import (
"strings"
"time"
"github.com/zhufuyi/sponge/internal/model"
"github.com/zhufuyi/sponge/pkg/cache"
"github.com/zhufuyi/sponge/pkg/encoding"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/zhufuyi/sponge/internal/model"
)
const (

View File

@@ -5,10 +5,10 @@ import (
"strings"
"time"
"github.com/zhufuyi/sponge/internal/model"
"github.com/zhufuyi/sponge/pkg/cache"
"github.com/zhufuyi/sponge/pkg/encoding"
"github.com/zhufuyi/sponge/internal/model"
)
const (

View File

@@ -4,12 +4,12 @@ import (
"testing"
"time"
"github.com/zhufuyi/sponge/internal/model"
"github.com/stretchr/testify/assert"
"github.com/zhufuyi/sponge/pkg/gotest"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/stretchr/testify/assert"
"github.com/zhufuyi/sponge/internal/model"
)
func newUserExampleCache() *gotest.Cache {

View File

@@ -6,18 +6,18 @@ import (
"fmt"
"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/primitive"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"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)

View File

@@ -5,16 +5,16 @@ import (
"testing"
"time"
"github.com/zhufuyi/sponge/internal/cache"
"github.com/zhufuyi/sponge/internal/model"
"github.com/DATA-DOG/go-sqlmock"
"github.com/stretchr/testify/assert"
"gorm.io/gorm"
"github.com/zhufuyi/sponge/pkg/ggorm/query"
"github.com/zhufuyi/sponge/pkg/gotest"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/DATA-DOG/go-sqlmock"
"github.com/stretchr/testify/assert"
"gorm.io/gorm"
"github.com/zhufuyi/sponge/internal/cache"
"github.com/zhufuyi/sponge/internal/model"
)
func newUserExampleDao() *gotest.Dao {

View File

@@ -4,19 +4,19 @@ import (
"errors"
"math"
"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/internal/types"
"github.com/gin-gonic/gin"
"github.com/jinzhu/copier"
"github.com/zhufuyi/sponge/pkg/gin/middleware"
"github.com/zhufuyi/sponge/pkg/gin/response"
"github.com/zhufuyi/sponge/pkg/logger"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/gin-gonic/gin"
"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/internal/types"
)
var _ UserExampleHandler = (*userExampleHandler)(nil)

View File

@@ -3,19 +3,19 @@ package handler
import (
"errors"
"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/internal/types"
"github.com/gin-gonic/gin"
"github.com/jinzhu/copier"
"github.com/zhufuyi/sponge/pkg/gin/middleware"
"github.com/zhufuyi/sponge/pkg/gin/response"
"github.com/zhufuyi/sponge/pkg/logger"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/gin-gonic/gin"
"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/internal/types"
)
var _ UserExampleHandler = (*userExampleHandler)(nil)

View File

@@ -6,17 +6,17 @@ import (
"math"
"strings"
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"
"github.com/jinzhu/copier"
"github.com/zhufuyi/sponge/pkg/ggorm/query"
"github.com/zhufuyi/sponge/pkg/gin/middleware"
"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)

View File

@@ -5,17 +5,17 @@ import (
"errors"
"strings"
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"
"github.com/jinzhu/copier"
"github.com/zhufuyi/sponge/pkg/gin/middleware"
"github.com/zhufuyi/sponge/pkg/logger"
"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)

View File

@@ -5,22 +5,22 @@ import (
"testing"
"time"
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"
"github.com/DATA-DOG/go-sqlmock"
"github.com/gin-gonic/gin"
"github.com/jinzhu/copier"
"github.com/stretchr/testify/assert"
"github.com/zhufuyi/sponge/api/types"
"github.com/zhufuyi/sponge/pkg/gin/response"
"github.com/zhufuyi/sponge/pkg/gohttp"
"github.com/zhufuyi/sponge/pkg/gotest"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/DATA-DOG/go-sqlmock"
"github.com/gin-gonic/gin"
"github.com/jinzhu/copier"
"github.com/stretchr/testify/assert"
"github.com/zhufuyi/sponge/api/types"
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"
)
func newUserExamplePbHandler() *gotest.Handler {

View File

@@ -5,19 +5,19 @@ import (
"testing"
"time"
"github.com/zhufuyi/sponge/internal/cache"
"github.com/zhufuyi/sponge/internal/dao"
"github.com/zhufuyi/sponge/internal/model"
"github.com/zhufuyi/sponge/internal/types"
"github.com/DATA-DOG/go-sqlmock"
"github.com/jinzhu/copier"
"github.com/stretchr/testify/assert"
"github.com/zhufuyi/sponge/pkg/ggorm/query"
"github.com/zhufuyi/sponge/pkg/gohttp"
"github.com/zhufuyi/sponge/pkg/gotest"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/DATA-DOG/go-sqlmock"
"github.com/jinzhu/copier"
"github.com/stretchr/testify/assert"
"github.com/zhufuyi/sponge/internal/cache"
"github.com/zhufuyi/sponge/internal/dao"
"github.com/zhufuyi/sponge/internal/model"
"github.com/zhufuyi/sponge/internal/types"
)
func newUserExampleHandler() *gotest.Handler {

View File

@@ -6,15 +6,15 @@ import (
"sync"
"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/goredis"
"github.com/zhufuyi/sponge/pkg/logger"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/go-redis/redis/v8"
"gorm.io/gorm"
"github.com/zhufuyi/sponge/internal/config"
)
var (

View File

@@ -5,15 +5,15 @@ import (
"sync"
"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/mgo"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/go-redis/redis/v8"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"github.com/zhufuyi/sponge/internal/config"
)
// MaxObjectID max object id

View File

@@ -5,12 +5,12 @@ import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"gorm.io/gorm"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/stretchr/testify/assert"
"gorm.io/gorm"
)
func TestGetDB(t *testing.T) {

View File

@@ -5,8 +5,10 @@ package routers
import (
"net/http"
"github.com/zhufuyi/sponge/docs"
"github.com/zhufuyi/sponge/internal/config"
"github.com/gin-gonic/gin"
"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/gin/handlerfunc"
@@ -17,10 +19,8 @@ import (
"github.com/zhufuyi/sponge/pkg/jwt"
"github.com/zhufuyi/sponge/pkg/logger"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
"github.com/zhufuyi/sponge/docs"
"github.com/zhufuyi/sponge/internal/config"
)
var (

View File

@@ -4,8 +4,8 @@ import (
"net/http"
"strings"
"github.com/zhufuyi/sponge/docs"
"github.com/zhufuyi/sponge/internal/config"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/zhufuyi/sponge/pkg/errcode"
"github.com/zhufuyi/sponge/pkg/gin/handlerfunc"
@@ -17,8 +17,8 @@ import (
"github.com/zhufuyi/sponge/pkg/jwt"
"github.com/zhufuyi/sponge/pkg/logger"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/zhufuyi/sponge/docs"
"github.com/zhufuyi/sponge/internal/config"
)
type routeFns = []func(r *gin.Engine, groupPathMiddlewares map[string][]gin.HandlerFunc, singlePathMiddlewares map[string][]gin.HandlerFunc)

View File

@@ -5,15 +5,15 @@ import (
"testing"
"time"
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"github.com/zhufuyi/sponge/pkg/gin/middleware"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
)
func TestNewRouter_pbExample(t *testing.T) {

View File

@@ -5,13 +5,13 @@ import (
"testing"
"time"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
)
func TestNewRouter(t *testing.T) {

View File

@@ -1,9 +1,9 @@
package routers
import (
"github.com/zhufuyi/sponge/internal/handler"
"github.com/gin-gonic/gin"
"github.com/zhufuyi/sponge/internal/handler"
)
func init() {

View File

@@ -3,14 +3,14 @@ package routers
import (
"context"
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
"github.com/zhufuyi/sponge/internal/service"
"github.com/gin-gonic/gin"
"google.golang.org/grpc/metadata"
"github.com/zhufuyi/sponge/pkg/gin/middleware"
"github.com/zhufuyi/sponge/pkg/logger"
"github.com/gin-gonic/gin"
"google.golang.org/grpc/metadata"
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
"github.com/zhufuyi/sponge/internal/service"
)
func init() {

View File

@@ -7,7 +7,7 @@ import (
"sync"
"time"
"github.com/zhufuyi/sponge/internal/config"
"google.golang.org/grpc"
"github.com/zhufuyi/sponge/pkg/consulcli"
"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/nacos"
"google.golang.org/grpc"
"github.com/zhufuyi/sponge/internal/config"
)
var (

View File

@@ -5,12 +5,12 @@ import (
"testing"
"time"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
"github.com/stretchr/testify/assert"
"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) {

View File

@@ -8,9 +8,10 @@ import (
"net/http"
"time"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/ecode"
"github.com/zhufuyi/sponge/internal/service"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/pkg/errcode"
@@ -21,10 +22,9 @@ import (
"github.com/zhufuyi/sponge/pkg/prof"
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/internal/ecode"
"github.com/zhufuyi/sponge/internal/service"
)
var _ app.IServer = (*grpcServer)(nil)

View File

@@ -7,15 +7,15 @@ import (
"testing"
"time"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"github.com/zhufuyi/sponge/pkg/grpc/gtls/certfile"
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
)
func TestGRPCServer(t *testing.T) {

View File

@@ -6,12 +6,12 @@ import (
"net/http"
"time"
"github.com/zhufuyi/sponge/internal/routers"
"github.com/gin-gonic/gin"
"github.com/zhufuyi/sponge/pkg/app"
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
"github.com/gin-gonic/gin"
"github.com/zhufuyi/sponge/internal/routers"
)
var _ app.IServer = (*httpServer)(nil)
@@ -59,7 +59,7 @@ func (s *httpServer) String() string {
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 {
o := defaultHTTPOptions()
o.apply(opts...)

View File

@@ -7,14 +7,14 @@ import (
"testing"
"time"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"github.com/zhufuyi/sponge/pkg/servicerd/registry"
"github.com/zhufuyi/sponge/pkg/utils"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
)
// need real database to test

View File

@@ -6,8 +6,7 @@ import (
"testing"
"time"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
"google.golang.org/grpc"
"github.com/zhufuyi/sponge/pkg/consulcli"
"github.com/zhufuyi/sponge/pkg/etcdcli"
@@ -20,7 +19,8 @@ import (
"github.com/zhufuyi/sponge/pkg/servicerd/registry/nacos"
"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) {

View File

@@ -6,18 +6,18 @@ import (
"math"
"strings"
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"
"github.com/jinzhu/copier"
"google.golang.org/grpc"
"github.com/zhufuyi/sponge/pkg/ggorm/query"
"github.com/zhufuyi/sponge/pkg/grpc/interceptor"
"github.com/zhufuyi/sponge/pkg/logger"
"github.com/jinzhu/copier"
"google.golang.org/grpc"
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"
)
func init() {

View File

@@ -5,18 +5,18 @@ import (
"errors"
"strings"
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"
"github.com/jinzhu/copier"
"google.golang.org/grpc"
"github.com/zhufuyi/sponge/pkg/grpc/interceptor"
"github.com/zhufuyi/sponge/pkg/logger"
"github.com/zhufuyi/sponge/pkg/mgo/query"
"github.com/jinzhu/copier"
"google.golang.org/grpc"
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"
)
func init() {

View File

@@ -7,12 +7,12 @@ import (
"testing"
"time"
"github.com/zhufuyi/sponge/pkg/grpc/benchmark"
serverNameExampleV1 "github.com/zhufuyi/sponge/api/serverNameExample/v1"
"github.com/zhufuyi/sponge/api/types"
"github.com/zhufuyi/sponge/configs"
"github.com/zhufuyi/sponge/internal/config"
"github.com/zhufuyi/sponge/pkg/grpc/benchmark"
)
// 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