forked from TrueCloudLab/restic
Update dependencies
This commit is contained in:
parent
f3b49987f8
commit
fda563d606
926 changed files with 189726 additions and 98666 deletions
72
vendor/cloud.google.com/go/bigquery/examples_test.go
generated
vendored
72
vendor/cloud.google.com/go/bigquery/examples_test.go
generated
vendored
|
@ -262,6 +262,44 @@ func ExampleDataset_Metadata() {
|
|||
fmt.Println(md)
|
||||
}
|
||||
|
||||
// This example illustrates how to perform a read-modify-write sequence on dataset
|
||||
// metadata. Passing the metadata's ETag to the Update call ensures that the call
|
||||
// will fail if the metadata was changed since the read.
|
||||
func ExampleDataset_Update_readModifyWrite() {
|
||||
ctx := context.Background()
|
||||
client, err := bigquery.NewClient(ctx, "project-id")
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
ds := client.Dataset("my_dataset")
|
||||
md, err := ds.Metadata(ctx)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
md2, err := ds.Update(ctx,
|
||||
bigquery.DatasetMetadataToUpdate{Name: "new " + md.Name},
|
||||
md.ETag)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
fmt.Println(md2)
|
||||
}
|
||||
|
||||
// To perform a blind write, ignoring the existing state (and possibly overwriting
|
||||
// other updates), pass the empty string as the etag.
|
||||
func ExampleDataset_Update_blindWrite() {
|
||||
ctx := context.Background()
|
||||
client, err := bigquery.NewClient(ctx, "project-id")
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
md, err := client.Dataset("my_dataset").Update(ctx, bigquery.DatasetMetadataToUpdate{Name: "blind"}, "")
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
fmt.Println(md)
|
||||
}
|
||||
|
||||
func ExampleDataset_Table() {
|
||||
ctx := context.Background()
|
||||
client, err := bigquery.NewClient(ctx, "project-id")
|
||||
|
@ -356,6 +394,7 @@ func ExampleTable_Create() {
|
|||
}
|
||||
}
|
||||
|
||||
// If you know your table's schema initially, pass a Schema to Create.
|
||||
func ExampleTable_Create_schema() {
|
||||
ctx := context.Background()
|
||||
// Infer table schema from a Go type.
|
||||
|
@ -476,6 +515,8 @@ func ExampleTable_LoaderFrom() {
|
|||
}
|
||||
gcsRef := bigquery.NewGCSReference("gs://my-bucket/my-object")
|
||||
gcsRef.AllowJaggedRows = true
|
||||
gcsRef.MaxBadRecords = 5
|
||||
gcsRef.Schema = schema
|
||||
// TODO: set other options on the GCSReference.
|
||||
ds := client.Dataset("my_dataset")
|
||||
loader := ds.Table("my_table").LoaderFrom(gcsRef)
|
||||
|
@ -506,6 +547,8 @@ func ExampleTable_LoaderFrom_reader() {
|
|||
}
|
||||
rs := bigquery.NewReaderSource(f)
|
||||
rs.AllowJaggedRows = true
|
||||
rs.MaxBadRecords = 5
|
||||
rs.Schema = schema
|
||||
// TODO: set other options on the GCSReference.
|
||||
ds := client.Dataset("my_dataset")
|
||||
loader := ds.Table("my_table").LoaderFrom(rs)
|
||||
|
@ -534,7 +577,32 @@ func ExampleTable_Read() {
|
|||
_ = it // TODO: iterate using Next or iterator.Pager.
|
||||
}
|
||||
|
||||
func ExampleTable_Update() {
|
||||
// This example illustrates how to perform a read-modify-write sequence on table
|
||||
// metadata. Passing the metadata's ETag to the Update call ensures that the call
|
||||
// will fail if the metadata was changed since the read.
|
||||
func ExampleTable_Update_readModifyWrite() {
|
||||
ctx := context.Background()
|
||||
client, err := bigquery.NewClient(ctx, "project-id")
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
t := client.Dataset("my_dataset").Table("my_table")
|
||||
md, err := t.Metadata(ctx)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
md2, err := t.Update(ctx,
|
||||
bigquery.TableMetadataToUpdate{Name: "new " + md.Name},
|
||||
md.ETag)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
fmt.Println(md2)
|
||||
}
|
||||
|
||||
// To perform a blind write, ignoring the existing state (and possibly overwriting
|
||||
// other updates), pass the empty string as the etag.
|
||||
func ExampleTable_Update_blindWrite() {
|
||||
ctx := context.Background()
|
||||
client, err := bigquery.NewClient(ctx, "project-id")
|
||||
if err != nil {
|
||||
|
@ -543,7 +611,7 @@ func ExampleTable_Update() {
|
|||
t := client.Dataset("my_dataset").Table("my_table")
|
||||
tm, err := t.Update(ctx, bigquery.TableMetadataToUpdate{
|
||||
Description: "my favorite table",
|
||||
})
|
||||
}, "")
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue