[英]Firestore gRPC API Sample Usage in Golang
New to firestore and gRPC in general.一般而言,Firestore 和 gRPC 是新手。 I've been trying to figure out how to interact with the Firestore RPC API from golang.
我一直在尝试弄清楚如何与来自 golang 的 Firestore RPC API 进行交互。 They document the API well here , but do not show how to initialize the connections.
他们在这里很好地记录了 API,但没有显示如何初始化连接。 Some questions I have are,
我有一些问题,
Cheers.干杯。
Edit: I have been able to connect thanks to Anar.编辑:多亏了 Anar,我才能够连接上。 But I can't test anything because Im not really sure how to authenticate or create a record.
但我无法测试任何东西,因为我不确定如何验证或创建记录。 Any help with an example would be great.
任何有关示例的帮助都会很棒。 Code so far:
到目前为止的代码:
conn, err := grpc.Dial("firestore.googleapis.com", grpc.WithInsecure())
if err != nil {
log.Fatalln(err)
}
defer conn.Close()
You must use google.golang.org/grpc package你必须使用 google.golang.org/grpc package
As documentation you must use firestore.googleapis.com
to create client stub.作为文档,您必须使用
firestore.googleapis.com
来创建客户端存根。
3.You don't need it proto file locally. 3.本地不需要proto文件。 you can just create grpc client and use server methods which available here: https://cloud.google.com/firestore/docs/reference/rpc
您可以只创建 grpc 客户端并使用此处提供的服务器方法: https://cloud.google.com/firestore/docs/reference/rpc
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.