Skip to content

Latest commit

 

History

History
 
 

hertz_gorm

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

hertz_gorm

Introduce

A demo with Hertz and Gorm

  • Use thrift IDL to define HTTP interface
  • Use hz to generate code
  • Use Hertz binding and validate
  • Use Gorm and MySQL

IDL

This demo use thrift IDL to define HTTP interface. The specific interface define in api.thrift

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

This demo use Gorm to operate MySQL and refers to Gorm

How to run

Run mysql docker

cd bizdemo/hertz_gorm && docker-compose up

Generate MySQL table

Connect MySQL and execute user.sql

Run demo

cd bizdemo/hertz_gorm
go build -o hertz_gorm && ./hertz_gorm