
スポンジは、強力なGo開発フレームワークです。そのコアコンセプトは、 JSON 、 SQL 、またはProtobufファイルを解析することにより、リバースエンジニアリングモジュラーコードを中心に展開します。生成されたコードは、さまざまな種類の完全なバックエンドサービスに柔軟かつシームレスに組み立てられます(分解されたスポンジセルが自動的に新しいスポンジに再結合できるスポンジセルの特性と同様)。 Spongeは、プロジェクト開発、コード生成、開発、テスト、APIドキュメント、展開をカバーするためのオールインワンソリューションを提供し、開発効率を大幅に向上させ、複雑さを減らし、「低コードアプローチ」で高品質のプロジェクトを可能にします。
スポンジは、以下を含むがこれらに限定されない、さまざまな高性能バックエンドサービスを迅速に開発するのに適しています。
Web Services(GIN);gRPCサービス。HTTP+gRPCハイブリッドサービス。gRPC Gateway APIサービス。さらに、開発者はカスタムテンプレートを使用して、さまざまな種類のコードを生成して、特定のビジネスニーズを満たすことができます。
完全なバックエンドサービスコードの1つの生成CRUD APIsのみを必要とするWebまたはgRPCサービスの場合、 Goコードを記述する必要はありません。データベース( MySQL 、 MongoDB 、 PostgreSQL 、 SQLite )に接続して、完全なバックエンドサービスコードを1クリックし、Linuxサーバー、Docker、またはKubernetesに簡単に展開します。
汎用サービスの効率的な開発
汎用Web 、 gRPC 、 HTTP+gRPC 、またはgRPC Gatewayサービスを開発する場合、3つの側面に焦点を合わせる必要があります。
フレームワークコードとCRUD APIコードはすべて、Spongeによって自動的に生成されます。
柔軟な拡張性を提供するカスタムテンプレートをサポートします
Spongeは、 Go言語に限定されないカスタムテンプレートを使用して、さまざまなタイプのプロジェクト固有のコードを生成することをサポートしています。例えば:
スポンジをインストールします
Spongeは、Windows、MacOS、Linuxへのインストールをサポートしています。クリックして、スポンジインストールガイドを表示します。
コード生成UIを開きます
インストール後、次のコマンドを実行してスポンジUIを開きます。
sponge run以下に示すように、 http://localhost:24631ローカルブラウザで24631でUIインターフェイスを介してコードを生成します。
別のホストのブラウザからアクセスするには、UIを開始するときにホストIPまたはドメインを指定します
sponge run -a http://your_host_ip:24631または、DockerでUIサービスを実行して、クロスホストアクセスをサポートすることもできます。クリックして、DockerでスポンジUIサービスを実行するガイドを表示します。
Spongeは、下の図に示すように、組み込みテンプレートとカスタムテンプレートの両方を使用してコードの生成をサポートします。
Spongeは、マイクロサービスアーキテクチャに基づいて、6種類のバックエンドサービスの作成をサポートしています。以下の図は、高性能、スケーラビリティ、および組み込みのサービスガバナンス機能を備えた、典型的な層状マイクロサービス構造を示しています。
Microservicesフレームワークによって作成されたHTTPおよびGRPCサービスコードのパフォーマンステスト:50の同時、100万件の合計リクエスト。
クリックしてテストコードを表示します。
Spongeによって作成されたプロジェクトコードディレクトリ構造は、Project-Layoutに続きます。
これは、生成されたmonolithic application single repository (monolith)またはmicroservice multi-repository (multi-repo)コードのディレクトリ構造です。
.
├── api # Protobuf files and generated * pb.go directory
├── assets # Store various static resources, such as images, markdown files, etc.
├── cmd # Program entry directory
├── configs # Directory for configuration files
├── deployments # Bare metal, docker, k8s deployment script directory.
├── docs # Directory for API interface Swagger documentation.
├── internal # Directory for business logic code.
│ ├── cache # Cache directory wrapped around business logic.
│ ├── config # Directory for Go structure configuration files.
│ ├── dao # Data access directory.
│ ├── database # database directory.
│ ├── ecode # Directory for system error codes and custom business error codes.
│ ├── handler # Directory for implementing HTTP business functionality (specific to web services).
│ ├── model # Database model directory.
│ ├── routers # HTTP routing directory.
│ ├── rpcclient # Directory for client-side code that connects to grpc services.
│ ├── server # Directory for creating services, including HTTP and grpc.
│ ├── service # Directory for implementing grpc business functionality (specific to grpc services).
│ └── types # Directory for defining request and response parameter structures for HTTP.
├── pkg # Directory for shared libraries.
├── scripts # Directory for scripts.
├── test # Directory for scripts required for testing services and test SQL.
├── third_party # Directory for third-party protobuf files or external helper programs.
├── Makefile # Develop, test, deploy related command sets .
├── go.mod # Go module dependencies and version control file.
└── go.sum # Go module dependencies key and checksum file.これは、生成されたmicroservice monolithic repository (mono-repo)コード(大規模リポジトリディレクトリ構造とも呼ばれる)のディレクトリ構造です。
.
├── api
│ ├── server1 # Protobuf files and generated *pb.go directory for service 1.
│ ├── server2 # Protobuf files and generated *pb.go directory for service 2.
│ ├── server3 # Protobuf files and generated *pb.go directory for service 3.
│ └── ...
├── server1 # Code directory for Service 1, it has a similar structure to the microservice multi repo directory.
├── server2 # Code directory for Service 2, it has a similar structure to the microservice multi repo directory.
├── server3 # Code directory for Service 3, it has a similar structure to the microservice multi repo directory.
├── ...
├── third_party # Third-party protobuf files.
├── go.mod # Go module dependencies and version control file.
└── go.sum # Go module dependencies' checksums and hash keys.クリックして、コード生成、開発、構成、展開手順など、スポンジ開発プロジェクトの詳細なドキュメントを表示します。
それがあなたの助けであるならば、それに星を与えてください。