本文整理匯總了Golang中github.com/Azure/azure-sdk-for-go/storage.BlobStorageClient.GetBlobURL方法的典型用法代碼示例。如果您正苦於以下問題:Golang BlobStorageClient.GetBlobURL方法的具體用法?Golang BlobStorageClient.GetBlobURL怎麽用?Golang BlobStorageClient.GetBlobURL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/Azure/azure-sdk-for-go/storage.BlobStorageClient
的用法示例。
在下文中一共展示了BlobStorageClient.GetBlobURL方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: validate
func validate(cli storage.BlobStorageClient, blob string, startByte, endByte int64, data []byte) error {
url := cli.GetBlobURL(cnt, blob)
reader, err := cli.GetBlob(cnt, blob)
if err != nil {
return fmt.Errorf("Failed to read from %s: %s\n", url, err.Error())
}
defer reader.Close()
dataRead, err := ioutil.ReadAll(reader)
if err != nil {
return fmt.Errorf("Failed to read from %s: %s\n", url, err.Error())
}
same := true
for i := startByte; i <= endByte; i++ {
if data[i] != dataRead[i] {
same = false
}
}
if !same {
return fmt.Errorf("Failed to read data properly from %s: %s\n", url, err.Error())
}
return nil
}
示例2: clearPage
func clearPage(cli storage.BlobStorageClient, name string, startByte, endByte int64) error {
if err := cli.PutPage(cnt, name, startByte, endByte, storage.PageWriteTypeClear, nil); err != nil {
url := cli.GetBlobURL(cnt, name)
fmt.Printf("Failed to clear pages of %s: %s\n", url, err.Error())
return err
}
return nil
}
示例3: writePage
func writePage(cli storage.BlobStorageClient, name string, startByte, endByte int64, chunk []byte) error {
if err := cli.PutPage(cnt, name, startByte, endByte, storage.PageWriteTypeUpdate, chunk); err != nil {
url := cli.GetBlobURL(cnt, name)
fmt.Printf("Failed to write pages to %s: %s\n", url, err.Error())
return err
}
return nil
}