How to convert uuid value to string using Azure devops GO implementation

huangapple go评论72阅读模式
英文:

How to convert uuid value to string using Azure devops GO implementation

问题

我正在使用Azure DevOps的Go语言包来查询服务端点列表。

我调用了以下函数:
func (client ClientImpl) GetServiceEndpoints(ctx context.Context, args GetServiceEndpointsArgs) ([]ServiceEndpoint, error)

服务端点的返回类型定义如下:
https://pkg.go.dev/github.com/microsoft/azure-devops-go-api/azuredevops@v1.0.0-b5/serviceendpoint#ServiceEndpoint

我从模块中得到的返回值是以UUID格式表示的。
我该如何将其转换为可用的格式,例如resourceId=90d8caad-7150-4a36-9075-597479fe72f1

正如你所看到的,数组中的每个值都包含Azure DevOps中实际ID的一部分。

英文:

I am using the azure devops package for go, to query a list of service endpoints.

I call the function:
func (client ClientImpl) GetServiceEndpoints(ctx context.Context, args GetServiceEndpointsArgs) ([]ServiceEndpoint, error)

The return type of serviceendpoint is defined as below
https://pkg.go.dev/github.com/microsoft/azure-devops-go-api/azuredevops@v1.0.0-b5/serviceendpoint#ServiceEndpoint

The return value I get from the module is in uuid format.
How can I get this as a useable format like resourceId=90d8caad-7150-4a36-9075-597479fe72f1
How to convert uuid value to string using Azure devops GO implementation

As you can see each value in the array contains a piece of the actual ID in azure devops.

答案1

得分: 1

UUID类型有一个String方法

func (uuid UUID) String() string
英文:

The UUID type has a String method:

func (uuid UUID) String() string

huangapple
  • 本文由 发表于 2022年3月5日 03:57:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/71356643.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定