hertz_gorm_gen

command module
v0.0.0-...-48f44c5 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

README

hertz_gorm_gen

Introduce

A demo with Hertz and GORM/Gen

  • Use proto IDL to define HTTP interface
  • Use hz to generate code
  • Use Hertz binding and validate
  • Use GORM/Gen and MySQL

IDL

This demo use proto IDL to define HTTP interface. The specific user interface define in user.proto.

Code generation tool

This demo use hz to generate code. The use of hz refers to hz.

The hz commands used can be found in Makefile.

Binding and Validate

The use of binding and Validate refers to Binding and Validate.

GORM/Gen

GEN: Friendly & Safer GORM powered by Code Generation.

This demo use GORM/Gen to operate MySQL and refers to Gen.

Quick Start
  • Update the Database DSN to your own in Database init file.
  • Refer to the code comments, write the configuration in Generate file.
  • Using the following command for code generation, you can generate structs from databases or basic type-safe DAO API for struct.
cd bizdemo/hertz_gorm_gen/cmd
go run generate.go

How to run

Run mysql docker
cd bizdemo/hertz_gorm_gen && docker-compose up
Run demo
cd bizdemo/hertz_gorm_gen
go build -o hertz_gorm_gen &&./hertz_gorm_gen

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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