Sample code for GoFrame and polaris
Project Makefile Commands:
make cli
: Install or Update to the latest GoFrame CLI tool.make dao
: Generate go files forEntity/DAO/DO
according to the configuration file fromhack
folder.make service
: Parselogic
folder to generate interface go files intoservice
folder.make image TAG=xxx
: Rundocker build
to build image accordingmanifest/docker
.make image.push TAG=xxx
: Rundocker build
anddocker push
to build and push image accordingmanifest/docker
.make deploy TAG=xxx
: Runkustomize build
to build and deploy deployment to kubernetes server group accordingmanifest/deploy
.
A、写入SQL文件到数据库,文件在manifest/sql/
目录下
B、执行gf gen pbentity
生成Entity/DAO/DO
文件
C、执行gf gen pb
生成PB
文件
D、修改manifest/config/config.yaml
文件
# GRPC Server.
grpc:
address: "192.168.124.12:8199"
name: "GoFramePolarisDemo"
logPath: ""
logStdout: true
errorStack: true
errorLogEnabled: true
errorLogPattern: "error-{Ymd}.log"
accessLogEnabled: true
accessLogPattern: "access-{Ymd}.log"
# Global logging.
logger:
level: "all"
stdout: true
# Database.
database:
logger:
level: "all"
stdout: true
default:
link: "mysql:root:root@tcp(127.0.0.1:3306)/test"
debug: true
1、修改IP地址`address`为本机IP
2、修改`link`为本机数据库地址
3、修改`client.go`中的`Passport`的值,保证唯一性
E、先运行main.go
中的main
函数,启动GRPC Server
服务
F、再运行client.go
中的main
函数,启动GRPC Client
服务
GoFrame-Polaris-Demo
software is licenced under the Apache License Version 2.0. See the LICENSE file for details.