zero

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2024 License: MIT

README ยถ

gin-zero

Release

๐Ÿคทโ€ What is gin-zero?

English | ็ฎ€ไฝ“ไธญๆ–‡

Gin-zero is a gin-based golang application scaffolding that supports one-click generation of HTTP, GRPC, Websocket applications, and can also be used to build microservice applications. It integrates many excellent open source packages internally, and also provides some modular microservices governance packages.

Gin-zero has a code generation tool called ginctl.

Are you still worried about writing the mapping structure of the database? Are you still struggling to write database field-restricted validation request structs? Get started with ginctl, which helps you write database mapping structures and validation structures through database annotations.

Ability statement

  • One command generates the entire http,grpc,websocket service
  • A command generates a Restful API, or a custom interface
  • A command generates middleware or global middleware
  • A command generates the service configuration file
  • One command to generate the service deployment folder

Support package

Environment

  • golang 1.18^

Quick start

  1. An example of http application: demo
  2. Install
git clone https://github.com/gin-ctl/zero
cd zero
go install github.com/gin-ctl/ginctl@latest
ginctl -h
# example
ginctl apply --app admin --module http # A command generates the admin application of the http request
# Next modify your etc/env.yaml file 
ginctl api -a admin -m http -l user -o ping -d test # Generate an http request interface 'ping' for the user module in the admin application
# Then go to the route directory and fill in your request method for the ping interface
  1. Directory description
  • app: application directory contains http, grpc, and websocket
  • Application directory
app/http/demo
โ”œโ”€โ”€ demo.go # main.go
โ”œโ”€โ”€ deploy  # deployment document
โ”‚ย ย  โ”œโ”€โ”€ DockerFile
โ”‚ย ย  โ”œโ”€โ”€ Makefile
โ”‚ย ย  โ”œโ”€โ”€ certificate.yaml # Subscribe to ssl encrypted files for domain names for free
โ”‚ย ย  โ”œโ”€โ”€ gateway.yaml     # Kubernetes gateway configuration file
โ”‚ย ย  โ””โ”€โ”€ k8s.yaml         # Kubernetes deployment file
โ”œโ”€โ”€ etc
โ”‚ย ย  โ””โ”€โ”€ env.yaml         # Modify your application configuration
โ”œโ”€โ”€ logic
โ”‚ย ย  โ”œโ”€โ”€ demo             # Service code
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ logic.go    # http request controller
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ types.go    # http request checksum request structure
โ”‚ย ย  โ””โ”€โ”€ logic.go
โ”œโ”€โ”€ middleware  # middleware
โ”‚ย ย  โ””โ”€โ”€ auth.go
โ”œโ”€โ”€ route  # Routing file
โ”‚ย ย  โ””โ”€โ”€ route.go
โ””โ”€โ”€ storage # Log file
    โ””โ”€โ”€ logs-2024-07-06.log

Code of Conduct

In order to ensure that the gin-zero community is welcoming to all, please review and abide by the Code of Conduct.

Security Vulnerabilities

If you discover a security vulnerability within gin-zero, please send an e-mail to Joey via golang2024@163.com. All security vulnerabilities will be promptly addressed.

License

The gin-zero framework is open-sourced software licensed under the MIT license.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL