service/

directory
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: AGPL-3.0

README

[TOC]

本地安装goctl【非官方,请使用i-Things/go-zero】

  1. 本地将 go-zero 项目克隆下来: git clone https://gitee.com/unitedrhino/go-zero.git`
  2. 到目录 go-zero\tools\goctl 下 执行命令: go install`
  3. 后续执行下面的各种goctl命令即可

环境初始化

protoc/protoc-gen-go/protoc-gen-grpc-go 依赖可以通过下列命令 一键安装

$ goctl env check --install --verbose --force

服务新增方案

rpc服务

goctl rpc new rpcsvr  --style=goZero -m

api服务

goctl api new apisvr  --style=goZero 

库表新增方案

在每个服务的 internal/repo/relationDB 目录下有example.go

  1. 借助 https://sql2gorm.mccode.info/ 生成对应的模型 放到 internal/repo/relationDB/modle.go
  2. 复制 internal/repo/relationDB/example.go 到对应目录下,并修改表名
  3. 将example.go中的Example替换为表名
  4. 定制修改对应函数即可

api网关接口代理模块-apisvr

#cd apisvr && goctl api go -api http/api.api  -dir ./  --style=goZero && cd ..
cd apisvr && goctl api go -api http/api.api  -dir ./  --style=goZero  && goctl api swagger -filename swagger.json -api http/api.api -dir ./http&&  goctl api access  -api http/api.api -dir ./http && cd ..

cd apisvr && goctl api swagger -filename swagger.json -api http/api.api -dir ./http && cd ..
cd apisvr && goctl api access  -api http/api.api -dir ./http && cd ..

设备管理模块-dmsvr

  • rpc文件编译方法
#protoc proto/* --go_out=. --go-grpc_out=.
cd dmsvr && goctl rpc protoc  proto/dm.proto --go_out=./ --go-grpc_out=./ --zrpc_out=./ --style=goZero -m && cd ..

设备网关模块-dgsvr

cd dgsvr && goctl rpc protoc  proto/dg.proto --go_out=./ --go-grpc_out=./ --zrpc_out=./ --style=goZero -m && cd ..

用户设备模块-udsvr

  • rpc文件编译
#protoc  proto/* --go_out=. --go-grpc_out=.
cd udsvr && goctl rpc protoc  proto/ud.proto --go_out=./ --go-grpc_out=./ --zrpc_out=./ --style=goZero -m && cd ..

Directories

Path Synopsis
api网关接口代理模块-apisvr
api网关接口代理模块-apisvr
设备管理模块-dmsvr
设备管理模块-dmsvr
internal/domain/deviceLog
Package device 设备操作日志
Package device 设备操作日志
internal/domain/deviceStatus
Package device 设备发送来的消息解析
Package device 设备发送来的消息解析
internal/domain/scene
Package scene 触发器
Package scene 触发器

Jump to

Keyboard shortcuts

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