mirror of https://github.com/zhufuyi/sponge
style: transfer ownership
This commit is contained in:
parent
21ed68366a
commit
5112f51697
|
@ -47,7 +47,7 @@ linters:
|
|||
|
||||
linters-settings:
|
||||
goimports:
|
||||
local-prefixes: github.com/zhufuyi/sponge
|
||||
local-prefixes: github.com/go-dev-frame/sponge
|
||||
gofmt:
|
||||
rewrite-rules:
|
||||
- pattern: 'interface{}'
|
||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2022 zhufuyi
|
||||
Copyright (c) 2022 zhuyasen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
8
Makefile
8
Makefile
|
@ -1,6 +1,6 @@
|
|||
SHELL := /bin/bash
|
||||
|
||||
PROJECT_NAME := "github.com/zhufuyi/sponge"
|
||||
PROJECT_NAME := "github.com/go-dev-frame/sponge"
|
||||
PKG := "$(PROJECT_NAME)"
|
||||
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/ | grep -v /api/ | grep -v /cmd/)
|
||||
|
||||
|
@ -12,8 +12,8 @@ install:
|
|||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||
go install github.com/envoyproxy/protoc-gen-validate@latest
|
||||
go install github.com/srikrsna/protoc-gen-gotag@latest
|
||||
go install github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin@latest
|
||||
go install github.com/zhufuyi/sponge/cmd/protoc-gen-go-rpc-tmpl@latest
|
||||
go install github.com/go-dev-frame/sponge/cmd/protoc-gen-go-gin@latest
|
||||
go install github.com/go-dev-frame/sponge/cmd/protoc-gen-go-rpc-tmpl@latest
|
||||
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest
|
||||
go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest
|
||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||
|
@ -48,7 +48,7 @@ cover:
|
|||
graph:
|
||||
@echo "generating graph ......"
|
||||
@cp -f cmd/serverNameExample_mixExample/main.go .
|
||||
go-callvis -skipbrowser -format=svg -nostd -file=serverNameExample_mixExample github.com/zhufuyi/sponge
|
||||
go-callvis -skipbrowser -format=svg -nostd -file=serverNameExample_mixExample github.com/go-dev-frame/sponge
|
||||
@rm -f main.go serverNameExample_mixExample.gv
|
||||
|
||||
# delete the templates code start
|
||||
|
|
54
README.md
54
README.md
|
@ -1,17 +1,17 @@
|
|||
## English | [简体中文](assets/readme-cn.md)
|
||||
|
||||
<p align="center">
|
||||
<img width="500px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/logo.png">
|
||||
<img width="500px" src="https://raw.githubusercontent.com/go-dev-frame/sponge/main/assets/logo.png">
|
||||
</p>
|
||||
|
||||
<div align=center>
|
||||
|
||||
[](https://goreportcard.com/report/github.com/zhufuyi/sponge)
|
||||
[](https://codecov.io/gh/zhufuyi/sponge)
|
||||
[](https://pkg.go.dev/github.com/zhufuyi/sponge)
|
||||
[](https://github.com/zhufuyi/sponge/actions)
|
||||
[](https://goreportcard.com/report/github.com/go-dev-frame/sponge)
|
||||
[](https://codecov.io/gh/go-dev-frame/sponge)
|
||||
[](https://pkg.go.dev/github.com/go-dev-frame/sponge)
|
||||
[](https://github.com/go-dev-frame/sponge/actions)
|
||||
[](https://github.com/avelino/awesome-go)
|
||||
[](https://img.shields.io/github/license/zhufuyi/sponge)
|
||||
[](https://img.shields.io/github/license/go-dev-frame/sponge)
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -58,7 +58,7 @@ Additionally, developers can use custom templates to generate various types of c
|
|||
|
||||
1. **Install sponge**
|
||||
|
||||
sponge supports installation on Windows, macOS, and Linux. Click to view the [**sponge installation guide**](https://github.com/zhufuyi/sponge/blob/main/assets/install-cn.md).
|
||||
Sponge supports installation on Windows, macOS, and Linux. Click to view the [**sponge installation guide**](https://github.com/go-dev-frame/sponge/blob/main/assets/install-cn.md).
|
||||
|
||||
2. **Open the code generation UI**
|
||||
|
||||
|
@ -71,10 +71,10 @@ Additionally, developers can use custom templates to generate various types of c
|
|||
Access `http://localhost:24631` in a local browser to generate code through the UI interface, as shown below:
|
||||
|
||||
<p align="center">
|
||||
<img width="1500px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/en_sponge-ui.png">
|
||||
<img width="1500px" src="https://raw.githubusercontent.com/go-dev-frame/sponge/main/assets/en_sponge-ui.png">
|
||||
</p>
|
||||
|
||||
> To access from a browser on a different host, specify the host IP or domain when starting the UI, e.g., `sponge run -a http://your_host_ip:24631`. Alternatively, you can run the UI service in Docker to support cross-host access. Click to view the guide on [running the sponge UI service in Docker](https://github.com/zhufuyi/sponge/blob/main/assets/install-cn.md#Docker%E7%8E%AF%E5%A2%83).
|
||||
> To access from a browser on a different host, specify the host IP or domain when starting the UI, e.g., `sponge run -a http://your_host_ip:24631`. Alternatively, you can run the UI service in Docker to support cross-host access. Click to view the guide on [running the sponge UI service in Docker](https://github.com/go-dev-frame/sponge/blob/main/assets/install-cn.md#Docker%E7%8E%AF%E5%A2%83).
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -85,7 +85,7 @@ Sponge supports generating code using both built-in templates and custom templat
|
|||
1. The code generation framework based on Sponge's built-in templates is shown below. There are two approaches: SQL and Protobuf.
|
||||
|
||||
<p align="center">
|
||||
<img width="1500px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/sponge-framework.png">
|
||||
<img width="1500px" src="https://raw.githubusercontent.com/go-dev-frame/sponge/main/assets/sponge-framework.png">
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
@ -93,7 +93,7 @@ Sponge supports generating code using both built-in templates and custom templat
|
|||
2. The code generation framework based on custom templates is shown below. There are three approaches: JSON, SQL, and Protobuf.
|
||||
|
||||
<p align="center">
|
||||
<img width="1200px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/template-framework.png">
|
||||
<img width="1200px" src="https://raw.githubusercontent.com/go-dev-frame/sponge/main/assets/template-framework.png">
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
@ -103,7 +103,7 @@ Sponge supports generating code using both built-in templates and custom templat
|
|||
Sponge supports creating six types of backend services, all based on microservice architecture. The diagram below illustrates a typical layered microservice structure, featuring high performance, scalability, and built-in service governance capabilities.
|
||||
|
||||
<p align="center">
|
||||
<img width="1000px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/microservices-framework.png">
|
||||
<img width="1000px" src="https://raw.githubusercontent.com/go-dev-frame/sponge/main/assets/microservices-framework.png">
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
@ -132,10 +132,10 @@ Click to view the [**test code**](https://github.com/zhufuyi/microservices_frame
|
|||
- Crontab [cron](https://github.com/robfig/cron)
|
||||
- Message Queue [rabbitmq](https://github.com/rabbitmq/amqp091-go), [kafka](https://github.com/IBM/sarama)
|
||||
- Distributed Transaction Manager [dtm](https://github.com/dtm-labs/dtm)
|
||||
- Distributed lock [dlock](https://github.com/zhufuyi/sponge/tree/main/pkg/dlock)
|
||||
- Distributed lock [dlock](https://github.com/go-dev-frame/sponge/tree/main/pkg/dlock)
|
||||
- Parameter validation [validator](https://github.com/go-playground/validator)
|
||||
- Adaptive rate limiting [ratelimit](https://github.com/zhufuyi/sponge/tree/main/pkg/shield/ratelimit)
|
||||
- Adaptive circuit breaking [circuitbreaker](https://github.com/zhufuyi/sponge/tree/main/pkg/shield/circuitbreaker)
|
||||
- Adaptive rate limiting [ratelimit](https://github.com/go-dev-frame/sponge/tree/main/pkg/shield/ratelimit)
|
||||
- Adaptive circuit breaking [circuitbreaker](https://github.com/go-dev-frame/sponge/tree/main/pkg/shield/circuitbreaker)
|
||||
- Distributed Tracing [opentelemetry](https://github.com/open-telemetry/opentelemetry-go)
|
||||
- Metrics monitoring [prometheus](https://github.com/prometheus/client_golang/prometheus), [grafana](https://github.com/grafana/grafana)
|
||||
- Service registration and discovery [etcd](https://github.com/etcd-io/etcd), [consul](https://github.com/hashicorp/consul), [nacos](https://github.com/alibaba/nacos)
|
||||
|
@ -144,7 +144,7 @@ Click to view the [**test code**](https://github.com/zhufuyi/microservices_frame
|
|||
- Configuration center [nacos](https://github.com/alibaba/nacos)
|
||||
- Code quality checking [golangci-lint](https://github.com/golangci/golangci-lint)
|
||||
- Continuous integration and deployment [jenkins](https://github.com/jenkinsci/jenkins), [docker](https://www.docker.com/), [kubernetes](https://github.com/kubernetes/kubernetes)
|
||||
- Generate project business architecture diagram [spograph](https://github.com/zhufuyi/spograph)
|
||||
- Generate project business architecture diagram [spograph](https://github.com/go-dev-frame/spograph)
|
||||
- Custom template generation code [go template](https://pkg.go.dev/text/template@go1.23.3)
|
||||
|
||||
<br>
|
||||
|
@ -217,23 +217,23 @@ Click to view [the detailed documentation](https://go-sponge.com/) for Sponge de
|
|||
|
||||
#### Examples of create services
|
||||
|
||||
- [Create **web** service based on **sql** (including CRUD)](https://github.com/zhufuyi/sponge_examples/tree/main/1_web-gin-CRUD)
|
||||
- [Create **grpc** service based on **sql** (including CRUD)](https://github.com/zhufuyi/sponge_examples/tree/main/2_micro-grpc-CRUD)
|
||||
- [Create **web** service based on **protobuf**](https://github.com/zhufuyi/sponge_examples/tree/main/3_web-gin-protobuf)
|
||||
- [Create **grpc** service based on **protobuf** ](https://github.com/zhufuyi/sponge_examples/tree/main/4_micro-grpc-protobuf)
|
||||
- [Create **grpc gateway** service based on **protobuf**](https://github.com/zhufuyi/sponge_examples/tree/main/5_micro-gin-rpc-gateway)
|
||||
- [Create **grpc+http** service based on **protobuf**](https://github.com/zhufuyi/sponge_examples/tree/main/_10_micro-grpc-http-protobuf)
|
||||
- [Create **web** service based on **sql** (including CRUD)](https://github.com/go-dev-frame/sponge_examples/tree/main/1_web-gin-CRUD)
|
||||
- [Create **grpc** service based on **sql** (including CRUD)](https://github.com/go-dev-frame/sponge_examples/tree/main/2_micro-grpc-CRUD)
|
||||
- [Create **web** service based on **protobuf**](https://github.com/go-dev-frame/sponge_examples/tree/main/3_web-gin-protobuf)
|
||||
- [Create **grpc** service based on **protobuf** ](https://github.com/go-dev-frame/sponge_examples/tree/main/4_micro-grpc-protobuf)
|
||||
- [Create **grpc gateway** service based on **protobuf**](https://github.com/go-dev-frame/sponge_examples/tree/main/5_micro-gin-rpc-gateway)
|
||||
- [Create **grpc+http** service based on **protobuf**](https://github.com/go-dev-frame/sponge_examples/tree/main/_10_micro-grpc-http-protobuf)
|
||||
|
||||
#### Examples of develop complete project
|
||||
|
||||
- [Simple community web backend service](https://github.com/zhufuyi/sponge_examples/tree/main/7_community-single)
|
||||
- [Simple community web service broken down into microservice](https://github.com/zhufuyi/sponge_examples/tree/main/8_community-cluster)
|
||||
- [Simple community web backend service](https://github.com/go-dev-frame/sponge_examples/tree/main/7_community-single)
|
||||
- [Simple community web service broken down into microservice](https://github.com/go-dev-frame/sponge_examples/tree/main/8_community-cluster)
|
||||
|
||||
#### Distributed transaction examples
|
||||
|
||||
- [Simple distributed order system](https://github.com/zhufuyi/sponge_examples/tree/main/9_order-grpc-distributed-transaction)
|
||||
- [Flash sale](https://github.com/zhufuyi/sponge_examples/tree/main/_12_sponge-dtm-flashSale)
|
||||
- [E-Commerce system](https://github.com/zhufuyi/sponge_examples/tree/main/_14_eshop)
|
||||
- [Simple distributed order system](https://github.com/go-dev-frame/sponge_examples/tree/main/9_order-grpc-distributed-transaction)
|
||||
- [Flash sale](https://github.com/go-dev-frame/sponge_examples/tree/main/_12_sponge-dtm-flashSale)
|
||||
- [E-Commerce system](https://github.com/go-dev-frame/sponge_examples/tree/main/_14_eshop)
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
types "github.com/zhufuyi/sponge/api/types"
|
||||
types "github.com/go-dev-frame/sponge/api/types"
|
||||
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
|
|
|
@ -11,7 +11,7 @@ import "google/api/annotations.proto";
|
|||
import "protoc-gen-openapiv2/options/annotations.proto";
|
||||
import "tagger/tagger.proto";
|
||||
|
||||
option go_package = "github.com/zhufuyi/sponge/api/serverNameExample/v1;v1";
|
||||
option go_package = "github.com/go-dev-frame/sponge/api/serverNameExample/v1;v1";
|
||||
|
||||
// Default settings for generating *.swagger.json documents
|
||||
// NOTE: because json does not support 64 bits, the int64 and uint64 types under *.swagger.json are automatically converted to string types
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Code generated by https://github.com/zhufuyi/sponge, DO NOT EDIT.
|
||||
// Code generated by https://github.com/go-dev-frame/sponge, DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
|
@ -6,8 +6,8 @@ import (
|
|||
context "context"
|
||||
errors "errors"
|
||||
gin "github.com/gin-gonic/gin"
|
||||
errcode "github.com/zhufuyi/sponge/pkg/errcode"
|
||||
middleware "github.com/zhufuyi/sponge/pkg/gin/middleware"
|
||||
errcode "github.com/go-dev-frame/sponge/pkg/errcode"
|
||||
middleware "github.com/go-dev-frame/sponge/pkg/gin/middleware"
|
||||
zap "go.uber.org/zap"
|
||||
strings "strings"
|
||||
)
|
||||
|
|
|
@ -97,9 +97,9 @@ type Column struct {
|
|||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name"` // column name
|
||||
Exp string `protobuf:"bytes,2,opt,name=exp,proto3" json:"exp"` // expressions, which default to = when the value is null, have =, !=, >, >=, <, <=, like, in
|
||||
Exp string `protobuf:"bytes,2,opt,name=exp,proto3" json:"exp"` // expressions, default value is "=", support =, !=, >, >=, <, <=, like, in
|
||||
Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value"` // column value
|
||||
Logic string `protobuf:"bytes,4,opt,name=logic,proto3" json:"logic"` // logical type, defaults to and when value is null, only &(and), ||(or)
|
||||
Logic string `protobuf:"bytes,4,opt,name=logic,proto3" json:"logic"` // logical type, default value is "and", support &, and, ||, or
|
||||
}
|
||||
|
||||
func (x *Column) Reset() {
|
||||
|
|
|
@ -2,7 +2,7 @@ syntax = "proto3";
|
|||
|
||||
package api.types;
|
||||
|
||||
option go_package = "github.com/zhufuyi/sponge/api/types;types";
|
||||
option go_package = "github.com/go-dev-frame/sponge/api/types;types";
|
||||
|
||||
message Params {
|
||||
int32 page = 1; // page number, starting from 0
|
||||
|
@ -13,9 +13,9 @@ message Params {
|
|||
|
||||
message Column {
|
||||
string name = 1; // column name
|
||||
string exp = 2; // expressions, which default to = when the value is null, have =, !=, >, >=, <, <=, like, in
|
||||
string exp = 2; // expressions, default value is "=", support =, !=, >, >=, <, <=, like, in
|
||||
string value = 3; // column value
|
||||
string logic = 4; // logical type, defaults to and when value is null, only &(and), ||(or)
|
||||
string logic = 4; // logical type, default value is "and", support &, and, ||, or
|
||||
}
|
||||
|
||||
message Conditions {
|
||||
|
|
|
@ -91,7 +91,7 @@ go env GOBIN
|
|||
|
||||
```bash
|
||||
# 安装sponge
|
||||
go install github.com/zhufuyi/sponge/cmd/sponge@latest
|
||||
go install github.com/go-dev-frame/sponge/cmd/sponge@latest
|
||||
|
||||
# 初始化sponge,自动安装sponge依赖插件
|
||||
sponge init
|
||||
|
|
|
@ -86,7 +86,7 @@ Download the corresponding **protoc** executable file according to the system ty
|
|||
|
||||
```bash
|
||||
# Install Sponge
|
||||
go install github.com/zhufuyi/sponge/cmd/sponge@latest
|
||||
go install github.com/go-dev-frame/sponge/cmd/sponge@latest
|
||||
|
||||
# Initialize Sponge, automatically install Sponge's dependency plugins
|
||||
sponge init
|
||||
|
|
|
@ -45,7 +45,7 @@ sponge 适用于快速开发各种高性能后端服务,包括但不限于:
|
|||
|
||||
1. **安装 sponge**
|
||||
|
||||
支持在 windows、mac、linux 环境下安装 sponge,点击查看 [**安装 sponge 说明**](https://github.com/zhufuyi/sponge/blob/main/assets/install-cn.md)。
|
||||
支持在 windows、mac、linux 环境下安装 sponge,点击查看 [**安装 sponge 说明**](https://github.com/go-dev-frame/sponge/blob/main/assets/install-cn.md)。
|
||||
|
||||
2. **打开生成代码 UI 页面**
|
||||
|
||||
|
@ -58,10 +58,10 @@ sponge 适用于快速开发各种高性能后端服务,包括但不限于:
|
|||
在本地浏览器访问 `http://localhost:24631`,在页面上操作生成代码,如下图所示:
|
||||
|
||||
<p align="center">
|
||||
<img width="1500px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/sponge-ui.png">
|
||||
<img width="1500px" src="https://raw.githubusercontent.com/go-dev-frame/sponge/main/assets/sponge-ui.png">
|
||||
</p>
|
||||
|
||||
> 如果想要在跨主机的浏览器上访问,启动UI时需要指定宿主机ip或域名,示例 `sponge run -a http://your_host_ip:24631`。 也可以在 docker 上启动UI服务来支持跨主机访问,点击查看 [在 docker 运行 sponge UI 服务说明](https://github.com/zhufuyi/sponge/blob/main/assets/install-cn.md#Docker%E7%8E%AF%E5%A2%83)。
|
||||
> 如果想要在跨主机的浏览器上访问,启动UI时需要指定宿主机ip或域名,示例 `sponge run -a http://your_host_ip:24631`。 也可以在 docker 上启动UI服务来支持跨主机访问,点击查看 [在 docker 运行 sponge UI 服务说明](https://github.com/go-dev-frame/sponge/blob/main/assets/install-cn.md#Docker%E7%8E%AF%E5%A2%83)。
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -72,7 +72,7 @@ sponge 支持基于自带模板和自定义模板两种方式生成你的项目
|
|||
1. sponge 基于自带模板生成代码框架如下图所示,共有 sql 和 protobuf 两种方式生成代码。
|
||||
|
||||
<p align="center">
|
||||
<img width="1500px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/sponge-framework.png">
|
||||
<img width="1500px" src="https://raw.githubusercontent.com/go-dev-frame/sponge/main/assets/sponge-framework.png">
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
@ -80,7 +80,7 @@ sponge 支持基于自带模板和自定义模板两种方式生成你的项目
|
|||
2. sponge 基于自定义模板生成代码框架如下图所示,共有 json、sql、protobuf 三种方式生成代码。
|
||||
|
||||
<p align="center">
|
||||
<img width="1200px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/template-framework.png">
|
||||
<img width="1200px" src="https://raw.githubusercontent.com/go-dev-frame/sponge/main/assets/template-framework.png">
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
@ -90,7 +90,7 @@ sponge 支持基于自带模板和自定义模板两种方式生成你的项目
|
|||
sponge 支持创建 6 种类型的后端服务,均为微服务架构。下图展示了典型的微服务分层结构,具备高性能、高扩展性,并内置常用的服务治理功能。
|
||||
|
||||
<p align="center">
|
||||
<img width="1000px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/microservices-framework.png">
|
||||
<img width="1000px" src="https://raw.githubusercontent.com/go-dev-frame/sponge/main/assets/microservices-framework.png">
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
@ -122,9 +122,9 @@ sponge包含丰富的组件(按需使用):
|
|||
- 定时任务 [cron](https://github.com/robfig/cron)
|
||||
- 消息队列组件 [rabbitmq](https://github.com/rabbitmq/amqp091-go), [kafka](https://github.com/IBM/sarama)
|
||||
- 分布式事务管理器 [dtm](https://github.com/dtm-labs/dtm)
|
||||
- 分布式锁 [dlock](https://github.com/zhufuyi/sponge/tree/main/pkg/dlock)
|
||||
- 自适应限流 [ratelimit](https://github.com/zhufuyi/sponge/tree/main/pkg/shield/ratelimit)
|
||||
- 自适应熔断 [circuitbreaker](https://github.com/zhufuyi/sponge/tree/main/pkg/shield/circuitbreaker)
|
||||
- 分布式锁 [dlock](https://github.com/go-dev-frame/sponge/tree/main/pkg/dlock)
|
||||
- 自适应限流 [ratelimit](https://github.com/go-dev-frame/sponge/tree/main/pkg/shield/ratelimit)
|
||||
- 自适应熔断 [circuitbreaker](https://github.com/go-dev-frame/sponge/tree/main/pkg/shield/circuitbreaker)
|
||||
- 链路跟踪 [opentelemetry](https://github.com/open-telemetry/opentelemetry-go)
|
||||
- 监控 [prometheus](https://github.com/prometheus/client_golang/prometheus), [grafana](https://github.com/grafana/grafana)
|
||||
- 服务注册与发现 [etcd](https://github.com/etcd-io/etcd), [consul](https://github.com/hashicorp/consul), [nacos](https://github.com/alibaba/nacos)
|
||||
|
@ -133,7 +133,7 @@ sponge包含丰富的组件(按需使用):
|
|||
- 配置中心 [nacos](https://github.com/alibaba/nacos)
|
||||
- 代码质量检查 [golangci-lint](https://github.com/golangci/golangci-lint)
|
||||
- 持续集成部署 CICD [jenkins](https://github.com/jenkinsci/jenkins), [docker](https://www.docker.com/), [kubernetes](https://github.com/kubernetes/kubernetes)
|
||||
- 生成项目业务架构图 [spograph](https://github.com/zhufuyi/spograph)
|
||||
- 生成项目业务架构图 [spograph](https://github.com/go-dev-frame/spograph)
|
||||
- 自定义模板生成代码 [go template](https://pkg.go.dev/text/template@go1.23.3)
|
||||
|
||||
<br>
|
||||
|
@ -206,27 +206,27 @@ sponge包含丰富的组件(按需使用):
|
|||
|
||||
#### 使用 sponge 创建服务示例
|
||||
|
||||
- [基于sql创建web服务(包括CRUD)](https://github.com/zhufuyi/sponge_examples/tree/main/1_web-gin-CRUD)
|
||||
- [基于sql创建grpc服务(包括CRUD)](https://github.com/zhufuyi/sponge_examples/tree/main/2_micro-grpc-CRUD)
|
||||
- [基于protobuf创建web服务](https://github.com/zhufuyi/sponge_examples/tree/main/3_web-gin-protobuf)
|
||||
- [基于protobuf创建grpc服务](https://github.com/zhufuyi/sponge_examples/tree/main/4_micro-grpc-protobuf)
|
||||
- [基于protobuf创建grpc网关服务](https://github.com/zhufuyi/sponge_examples/tree/main/5_micro-gin-rpc-gateway)
|
||||
- [基于protobuf创建grpc+http服务](https://github.com/zhufuyi/sponge_examples/tree/main/_10_micro-grpc-http-protobuf)
|
||||
- [基于sql创建web服务(包括CRUD)](https://github.com/go-dev-frame/sponge_examples/tree/main/1_web-gin-CRUD)
|
||||
- [基于sql创建grpc服务(包括CRUD)](https://github.com/go-dev-frame/sponge_examples/tree/main/2_micro-grpc-CRUD)
|
||||
- [基于protobuf创建web服务](https://github.com/go-dev-frame/sponge_examples/tree/main/3_web-gin-protobuf)
|
||||
- [基于protobuf创建grpc服务](https://github.com/go-dev-frame/sponge_examples/tree/main/4_micro-grpc-protobuf)
|
||||
- [基于protobuf创建grpc网关服务](https://github.com/go-dev-frame/sponge_examples/tree/main/5_micro-gin-rpc-gateway)
|
||||
- [基于protobuf创建grpc+http服务](https://github.com/go-dev-frame/sponge_examples/tree/main/_10_micro-grpc-http-protobuf)
|
||||
|
||||
#### 使用 sponge 开发完整项目示例
|
||||
|
||||
- [简单的社区web后端服务](https://github.com/zhufuyi/sponge_examples/tree/main/7_community-single)
|
||||
- [简单的社区web后端服务拆分为微服务](https://github.com/zhufuyi/sponge_examples/tree/main/8_community-cluster)
|
||||
- [简单的社区web后端服务](https://github.com/go-dev-frame/sponge_examples/tree/main/7_community-single)
|
||||
- [简单的社区web后端服务拆分为微服务](https://github.com/go-dev-frame/sponge_examples/tree/main/8_community-cluster)
|
||||
|
||||
#### 分布式事务示例
|
||||
|
||||
- [简单的分布式订单系统](https://github.com/zhufuyi/sponge_examples/tree/main/9_order-grpc-distributed-transaction)
|
||||
- [秒杀抢购活动](https://github.com/zhufuyi/sponge_examples/tree/main/_12_sponge-dtm-flashSale)
|
||||
- [电商系统](https://github.com/zhufuyi/sponge_examples/tree/main/_14_eshop)
|
||||
- [简单的分布式订单系统](https://github.com/go-dev-frame/sponge_examples/tree/main/9_order-grpc-distributed-transaction)
|
||||
- [秒杀抢购活动](https://github.com/go-dev-frame/sponge_examples/tree/main/_12_sponge-dtm-flashSale)
|
||||
- [电商系统](https://github.com/go-dev-frame/sponge_examples/tree/main/_14_eshop)
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
如果对您有帮助给个star⭐,欢迎加入**go sponge微信群交流**,加微信(备注`sponge`)进群。
|
||||
|
||||
<img width="300px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/wechat-group.jpg">
|
||||
<img width="300px" src="https://raw.githubusercontent.com/go-dev-frame/sponge/main/assets/wechat-group.jpg">
|
||||
|
|
|
@ -23,7 +23,7 @@ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2.0
|
|||
|
||||
#### Install protoc-gen-go-gin
|
||||
|
||||
> go install github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin@latest
|
||||
> go install github.com/go-dev-frame/sponge/cmd/protoc-gen-go-gin@latest
|
||||
|
||||
<br>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"google.golang.org/protobuf/compiler/protogen"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/parse"
|
||||
"github.com/go-dev-frame/sponge/cmd/protoc-gen-go-gin/internal/parse"
|
||||
)
|
||||
|
||||
// GenerateFiles generate handler logic, router, error code files.
|
||||
|
@ -109,7 +109,7 @@ func (f *mixLogicFields) execute() []byte {
|
|||
mark := []byte("ctx = middleware.AdaptCtx(ctx)")
|
||||
if bytes.Contains(content, mark) {
|
||||
importPkgs = append(importPkgs, []byte("\n\t")...)
|
||||
importPkgs = append(importPkgs, []byte(`"github.com/zhufuyi/sponge/pkg/gin/middleware"`)...)
|
||||
importPkgs = append(importPkgs, []byte(`"github.com/go-dev-frame/sponge/pkg/gin/middleware"`)...)
|
||||
}
|
||||
return bytes.ReplaceAll(content, []byte(importPkgPathMark), importPkgs)
|
||||
}
|
||||
|
|
|
@ -35,14 +35,14 @@ func init() {
|
|||
|
||||
var (
|
||||
handlerLogicTmpl *template.Template
|
||||
handlerLogicTmplRaw = `// Code generated by https://github.com/zhufuyi/sponge
|
||||
handlerLogicTmplRaw = `// Code generated by https://github.com/go-dev-frame/sponge
|
||||
|
||||
package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
//"github.com/zhufuyi/sponge/pkg/gin/middleware"
|
||||
//"github.com/go-dev-frame/sponge/pkg/gin/middleware"
|
||||
|
||||
// import api service package here
|
||||
)
|
||||
|
@ -111,15 +111,15 @@ func (h *{{.LowerServiceName}}Handler) {{.MethodName}}(ctx context.Context, req
|
|||
`
|
||||
|
||||
routerTmpl *template.Template
|
||||
routerTmplRaw = `// Code generated by https://github.com/zhufuyi/sponge
|
||||
routerTmplRaw = `// Code generated by https://github.com/go-dev-frame/sponge
|
||||
|
||||
package routers
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/logger"
|
||||
//"github.com/zhufuyi/sponge/pkg/middleware"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
//"github.com/go-dev-frame/sponge/pkg/middleware"
|
||||
|
||||
// import api service package here
|
||||
"moduleNameExample/internal/handler"
|
||||
|
@ -183,7 +183,7 @@ func {{.LowerName}}Middlewares(c *middlewareConfig) {
|
|||
`
|
||||
|
||||
mixLogicTmpl *template.Template
|
||||
mixLogicTmplRaw = `// Code generated by https://github.com/zhufuyi/sponge
|
||||
mixLogicTmplRaw = `// Code generated by https://github.com/go-dev-frame/sponge
|
||||
|
||||
package handler
|
||||
|
||||
|
@ -225,7 +225,7 @@ func (h *{{.LowerServiceName}}Handler) {{.MethodName}}(ctx context.Context, req
|
|||
`
|
||||
|
||||
mixRouterTmpl *template.Template
|
||||
mixRouterTmplRaw = `// Code generated by https://github.com/zhufuyi/sponge
|
||||
mixRouterTmplRaw = `// Code generated by https://github.com/go-dev-frame/sponge
|
||||
|
||||
package routers
|
||||
|
||||
|
@ -235,8 +235,8 @@ import (
|
|||
"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/go-dev-frame/sponge/pkg/gin/middleware"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
|
||||
// import api service package here
|
||||
"moduleNameExample/internal/handler"
|
||||
|
@ -309,12 +309,12 @@ func {{.LowerName}}Middlewares(c *middlewareConfig) {
|
|||
|
||||
httpErrCodeTmpl *template.Template
|
||||
//nolint
|
||||
httpErrCodeTmplRaw = `// Code generated by https://github.com/zhufuyi/sponge
|
||||
httpErrCodeTmplRaw = `// Code generated by https://github.com/go-dev-frame/sponge
|
||||
|
||||
package ecode
|
||||
|
||||
import (
|
||||
"github.com/zhufuyi/sponge/pkg/errcode"
|
||||
"github.com/go-dev-frame/sponge/pkg/errcode"
|
||||
)
|
||||
|
||||
{{- range .PbServices}}
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"google.golang.org/protobuf/compiler/protogen"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/parse"
|
||||
"github.com/go-dev-frame/sponge/cmd/protoc-gen-go-gin/internal/parse"
|
||||
)
|
||||
|
||||
// GenerateFiles generate gin router code.
|
||||
|
|
|
@ -18,7 +18,7 @@ func init() {
|
|||
|
||||
var (
|
||||
importPkgTmpl *template.Template
|
||||
importPkgTmplRaw = `// Code generated by https://github.com/zhufuyi/sponge, DO NOT EDIT.
|
||||
importPkgTmplRaw = `// Code generated by https://github.com/go-dev-frame/sponge, DO NOT EDIT.
|
||||
|
||||
package {{$.PackageName}}
|
||||
|
||||
|
@ -30,8 +30,8 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/errcode"
|
||||
"github.com/zhufuyi/sponge/pkg/gin/middleware"
|
||||
"github.com/go-dev-frame/sponge/pkg/errcode"
|
||||
"github.com/go-dev-frame/sponge/pkg/gin/middleware"
|
||||
|
||||
{{$.PackagePaths}}
|
||||
)
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"google.golang.org/protobuf/compiler/protogen"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin/internal/parse"
|
||||
"github.com/go-dev-frame/sponge/cmd/protoc-gen-go-gin/internal/parse"
|
||||
)
|
||||
|
||||
// GenerateFiles generate service logic, router, error code files.
|
||||
|
|
|
@ -26,7 +26,7 @@ func init() {
|
|||
|
||||
var (
|
||||
serviceLogicTmpl *template.Template
|
||||
serviceLogicTmplRaw = `// Code generated by https://github.com/zhufuyi/sponge
|
||||
serviceLogicTmplRaw = `// Code generated by https://github.com/go-dev-frame/sponge
|
||||
|
||||
package service
|
||||
|
||||
|
@ -99,7 +99,7 @@ func (c *{{.LowerServiceName}}Client) {{.MethodName}}(ctx context.Context, req *
|
|||
`
|
||||
|
||||
routerTmpl *template.Template
|
||||
routerTmplRaw = `// Code generated by https://github.com/zhufuyi/sponge
|
||||
routerTmplRaw = `// Code generated by https://github.com/go-dev-frame/sponge
|
||||
|
||||
package routers
|
||||
|
||||
|
@ -109,8 +109,8 @@ import (
|
|||
"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/go-dev-frame/sponge/pkg/gin/middleware"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
|
||||
// import api service package here
|
||||
"moduleNameExample/internal/service"
|
||||
|
@ -185,12 +185,12 @@ func {{.LowerName}}Middlewares(c *middlewareConfig) {
|
|||
|
||||
rpcErrCodeTmpl *template.Template
|
||||
//nolint
|
||||
rpcErrCodeTmplRaw = `// Code generated by https://github.com/zhufuyi/sponge
|
||||
rpcErrCodeTmplRaw = `// Code generated by https://github.com/go-dev-frame/sponge
|
||||
|
||||
package ecode
|
||||
|
||||
import (
|
||||
"github.com/zhufuyi/sponge/pkg/errcode"
|
||||
"github.com/go-dev-frame/sponge/pkg/errcode"
|
||||
)
|
||||
|
||||
{{- range .PbServices}}
|
||||
|
|
|
@ -13,9 +13,9 @@ import (
|
|||
"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"
|
||||
"github.com/go-dev-frame/sponge/cmd/protoc-gen-go-gin/internal/generate/handler"
|
||||
"github.com/go-dev-frame/sponge/cmd/protoc-gen-go-gin/internal/generate/router"
|
||||
"github.com/go-dev-frame/sponge/cmd/protoc-gen-go-gin/internal/generate/service"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -163,7 +163,7 @@ func saveGinRouterFiles(f *protogen.File) error {
|
|||
ginRouterFileContent = bytes.Replace(ginRouterFileContent, []byte(`"errors"`), []byte(""), 1)
|
||||
}
|
||||
if !bytes.Contains(ginRouterFileContent, []byte("middleware.")) {
|
||||
ginRouterFileContent = bytes.Replace(ginRouterFileContent, []byte(`"github.com/zhufuyi/sponge/pkg/gin/middleware"`), []byte(""), 1)
|
||||
ginRouterFileContent = bytes.Replace(ginRouterFileContent, []byte(`"github.com/go-dev-frame/sponge/pkg/gin/middleware"`), []byte(""), 1)
|
||||
}
|
||||
filePath := f.GeneratedFilenamePrefix + "_router.pb.go"
|
||||
return os.WriteFile(filePath, ginRouterFileContent, 0666)
|
||||
|
|
|
@ -23,7 +23,7 @@ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2.0
|
|||
|
||||
#### Install protoc-gen-go-rpc-tmpl
|
||||
|
||||
> go install github.com/zhufuyi/sponge/cmd/protoc-gen-go-rpc-tmpl@latest
|
||||
> go install github.com/go-dev-frame/sponge/cmd/protoc-gen-go-rpc-tmpl@latest
|
||||
|
||||
<br>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"google.golang.org/protobuf/compiler/protogen"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/protoc-gen-go-rpc-tmpl/internal/parse"
|
||||
"github.com/go-dev-frame/sponge/cmd/protoc-gen-go-rpc-tmpl/internal/parse"
|
||||
)
|
||||
|
||||
// GenerateFiles generate service template code and error codes
|
||||
|
|
|
@ -26,7 +26,7 @@ func init() {
|
|||
|
||||
var (
|
||||
serviceLogicTmpl *template.Template
|
||||
serviceLogicTmplRaw = `// Code generated by https://github.com/zhufuyi/sponge
|
||||
serviceLogicTmplRaw = `// Code generated by https://github.com/go-dev-frame/sponge
|
||||
|
||||
package service
|
||||
|
||||
|
@ -35,8 +35,8 @@ import (
|
|||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
//"github.com/zhufuyi/sponge/pkg/grpc/interceptor"
|
||||
//"github.com/zhufuyi/sponge/pkg/logger"
|
||||
//"github.com/go-dev-frame/sponge/pkg/grpc/interceptor"
|
||||
//"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
|
||||
// import api service package here
|
||||
//"moduleNameExample/internal/cache"
|
||||
|
@ -235,7 +235,7 @@ func (s *{{.LowerServiceName}}) {{.MethodName}}(ctx context.Context, req *{{.Req
|
|||
`
|
||||
|
||||
serviceLogicTestTmpl *template.Template
|
||||
serviceLogicTestTmplRaw = `// Code generated by https://github.com/zhufuyi/sponge
|
||||
serviceLogicTestTmplRaw = `// Code generated by https://github.com/go-dev-frame/sponge
|
||||
{{- range .PbServices}}
|
||||
// Test_service_{{.LowerName}}_methods is used to test the {{.LowerName}} api
|
||||
// Test_service_{{.LowerName}}_benchmark is used to performance test the {{.LowerName}} api
|
||||
|
@ -250,7 +250,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/grpc/benchmark"
|
||||
"github.com/go-dev-frame/sponge/pkg/grpc/benchmark"
|
||||
|
||||
// import api service package here
|
||||
"moduleNameExample/configs"
|
||||
|
@ -535,12 +535,12 @@ func Test_service_{{.LowerName}}_benchmark(t *testing.T) {
|
|||
`
|
||||
|
||||
rpcErrCodeTmpl *template.Template
|
||||
rpcErrCodeTmplRaw = `// Code generated by https://github.com/zhufuyi/sponge
|
||||
rpcErrCodeTmplRaw = `// Code generated by https://github.com/go-dev-frame/sponge
|
||||
|
||||
package ecode
|
||||
|
||||
import (
|
||||
"github.com/zhufuyi/sponge/pkg/errcode"
|
||||
"github.com/go-dev-frame/sponge/pkg/errcode"
|
||||
)
|
||||
|
||||
{{- range .PbServices}}
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
"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"
|
||||
"github.com/go-dev-frame/sponge/cmd/protoc-gen-go-rpc-tmpl/internal/generate/service"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -19,7 +19,7 @@ mkdir -p protocDir \
|
|||
|
||||
#### Install protoc-gen-json-field
|
||||
|
||||
> go install github.com/zhufuyi/sponge/cmd/protoc-gen-json-field@latest
|
||||
> go install github.com/go-dev-frame/sponge/cmd/protoc-gen-json-field@latest
|
||||
|
||||
<br>
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/jinzhu/inflection"
|
||||
"google.golang.org/protobuf/compiler/protogen"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/protoc-gen-json-field/parser"
|
||||
"github.com/go-dev-frame/sponge/cmd/protoc-gen-json-field/parser"
|
||||
)
|
||||
|
||||
// ProtoInfo is the info for parsing proto file
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"google.golang.org/protobuf/compiler/protogen"
|
||||
"google.golang.org/protobuf/types/pluginpb"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/protoc-gen-json-field/generate"
|
||||
"github.com/go-dev-frame/sponge/cmd/protoc-gen-json-field/generate"
|
||||
)
|
||||
|
||||
const helpInfo = `
|
||||
|
|
|
@ -4,12 +4,12 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/zhufuyi/sponge/pkg/logger"
|
||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
"github.com/go-dev-frame/sponge/pkg/tracer"
|
||||
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
"github.com/zhufuyi/sponge/internal/database"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
"github.com/go-dev-frame/sponge/internal/database"
|
||||
)
|
||||
|
||||
// Close releasing resources after service exit
|
||||
|
|
|
@ -3,10 +3,10 @@ package initial
|
|||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
"github.com/zhufuyi/sponge/internal/server"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
"github.com/go-dev-frame/sponge/internal/server"
|
||||
)
|
||||
|
||||
// CreateServices create grpc service
|
||||
|
|
|
@ -7,13 +7,13 @@ import (
|
|||
"flag"
|
||||
"strconv"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/logger"
|
||||
"github.com/zhufuyi/sponge/pkg/stat"
|
||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
"github.com/go-dev-frame/sponge/pkg/stat"
|
||||
"github.com/go-dev-frame/sponge/pkg/tracer"
|
||||
|
||||
"github.com/zhufuyi/sponge/configs"
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
"github.com/zhufuyi/sponge/internal/database"
|
||||
"github.com/go-dev-frame/sponge/configs"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
"github.com/go-dev-frame/sponge/internal/database"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/serverNameExample_grpcExample/initial"
|
||||
"github.com/go-dev-frame/sponge/cmd/serverNameExample_grpcExample/initial"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -4,12 +4,12 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/zhufuyi/sponge/pkg/logger"
|
||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
"github.com/go-dev-frame/sponge/pkg/tracer"
|
||||
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
//"github.com/zhufuyi/sponge/internal/rpcclient"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
//"github.com/go-dev-frame/sponge/internal/rpcclient"
|
||||
)
|
||||
|
||||
// Close releasing resources after service exit
|
||||
|
|
|
@ -3,10 +3,10 @@ package initial
|
|||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
"github.com/zhufuyi/sponge/internal/server"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
"github.com/go-dev-frame/sponge/internal/server"
|
||||
)
|
||||
|
||||
// CreateServices create http service
|
||||
|
|
|
@ -7,13 +7,13 @@ import (
|
|||
"flag"
|
||||
"strconv"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/logger"
|
||||
"github.com/zhufuyi/sponge/pkg/stat"
|
||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
"github.com/go-dev-frame/sponge/pkg/stat"
|
||||
"github.com/go-dev-frame/sponge/pkg/tracer"
|
||||
|
||||
"github.com/zhufuyi/sponge/configs"
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
//"github.com/zhufuyi/sponge/internal/rpcclient"
|
||||
"github.com/go-dev-frame/sponge/configs"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
//"github.com/go-dev-frame/sponge/internal/rpcclient"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/serverNameExample_grpcGwPbExample/initial"
|
||||
"github.com/go-dev-frame/sponge/cmd/serverNameExample_grpcGwPbExample/initial"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -4,12 +4,12 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/zhufuyi/sponge/pkg/logger"
|
||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
"github.com/go-dev-frame/sponge/pkg/tracer"
|
||||
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
//"github.com/zhufuyi/sponge/internal/database"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
//"github.com/go-dev-frame/sponge/internal/database"
|
||||
)
|
||||
|
||||
// Close releasing resources after service exit
|
||||
|
|
|
@ -3,10 +3,10 @@ package initial
|
|||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
"github.com/zhufuyi/sponge/internal/server"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
"github.com/go-dev-frame/sponge/internal/server"
|
||||
)
|
||||
|
||||
// CreateServices create services
|
||||
|
|
|
@ -7,13 +7,13 @@ import (
|
|||
"flag"
|
||||
"strconv"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/logger"
|
||||
"github.com/zhufuyi/sponge/pkg/stat"
|
||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
"github.com/go-dev-frame/sponge/pkg/stat"
|
||||
"github.com/go-dev-frame/sponge/pkg/tracer"
|
||||
|
||||
"github.com/zhufuyi/sponge/configs"
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
//"github.com/zhufuyi/sponge/internal/database"
|
||||
"github.com/go-dev-frame/sponge/configs"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
//"github.com/go-dev-frame/sponge/internal/database"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/serverNameExample_grpcHttpPbExample/initial"
|
||||
"github.com/go-dev-frame/sponge/cmd/serverNameExample_grpcHttpPbExample/initial"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -4,12 +4,12 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/zhufuyi/sponge/pkg/logger"
|
||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
"github.com/go-dev-frame/sponge/pkg/tracer"
|
||||
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
//"github.com/zhufuyi/sponge/internal/database"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
//"github.com/go-dev-frame/sponge/internal/database"
|
||||
)
|
||||
|
||||
// Close releasing resources after service exit
|
||||
|
|
|
@ -3,10 +3,10 @@ package initial
|
|||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
"github.com/zhufuyi/sponge/internal/server"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
"github.com/go-dev-frame/sponge/internal/server"
|
||||
)
|
||||
|
||||
// CreateServices create grpc service
|
||||
|
|
|
@ -7,13 +7,13 @@ import (
|
|||
"flag"
|
||||
"strconv"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/logger"
|
||||
"github.com/zhufuyi/sponge/pkg/stat"
|
||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
"github.com/go-dev-frame/sponge/pkg/stat"
|
||||
"github.com/go-dev-frame/sponge/pkg/tracer"
|
||||
|
||||
"github.com/zhufuyi/sponge/configs"
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
//"github.com/zhufuyi/sponge/internal/database"
|
||||
"github.com/go-dev-frame/sponge/configs"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
//"github.com/go-dev-frame/sponge/internal/database"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/serverNameExample_grpcPbExample/initial"
|
||||
"github.com/go-dev-frame/sponge/cmd/serverNameExample_grpcPbExample/initial"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -4,12 +4,12 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/zhufuyi/sponge/pkg/logger"
|
||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
"github.com/go-dev-frame/sponge/pkg/tracer"
|
||||
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
"github.com/zhufuyi/sponge/internal/database"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
"github.com/go-dev-frame/sponge/internal/database"
|
||||
)
|
||||
|
||||
// Close releasing resources after service exit
|
||||
|
|
|
@ -3,10 +3,10 @@ package initial
|
|||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
"github.com/zhufuyi/sponge/internal/server"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
"github.com/go-dev-frame/sponge/internal/server"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
)
|
||||
|
||||
// CreateServices create http service
|
||||
|
|
|
@ -7,13 +7,13 @@ import (
|
|||
"flag"
|
||||
"strconv"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/logger"
|
||||
"github.com/zhufuyi/sponge/pkg/stat"
|
||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
"github.com/go-dev-frame/sponge/pkg/stat"
|
||||
"github.com/go-dev-frame/sponge/pkg/tracer"
|
||||
|
||||
"github.com/zhufuyi/sponge/configs"
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
"github.com/zhufuyi/sponge/internal/database"
|
||||
"github.com/go-dev-frame/sponge/configs"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
"github.com/go-dev-frame/sponge/internal/database"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/serverNameExample_httpExample/initial"
|
||||
"github.com/go-dev-frame/sponge/cmd/serverNameExample_httpExample/initial"
|
||||
)
|
||||
|
||||
// @title serverNameExample api docs
|
||||
|
|
|
@ -4,12 +4,12 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/zhufuyi/sponge/pkg/logger"
|
||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
"github.com/go-dev-frame/sponge/pkg/tracer"
|
||||
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
//"github.com/zhufuyi/sponge/internal/database"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
//"github.com/go-dev-frame/sponge/internal/database"
|
||||
)
|
||||
|
||||
// Close releasing resources after service exit
|
||||
|
|
|
@ -3,10 +3,10 @@ package initial
|
|||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
"github.com/zhufuyi/sponge/internal/server"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
"github.com/go-dev-frame/sponge/internal/server"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
)
|
||||
|
||||
// CreateServices create http service
|
||||
|
|
|
@ -7,13 +7,13 @@ import (
|
|||
"flag"
|
||||
"strconv"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/logger"
|
||||
"github.com/zhufuyi/sponge/pkg/stat"
|
||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
"github.com/go-dev-frame/sponge/pkg/stat"
|
||||
"github.com/go-dev-frame/sponge/pkg/tracer"
|
||||
|
||||
"github.com/zhufuyi/sponge/configs"
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
//"github.com/zhufuyi/sponge/internal/database"
|
||||
"github.com/go-dev-frame/sponge/configs"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
//"github.com/go-dev-frame/sponge/internal/database"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/serverNameExample_httpPbExample/initial"
|
||||
"github.com/go-dev-frame/sponge/cmd/serverNameExample_httpPbExample/initial"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -4,12 +4,12 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/zhufuyi/sponge/pkg/logger"
|
||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
"github.com/go-dev-frame/sponge/pkg/tracer"
|
||||
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
"github.com/zhufuyi/sponge/internal/database"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
"github.com/go-dev-frame/sponge/internal/database"
|
||||
)
|
||||
|
||||
// Close releasing resources after service exit
|
||||
|
|
|
@ -4,15 +4,15 @@ import (
|
|||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"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/go-dev-frame/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
"github.com/go-dev-frame/sponge/pkg/servicerd/registry"
|
||||
"github.com/go-dev-frame/sponge/pkg/servicerd/registry/consul"
|
||||
"github.com/go-dev-frame/sponge/pkg/servicerd/registry/etcd"
|
||||
"github.com/go-dev-frame/sponge/pkg/servicerd/registry/nacos"
|
||||
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
"github.com/zhufuyi/sponge/internal/server"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
"github.com/go-dev-frame/sponge/internal/server"
|
||||
)
|
||||
|
||||
// CreateServices create grpc or http service
|
||||
|
|
|
@ -10,15 +10,15 @@ import (
|
|||
|
||||
"github.com/jinzhu/copier"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/conf"
|
||||
"github.com/zhufuyi/sponge/pkg/logger"
|
||||
"github.com/zhufuyi/sponge/pkg/nacoscli"
|
||||
"github.com/zhufuyi/sponge/pkg/stat"
|
||||
"github.com/zhufuyi/sponge/pkg/tracer"
|
||||
"github.com/go-dev-frame/sponge/pkg/conf"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
"github.com/go-dev-frame/sponge/pkg/nacoscli"
|
||||
"github.com/go-dev-frame/sponge/pkg/stat"
|
||||
"github.com/go-dev-frame/sponge/pkg/tracer"
|
||||
|
||||
"github.com/zhufuyi/sponge/configs"
|
||||
"github.com/zhufuyi/sponge/internal/config"
|
||||
"github.com/zhufuyi/sponge/internal/database"
|
||||
"github.com/go-dev-frame/sponge/configs"
|
||||
"github.com/go-dev-frame/sponge/internal/config"
|
||||
"github.com/go-dev-frame/sponge/internal/database"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/zhufuyi/sponge/pkg/app"
|
||||
"github.com/go-dev-frame/sponge/pkg/app"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/serverNameExample_mixExample/initial"
|
||||
"github.com/go-dev-frame/sponge/cmd/serverNameExample_mixExample/initial"
|
||||
)
|
||||
|
||||
// @title serverNameExample api docs
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
)
|
||||
|
||||
// CacheCommand generate cache code
|
||||
|
@ -171,7 +171,7 @@ func (g *stringCacheGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
|
||||
fields = append(fields, []replacer.Field{
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge/internal/model",
|
||||
Old: "github.com/go-dev-frame/sponge/internal/model",
|
||||
New: g.moduleName + "/internal/model",
|
||||
},
|
||||
{
|
||||
|
|
|
@ -19,11 +19,11 @@ import (
|
|||
|
||||
"github.com/huandu/xstrings"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/gobash"
|
||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||
"github.com/zhufuyi/sponge/pkg/sql2code/parser"
|
||||
"github.com/zhufuyi/sponge/pkg/utils"
|
||||
"github.com/go-dev-frame/sponge/pkg/gobash"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code/parser"
|
||||
"github.com/go-dev-frame/sponge/pkg/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -160,7 +160,7 @@ var (
|
|||
wellEndMark = symbolConvert(endMarkStr)
|
||||
|
||||
// embed FS template file when using
|
||||
selfPackageName = "github.com/zhufuyi/sponge"
|
||||
selfPackageName = "github.com/go-dev-frame/sponge"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -537,7 +537,7 @@ func getLocalSpongeTemplateVersion() string {
|
|||
if v == "" {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("github.com/zhufuyi/sponge %s", v)
|
||||
return fmt.Sprintf("github.com/go-dev-frame/sponge %s", v)
|
||||
}
|
||||
|
||||
func getEmbedTimeCode(isEmbed bool) string {
|
||||
|
@ -758,7 +758,7 @@ func serverCodeFields(serverType string, moduleName string, serverName string) [
|
|||
},
|
||||
{
|
||||
Old: fmt.Sprintf("go get %s@", moduleName),
|
||||
New: fmt.Sprintf("go get %s@", "github.com/zhufuyi/sponge"),
|
||||
New: fmt.Sprintf("go get %s@", "github.com/go-dev-frame/sponge"),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -901,7 +901,7 @@ func setReadmeTitle(moduleName string, serverName string, serverType string, sui
|
|||
func GetGoModFields(moduleName string) []replacer.Field {
|
||||
return []replacer.Field{
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge",
|
||||
Old: "github.com/go-dev-frame/sponge",
|
||||
New: moduleName,
|
||||
},
|
||||
{
|
||||
|
@ -1001,7 +1001,7 @@ func replaceTemplateFileContent(r replacer.Replacer, file string, crudInfo *pars
|
|||
|
||||
dstContent := buf.String()
|
||||
if !strings.Contains(dstContent, "utils.") {
|
||||
dstContent = strings.ReplaceAll(dstContent, `"github.com/zhufuyi/sponge/pkg/utils"`, "")
|
||||
dstContent = strings.ReplaceAll(dstContent, `"github.com/go-dev-frame/sponge/pkg/utils"`, "")
|
||||
}
|
||||
if !strings.Contains(dstContent, "math.MaxInt32") {
|
||||
dstContent = strings.ReplaceAll(dstContent, `"math"`, "")
|
||||
|
|
|
@ -11,8 +11,8 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||
"github.com/zhufuyi/sponge/pkg/jy2struct"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/jy2struct"
|
||||
)
|
||||
|
||||
// ConfigCommand convert yaml to struct command
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/huandu/xstrings"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
)
|
||||
|
||||
// ConfigmapCommand generate k8s configmap command
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"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/go-dev-frame/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code/parser"
|
||||
)
|
||||
|
||||
// DaoCommand generate dao code
|
||||
|
@ -268,12 +268,12 @@ func (g *daoGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
New: g.moduleName,
|
||||
},
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge",
|
||||
Old: "github.com/go-dev-frame/sponge",
|
||||
New: g.moduleName,
|
||||
},
|
||||
{
|
||||
Old: g.moduleName + pkgPathSuffix,
|
||||
New: "github.com/zhufuyi/sponge/pkg",
|
||||
New: "github.com/go-dev-frame/sponge/pkg",
|
||||
},
|
||||
{
|
||||
Old: "init.go.mgo",
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/huandu/xstrings"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
)
|
||||
|
||||
// GRPCAndHTTPPbCommand generate grpc+http service code bash on protobuf file
|
||||
|
@ -258,12 +258,12 @@ func (g *httpAndGRPCPbGenerator) addFields(r replacer.Replacer) []replacer.Field
|
|||
New: protoShellServiceAndHandlerCode,
|
||||
},
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge",
|
||||
Old: "github.com/go-dev-frame/sponge",
|
||||
New: g.moduleName,
|
||||
},
|
||||
{
|
||||
Old: g.moduleName + pkgPathSuffix,
|
||||
New: "github.com/zhufuyi/sponge/pkg",
|
||||
New: "github.com/go-dev-frame/sponge/pkg",
|
||||
},
|
||||
{ // replace the sponge version of the go.mod file
|
||||
Old: spongeTemplateVersionMark,
|
||||
|
@ -328,12 +328,12 @@ func (g *httpAndGRPCPbGenerator) addFields(r replacer.Replacer) []replacer.Field
|
|||
New: "// implemented on port 8283",
|
||||
},
|
||||
{
|
||||
Old: `"github.com/zhufuyi/sponge/pkg/gin/prof"`,
|
||||
Old: `"github.com/go-dev-frame/sponge/pkg/gin/prof"`,
|
||||
New: "",
|
||||
},
|
||||
{
|
||||
Old: "reference-db-config-url",
|
||||
New: "Reference: https://github.com/zhufuyi/sponge/blob/main/configs/serverNameExample.yml#L87",
|
||||
New: "Reference: https://github.com/go-dev-frame/sponge/blob/main/configs/serverNameExample.yml#L87",
|
||||
},
|
||||
}...)
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"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/go-dev-frame/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code/parser"
|
||||
)
|
||||
|
||||
// HandlerPbCommand generate handler and protobuf code
|
||||
|
@ -308,7 +308,7 @@ func (g *handlerPbGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
New: g.moduleName,
|
||||
},
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge",
|
||||
Old: "github.com/go-dev-frame/sponge",
|
||||
New: g.moduleName,
|
||||
},
|
||||
// replace directory name
|
||||
|
@ -331,7 +331,7 @@ func (g *handlerPbGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
},
|
||||
{
|
||||
Old: g.moduleName + pkgPathSuffix,
|
||||
New: "github.com/zhufuyi/sponge/pkg",
|
||||
New: "github.com/go-dev-frame/sponge/pkg",
|
||||
},
|
||||
{
|
||||
Old: "userExample_logic.go.mgo",
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"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/go-dev-frame/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code/parser"
|
||||
)
|
||||
|
||||
// HandlerCommand generate handler code
|
||||
|
@ -303,7 +303,7 @@ func (g *handlerGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
New: g.moduleName,
|
||||
},
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge",
|
||||
Old: "github.com/go-dev-frame/sponge",
|
||||
New: g.moduleName,
|
||||
},
|
||||
{
|
||||
|
@ -312,7 +312,7 @@ func (g *handlerGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
},
|
||||
{
|
||||
Old: g.moduleName + pkgPathSuffix,
|
||||
New: "github.com/zhufuyi/sponge/pkg",
|
||||
New: "github.com/go-dev-frame/sponge/pkg",
|
||||
},
|
||||
{
|
||||
Old: "userExample_types.go.mgo",
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/huandu/xstrings"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
)
|
||||
|
||||
// HTTPPbCommand generate web service code based on protobuf file
|
||||
|
@ -257,12 +257,12 @@ func (g *httpPbGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
New: protoShellHandlerCode,
|
||||
},
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge",
|
||||
Old: "github.com/go-dev-frame/sponge",
|
||||
New: g.moduleName,
|
||||
},
|
||||
{
|
||||
Old: g.moduleName + pkgPathSuffix,
|
||||
New: "github.com/zhufuyi/sponge/pkg",
|
||||
New: "github.com/go-dev-frame/sponge/pkg",
|
||||
},
|
||||
{ // replace the sponge version of the go.mod file
|
||||
Old: spongeTemplateVersionMark,
|
||||
|
|
|
@ -10,9 +10,9 @@ import (
|
|||
"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/go-dev-frame/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code/parser"
|
||||
)
|
||||
|
||||
// HTTPCommand generate web service code
|
||||
|
@ -417,7 +417,7 @@ func (g *httpGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
Old: k8sServiceFileMark,
|
||||
New: k8sServiceFileHTTPCode,
|
||||
},
|
||||
{ // replace github.com/zhufuyi/sponge/templates/sponge
|
||||
{ // replace github.com/go-dev-frame/sponge/templates/sponge
|
||||
Old: selfPackageName + "/" + r.GetSourcePath(),
|
||||
New: g.moduleName,
|
||||
},
|
||||
|
@ -430,12 +430,12 @@ func (g *httpGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
New: "",
|
||||
},
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge",
|
||||
Old: "github.com/go-dev-frame/sponge",
|
||||
New: g.moduleName,
|
||||
},
|
||||
{
|
||||
Old: g.moduleName + pkgPathSuffix,
|
||||
New: "github.com/zhufuyi/sponge/pkg",
|
||||
New: "github.com/go-dev-frame/sponge/pkg",
|
||||
},
|
||||
{ // replace the sponge version of the go.mod file
|
||||
Old: spongeTemplateVersionMark,
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
)
|
||||
|
||||
const warnSymbol = "⚠ "
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"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/go-dev-frame/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code/parser"
|
||||
)
|
||||
|
||||
// ModelCommand generate model code
|
||||
|
|
|
@ -8,10 +8,10 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"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/go-dev-frame/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code/parser"
|
||||
)
|
||||
|
||||
// ProtobufCommand generate protobuf code
|
||||
|
@ -160,7 +160,7 @@ func (g *protobufGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
New: g.codes[parser.CodeTypeProto],
|
||||
},
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge",
|
||||
Old: "github.com/go-dev-frame/sponge",
|
||||
New: g.moduleName,
|
||||
},
|
||||
// replace directory name
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
)
|
||||
|
||||
// GRPCConnectionCommand generate grpc connection code
|
||||
|
@ -132,11 +132,11 @@ func (g *grpcConnectionGenerator) addFields() []replacer.Field {
|
|||
|
||||
fields = append(fields, []replacer.Field{
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge/configs",
|
||||
Old: "github.com/go-dev-frame/sponge/configs",
|
||||
New: g.moduleName + "/configs",
|
||||
},
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge/internal/config",
|
||||
Old: "github.com/go-dev-frame/sponge/internal/config",
|
||||
New: g.moduleName + "/internal/config",
|
||||
},
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/huandu/xstrings"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
)
|
||||
|
||||
// RPCGwPbCommand generate grpc gateway service code base on protobuf file
|
||||
|
@ -261,12 +261,12 @@ func (g *rpcGwPbGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
New: protoShellServiceCode,
|
||||
},
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge",
|
||||
Old: "github.com/go-dev-frame/sponge",
|
||||
New: g.moduleName,
|
||||
},
|
||||
{
|
||||
Old: g.moduleName + pkgPathSuffix,
|
||||
New: "github.com/zhufuyi/sponge/pkg",
|
||||
New: "github.com/go-dev-frame/sponge/pkg",
|
||||
},
|
||||
{ // replace the sponge version of the go.mod file
|
||||
Old: spongeTemplateVersionMark,
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/huandu/xstrings"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
)
|
||||
|
||||
// RPCPbCommand generate grpc service code bash on protobuf file
|
||||
|
@ -251,12 +251,12 @@ func (g *rpcPbGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
New: protoShellServiceTmplCode,
|
||||
},
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge",
|
||||
Old: "github.com/go-dev-frame/sponge",
|
||||
New: g.moduleName,
|
||||
},
|
||||
{
|
||||
Old: g.moduleName + pkgPathSuffix,
|
||||
New: "github.com/zhufuyi/sponge/pkg",
|
||||
New: "github.com/go-dev-frame/sponge/pkg",
|
||||
},
|
||||
{ // replace the sponge version of the go.mod file
|
||||
Old: spongeTemplateVersionMark,
|
||||
|
|
|
@ -10,10 +10,10 @@ import (
|
|||
"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/go-dev-frame/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code/parser"
|
||||
)
|
||||
|
||||
// RPCCommand generate grpc service code
|
||||
|
@ -431,7 +431,7 @@ func (g *rpcGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
Old: k8sServiceFileMark,
|
||||
New: k8sServiceFileGrpcCode,
|
||||
},
|
||||
{ // replace github.com/zhufuyi/sponge/templates/sponge
|
||||
{ // replace github.com/go-dev-frame/sponge/templates/sponge
|
||||
Old: selfPackageName + "/" + r.GetSourcePath(),
|
||||
New: g.moduleName,
|
||||
},
|
||||
|
@ -441,12 +441,12 @@ func (g *rpcGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
New: strings.Join([]string{"api", g.serverName, "v1"}, gofile.GetPathDelimiter()),
|
||||
},
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge",
|
||||
Old: "github.com/go-dev-frame/sponge",
|
||||
New: g.moduleName,
|
||||
},
|
||||
{
|
||||
Old: g.moduleName + pkgPathSuffix,
|
||||
New: "github.com/zhufuyi/sponge/pkg",
|
||||
New: "github.com/go-dev-frame/sponge/pkg",
|
||||
},
|
||||
{ // replace the sponge version of the go.mod file
|
||||
Old: spongeTemplateVersionMark,
|
||||
|
|
|
@ -9,10 +9,10 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"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/go-dev-frame/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code/parser"
|
||||
)
|
||||
|
||||
// ServiceAndHandlerCRUDCommand generate both service and handler CRUD code
|
||||
|
@ -319,7 +319,7 @@ func (g *serviceAndHandlerGenerator) addFields(r replacer.Replacer) []replacer.F
|
|||
New: g.moduleName,
|
||||
},
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge",
|
||||
Old: "github.com/go-dev-frame/sponge",
|
||||
New: g.moduleName,
|
||||
},
|
||||
// replace directory name
|
||||
|
@ -346,7 +346,7 @@ func (g *serviceAndHandlerGenerator) addFields(r replacer.Replacer) []replacer.F
|
|||
},
|
||||
{
|
||||
Old: g.moduleName + pkgPathSuffix,
|
||||
New: "github.com/zhufuyi/sponge/pkg",
|
||||
New: "github.com/go-dev-frame/sponge/pkg",
|
||||
},
|
||||
{
|
||||
Old: "serverNameExample",
|
||||
|
|
|
@ -9,10 +9,10 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"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/go-dev-frame/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code/parser"
|
||||
)
|
||||
|
||||
// ServiceCommand generate service code
|
||||
|
@ -317,7 +317,7 @@ func (g *serviceGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
New: g.moduleName,
|
||||
},
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge",
|
||||
Old: "github.com/go-dev-frame/sponge",
|
||||
New: g.moduleName,
|
||||
},
|
||||
// replace directory name
|
||||
|
@ -340,7 +340,7 @@ func (g *serviceGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
},
|
||||
{
|
||||
Old: g.moduleName + pkgPathSuffix,
|
||||
New: "github.com/zhufuyi/sponge/pkg",
|
||||
New: "github.com/go-dev-frame/sponge/pkg",
|
||||
},
|
||||
{
|
||||
Old: "serverNameExample",
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
)
|
||||
|
||||
// ConvertSwagJSONCommand convert 64-bit fields type string to integer
|
||||
|
|
|
@ -197,12 +197,12 @@ fi`
|
|||
port: 8283
|
||||
targetPort: 8283`
|
||||
|
||||
configFileCode = `// code generated by https://github.com/zhufuyi/sponge
|
||||
configFileCode = `// code generated by https://github.com/go-dev-frame/sponge
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/zhufuyi/sponge/pkg/conf"
|
||||
"github.com/go-dev-frame/sponge/pkg/conf"
|
||||
)
|
||||
|
||||
var config *Config
|
||||
|
@ -228,12 +228,12 @@ func Set(conf *Config) {
|
|||
}
|
||||
`
|
||||
|
||||
configFileCcCode = `// code generated by https://github.com/zhufuyi/sponge
|
||||
configFileCcCode = `// code generated by https://github.com/go-dev-frame/sponge
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/zhufuyi/sponge/pkg/conf"
|
||||
"github.com/go-dev-frame/sponge/pkg/conf"
|
||||
)
|
||||
|
||||
func NewCenter(configFile string) (*Center, error) {
|
||||
|
@ -550,7 +550,7 @@ func InitDB() {
|
|||
gdb = InitMysql()
|
||||
default:
|
||||
panic("InitDB error, please modify the correct 'database' configuration at yaml file. " +
|
||||
"Refer to https://github.com/zhufuyi/sponge/blob/main/configs/serverNameExample.yml#L85")
|
||||
"Refer to https://github.com/go-dev-frame/sponge/blob/main/configs/serverNameExample.yml#L85")
|
||||
}
|
||||
}`
|
||||
|
||||
|
@ -562,7 +562,7 @@ func InitDB() {
|
|||
gdb = InitPostgresql()
|
||||
default:
|
||||
panic("InitDB error, please modify the correct 'database' configuration at yaml file. " +
|
||||
"Refer to https://github.com/zhufuyi/sponge/blob/main/configs/serverNameExample.yml#L85")
|
||||
"Refer to https://github.com/go-dev-frame/sponge/blob/main/configs/serverNameExample.yml#L85")
|
||||
}
|
||||
}`
|
||||
|
||||
|
@ -574,7 +574,7 @@ func InitDB() {
|
|||
gdb = InitSqlite()
|
||||
default:
|
||||
panic("InitDB error, please modify the correct 'database' configuration at yaml file. " +
|
||||
"Refer to https://github.com/zhufuyi/sponge/blob/main/configs/serverNameExample.yml#L85")
|
||||
"Refer to https://github.com/go-dev-frame/sponge/blob/main/configs/serverNameExample.yml#L85")
|
||||
}
|
||||
}`
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/gobash"
|
||||
"github.com/go-dev-frame/sponge/pkg/gobash"
|
||||
)
|
||||
|
||||
// GenGraphCommand generate graph command
|
||||
|
@ -40,7 +40,7 @@ func GenGraphCommand() *cobra.Command {
|
|||
_, err := gobash.Exec("spograph", "-h")
|
||||
if err != nil {
|
||||
fmt.Printf("not found spograph command, please install it by running the following command: %s\n",
|
||||
color.HiCyanString("go install github.com/zhufuyi/spograph@latest"))
|
||||
color.HiCyanString("go install github.com/go-dev-frame/spograph@latest"))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package commands
|
|||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/merge"
|
||||
"github.com/go-dev-frame/sponge/cmd/sponge/commands/merge"
|
||||
)
|
||||
|
||||
// MergeCommand merge the generated code
|
||||
|
|
|
@ -19,8 +19,8 @@ import (
|
|||
|
||||
"github.com/fatih/color"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/gobash"
|
||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/gobash"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -114,7 +114,7 @@ func (m *mergeParam) runMergeCode(file string) (string, error) {
|
|||
count2 := bytes.Count(data2, m.splitLineMark)
|
||||
if count1 != count2 {
|
||||
return "", errors.New(color.RedString("merge code failed (%s --> %s), manually merge code"+
|
||||
" reference document https://github.com/zhufuyi/sponge/tree/main/cmd/sponge/commands/merge",
|
||||
" reference document https://github.com/go-dev-frame/sponge/tree/main/cmd/sponge/commands/merge",
|
||||
cutPathPrefix(file), getTargetFilename(file)))
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ func (m *mergeParam) runMergeCode(file string) (string, error) {
|
|||
|
||||
if len(data1) > len(data) {
|
||||
return "", errors.New(color.RedString("merge code failed (%s --> %s), to avoid replacing logical code, "+
|
||||
"manually merge code reference document https://github.com/zhufuyi/sponge/tree/main/cmd/sponge/commands/merge",
|
||||
"manually merge code reference document https://github.com/go-dev-frame/sponge/tree/main/cmd/sponge/commands/merge",
|
||||
cutPathPrefix(file), getTargetFilename(file)))
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package commands
|
|||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
||||
"github.com/go-dev-frame/sponge/cmd/sponge/commands/generate"
|
||||
)
|
||||
|
||||
// GenMicroCommand generate micro service code
|
||||
|
|
|
@ -3,7 +3,7 @@ package commands
|
|||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/patch"
|
||||
"github.com/go-dev-frame/sponge/cmd/sponge/commands/patch"
|
||||
)
|
||||
|
||||
// PatchCommand patch server code
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
)
|
||||
|
||||
// AdaptMonoRepoCommand Adapt to mono-repo command
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
)
|
||||
|
||||
// get moduleName and serverName from directory
|
||||
|
|
|
@ -9,8 +9,8 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/cmd/sponge/commands/generate"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
)
|
||||
|
||||
// CopyGOModCommand copy go mod files
|
||||
|
|
|
@ -14,8 +14,8 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/gobash"
|
||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/gobash"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
)
|
||||
|
||||
var copyCount = 0
|
||||
|
|
|
@ -7,8 +7,8 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/cmd/sponge/commands/generate"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
)
|
||||
|
||||
// CopyThirdPartyProtoCommand copy third-party proto files
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
)
|
||||
|
||||
// DeleteJSONOmitemptyCommand delete json omitempty
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"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/go-dev-frame/sponge/cmd/sponge/commands/generate"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
)
|
||||
|
||||
// GenerateDBInitCommand generate database initialization code
|
||||
|
@ -151,12 +151,12 @@ func (g *dbInitGenerator) addFields(r replacer.Replacer) []replacer.Field {
|
|||
fields = append(fields, generate.DeleteCodeMark(r, generate.ModelInitDBFile, generate.StartMark, generate.EndMark)...)
|
||||
fields = append(fields, []replacer.Field{
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge/internal",
|
||||
Old: "github.com/go-dev-frame/sponge/internal",
|
||||
New: g.moduleName + "/internal",
|
||||
IsCaseSensitive: false,
|
||||
},
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge/configs",
|
||||
Old: "github.com/go-dev-frame/sponge/configs",
|
||||
New: g.moduleName + "/configs",
|
||||
IsCaseSensitive: false,
|
||||
},
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"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/go-dev-frame/sponge/cmd/sponge/commands/generate"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
)
|
||||
|
||||
// GenTypesPbCommand generate types.proto code
|
||||
|
@ -113,7 +113,7 @@ func addTypePbFields(moduleName string) []replacer.Field {
|
|||
|
||||
fields = append(fields, []replacer.Field{
|
||||
{
|
||||
Old: "github.com/zhufuyi/sponge",
|
||||
Old: "github.com/go-dev-frame/sponge",
|
||||
New: moduleName,
|
||||
IsCaseSensitive: false,
|
||||
},
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
)
|
||||
|
||||
// ModifyProtoPackageCommand modifies the package and go_package names of proto files.
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/gobash"
|
||||
"github.com/go-dev-frame/sponge/pkg/gobash"
|
||||
)
|
||||
|
||||
var pluginNames = []string{
|
||||
|
@ -38,9 +38,9 @@ var installPluginCommands = map[string]string{
|
|||
"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-gotag": "github.com/srikrsna/protoc-gen-gotag@latest",
|
||||
"protoc-gen-go-gin": "github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin@latest",
|
||||
"protoc-gen-go-rpc-tmpl": "github.com/zhufuyi/sponge/cmd/protoc-gen-go-rpc-tmpl@latest",
|
||||
"protoc-gen-json-field": "github.com/zhufuyi/sponge/cmd/protoc-gen-json-field@latest",
|
||||
"protoc-gen-go-gin": "github.com/go-dev-frame/sponge/cmd/protoc-gen-go-gin@latest",
|
||||
"protoc-gen-go-rpc-tmpl": "github.com/go-dev-frame/sponge/cmd/protoc-gen-go-rpc-tmpl@latest",
|
||||
"protoc-gen-json-field": "github.com/go-dev-frame/sponge/cmd/protoc-gen-json-field@latest",
|
||||
"protoc-gen-openapiv2": "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest",
|
||||
"protoc-gen-doc": "github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest",
|
||||
"swag": "github.com/swaggo/swag/cmd/swag@v1.8.12",
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
||||
"github.com/go-dev-frame/sponge/cmd/sponge/commands/generate"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -22,7 +22,7 @@ func NewRootCMD() *cobra.Command {
|
|||
Use: "sponge",
|
||||
Long: fmt.Sprintf(`Sponge is a powerful Go development framework, it's easy to develop web and microservice projects.
|
||||
Repo: %s
|
||||
Docs: %s`, color.HiCyanString("https://github.com/zhufuyi/sponge"), color.HiCyanString("https://go-sponge.com")),
|
||||
Docs: %s`, color.HiCyanString("https://github.com/go-dev-frame/sponge"), color.HiCyanString("https://go-sponge.com")),
|
||||
SilenceErrors: true,
|
||||
SilenceUsage: true,
|
||||
Version: getVersion(),
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/sponge/server"
|
||||
"github.com/go-dev-frame/sponge/cmd/sponge/server"
|
||||
)
|
||||
|
||||
// OpenUICommand run the sponge ui service
|
||||
|
|
|
@ -3,7 +3,7 @@ package commands
|
|||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/template"
|
||||
"github.com/go-dev-frame/sponge/cmd/sponge/commands/template"
|
||||
)
|
||||
|
||||
// TemplateCommand generate code based on custom templates
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
)
|
||||
|
||||
func parseFields(jsonFile string) (map[string]interface{}, error) {
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -12,12 +12,12 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/gobash"
|
||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||
"github.com/zhufuyi/sponge/pkg/krand"
|
||||
"github.com/zhufuyi/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/gobash"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/krand"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
||||
"github.com/go-dev-frame/sponge/cmd/sponge/commands/generate"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -9,10 +9,10 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"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/go-dev-frame/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/replacer"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code"
|
||||
"github.com/go-dev-frame/sponge/pkg/sql2code/parser"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -11,9 +11,9 @@ import (
|
|||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/gobash"
|
||||
"github.com/zhufuyi/sponge/pkg/gofile"
|
||||
"github.com/zhufuyi/sponge/pkg/utils"
|
||||
"github.com/go-dev-frame/sponge/pkg/gobash"
|
||||
"github.com/go-dev-frame/sponge/pkg/gofile"
|
||||
"github.com/go-dev-frame/sponge/pkg/utils"
|
||||
)
|
||||
|
||||
// UpgradeCommand upgrade sponge binaries
|
||||
|
@ -89,7 +89,11 @@ func runUpgrade(targetVersion string) (string, error) {
|
|||
|
||||
func runUpgradeCommand(targetVersion string) error {
|
||||
ctx, _ := context.WithTimeout(context.Background(), time.Minute*3) //nolint
|
||||
result := gobash.Run(ctx, "go", "install", "github.com/zhufuyi/sponge/cmd/sponge@"+targetVersion)
|
||||
spongeVersion := "github.com/go-dev-frame/sponge/cmd/sponge@" + targetVersion
|
||||
if targetVersion != latestVersion && targetVersion < "v1.11.2" {
|
||||
spongeVersion = strings.ReplaceAll(spongeVersion, "go-dev-frame", "zhufuyi")
|
||||
}
|
||||
result := gobash.Run(ctx, "go", "install", spongeVersion)
|
||||
for v := range result.StdOut {
|
||||
_ = v
|
||||
}
|
||||
|
@ -113,7 +117,7 @@ func copyToTempDir(targetVersion string) (string, error) {
|
|||
spongeDirName := ""
|
||||
if targetVersion == latestVersion {
|
||||
// find the new version of the sponge code directory
|
||||
arg := fmt.Sprintf("%s/pkg/mod/github.com/zhufuyi", gopath)
|
||||
arg := fmt.Sprintf("%s/pkg/mod/github.com/go-dev-frame", gopath)
|
||||
result, err = gobash.Exec("ls", adaptPathDelimiter(arg))
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("execute command failed, %v", err)
|
||||
|
@ -121,13 +125,13 @@ func copyToTempDir(targetVersion string) (string, error) {
|
|||
|
||||
spongeDirName = getLatestVersion(string(result))
|
||||
if spongeDirName == "" {
|
||||
return "", fmt.Errorf("not found sponge directory in '$GOPATH/pkg/mod/github.com/zhufuyi'")
|
||||
return "", fmt.Errorf("not found sponge directory in '$GOPATH/pkg/mod/github.com/go-dev-frame'")
|
||||
}
|
||||
} else {
|
||||
spongeDirName = "sponge@" + targetVersion
|
||||
}
|
||||
|
||||
srcDir := adaptPathDelimiter(fmt.Sprintf("%s/pkg/mod/github.com/zhufuyi/%s", gopath, spongeDirName))
|
||||
srcDir := adaptPathDelimiter(fmt.Sprintf("%s/pkg/mod/github.com/go-dev-frame/%s", gopath, spongeDirName))
|
||||
destDir := adaptPathDelimiter(GetSpongeDir() + "/")
|
||||
targetDir := adaptPathDelimiter(destDir + ".sponge")
|
||||
|
||||
|
@ -209,7 +213,11 @@ func getLatestVersion(s string) string {
|
|||
|
||||
func updateSpongeInternalPlugin(targetVersion string) error {
|
||||
ctx, _ := context.WithTimeout(context.Background(), time.Minute) //nolint
|
||||
result := gobash.Run(ctx, "go", "install", "github.com/zhufuyi/sponge/cmd/protoc-gen-go-gin@"+targetVersion)
|
||||
genGinVersion := "github.com/go-dev-frame/sponge/cmd/protoc-gen-go-gin@" + targetVersion
|
||||
if targetVersion < "v1.11.2" {
|
||||
genGinVersion = strings.ReplaceAll(genGinVersion, "go-dev-frame", "zhufuyi")
|
||||
}
|
||||
result := gobash.Run(ctx, "go", "install", genGinVersion)
|
||||
for v := range result.StdOut {
|
||||
_ = v
|
||||
}
|
||||
|
@ -218,7 +226,11 @@ func updateSpongeInternalPlugin(targetVersion string) error {
|
|||
}
|
||||
|
||||
ctx, _ = context.WithTimeout(context.Background(), time.Minute) //nolint
|
||||
result = gobash.Run(ctx, "go", "install", "github.com/zhufuyi/sponge/cmd/protoc-gen-go-rpc-tmpl@"+targetVersion)
|
||||
genRPCVersion := "github.com/go-dev-frame/sponge/cmd/protoc-gen-go-rpc-tmpl@" + targetVersion
|
||||
if targetVersion < "v1.11.2" {
|
||||
genRPCVersion = strings.ReplaceAll(genRPCVersion, "go-dev-frame", "zhufuyi")
|
||||
}
|
||||
result = gobash.Run(ctx, "go", "install", genRPCVersion)
|
||||
for v := range result.StdOut {
|
||||
_ = v
|
||||
}
|
||||
|
@ -229,7 +241,11 @@ func updateSpongeInternalPlugin(targetVersion string) error {
|
|||
// v1.x.x version does not support protoc-gen-json-field
|
||||
if !strings.HasPrefix(targetVersion, "v1") {
|
||||
ctx, _ = context.WithTimeout(context.Background(), time.Minute) //nolint
|
||||
result = gobash.Run(ctx, "go", "install", "github.com/zhufuyi/sponge/cmd/protoc-gen-json-field@"+targetVersion)
|
||||
genJSONVersion := "github.com/go-dev-frame/sponge/cmd/protoc-gen-json-field@" + targetVersion
|
||||
if targetVersion < "v1.11.2" {
|
||||
genJSONVersion = strings.ReplaceAll(genJSONVersion, "go-dev-frame", "zhufuyi")
|
||||
}
|
||||
result = gobash.Run(ctx, "go", "install", genJSONVersion)
|
||||
for v := range result.StdOut {
|
||||
_ = v
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package commands
|
|||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/zhufuyi/sponge/cmd/sponge/commands/generate"
|
||||
"github.com/go-dev-frame/sponge/cmd/sponge/commands/generate"
|
||||
)
|
||||
|
||||
// GenWebCommand generate web server code
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue