.github .resources admin client codec config docs errs examples filter healthcheck http internal log metrics naming plugin pool restful rpcz server stream test testdata transport .gitattributes .gitignore .golangci.yml .typos.toml CHANGELOG.md CODE-OF-CONDUCT.md CODE-OF-CONDUCT.zh_CN.md CONTRIBUT...
Database implementations for tRPC-Go. Contribute to trpc-ecosystem/go-database development by creating an account on GitHub.
import"github.com/Andrew-M-C/trpc-go-utils/plugin"// ...clientYamlConf:=struct{Keystring`yaml:"key"`}{} 然后,利用 Go 泛型的类型推测机制,开发者只需要将上面这个 struct 类型的地址作为 Bind 的参数即可: 代码语言:go 复制 plugin.Bind("config","client_yaml",&clientYamlConf) 调完trpc.NewServ...
我们新建一个simplest_main.go文件,输入以下内容: packagemainimport("context""fmt""time"// proto package 的路径请读者自行调整"github.com/Andrew-M-C/trpc-go-demo/proto/simplest""trpc.group/trpc-go/trpc-go")funcmain(){ s := trpc.NewServer() simplest.RegisterHelloWorldService(s, helloWorldImpl{...
github.com/Andrew-M-C/trpc-go-utils/config/etcd 我们回到前几篇文章中的 demo。在之前的文章中提到的 http-auth-server 中,我们留意一下 main 包中的 initDependency() 函数,对 repo 层的初始化逻辑: r, err := repo.NewRepo(repo.Dependency{ GeneralConfigKeyName: "/http-auth-server/general.json"...
判断流结束应该明确用 err == io.EOF,而不是 errors.Is(err, io.EOF),因为底层连接断开可能返回 io.EOF,框架对其封装后返回给业务层,业务判断时出现 errors.Is(err, io.EOF) == true,这个时候可能会误认为流被正常关闭了,实际上是底层连接断开,流是非正常结束的。 github.com/trpc-group/t ...
syntax = "proto3"; package trpc.test.helloworld; option go_package="github.com/some-repo/examples/helloworld"; service Greeter { rpc SayHello (HelloRequest) returns (HelloReply) {} } message HelloRequest { string msg = 1; } message HelloReply { string msg = 1; } 第二步:通过 trpc-cmdl...
import("github.com/sirupsen/logrus""github.com/smallnest/rpcx/log")funcmain(){logger:=logrus.New()iflogger!=nil{newLogger:=log.With(logger)// 使用 newLogger 进行日志记录}} 在这个示例中,我们首先创建一个新的logrus实例,然后检查它是否为空指针。如果不是空指针,我们就可以使用trpc-go/lo...
安装TRPC-Go框架的两个必须依赖:protocandproto-gen-go。(这两个插件建议安装在全局,这样不同的用户均可访问) 安装protoc插件: git clone https://github.com/protocolbuffers/protobuf # 进入从 git 拉下来的目录 # 依次执行 ./autogen.sh ./configure --prefix=/usr/local/protobuf // 这里是把 protobuf...
import "github.com/Andrew-M-C/trpc-go-utils/plugin" // ... clientYamlConf := struct { Key string `yaml:"key"` }{} 然后,利用 Go 泛型的类型推测机制,开发者只需要将上面这个 struct 类型的地址作为 Bind 的参数即可: 代码语言:go 复制 ...