| 1 |
// Copyright 2025 Google LLC |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// https://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
// Code generated by protoc-gen-go_gapic. DO NOT EDIT. |
| 16 |
|
| 17 |
package datapolicies |
| 18 |
|
| 19 |
import ( |
| 20 |
datapoliciespb "cloud.google.com/go/bigquery/datapolicies/apiv1beta1/datapoliciespb" |
| 21 |
"google.golang.org/api/iterator" |
| 22 |
) |
| 23 |
|
| 24 |
// DataPolicyIterator manages a stream of *datapoliciespb.DataPolicy. |
| 25 |
type DataPolicyIterator struct { |
| 26 |
items []*datapoliciespb.DataPolicy |
| 27 |
pageInfo *iterator.PageInfo |
| 28 |
nextFunc func() error |
| 29 |
|
| 30 |
// Response is the raw response for the current page. |
| 31 |
// It must be cast to the RPC response type. |
| 32 |
// Calling Next() or InternalFetch() updates this value. |
| 33 |
Response interface{} |
| 34 |
|
| 35 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 36 |
// It is not part of the stable interface of this package. |
| 37 |
// |
| 38 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 39 |
// The number of results is no greater than pageSize. |
| 40 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 41 |
InternalFetch func(pageSize int, pageToken string) (results []*datapoliciespb.DataPolicy, nextPageToken string, err error) |
| 42 |
} |
| 43 |
|
| 44 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 45 |
func (it *DataPolicyIterator) PageInfo() *iterator.PageInfo { |
| 46 |
return it.pageInfo |
| 47 |
} |
| 48 |
|
| 49 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 50 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 51 |
func (it *DataPolicyIterator) Next() (*datapoliciespb.DataPolicy, error) { |
| 52 |
var item *datapoliciespb.DataPolicy |
| 53 |
if err := it.nextFunc(); err != nil { |
| 54 |
return item, err |
| 55 |
} |
| 56 |
item = it.items[0] |
| 57 |
it.items = it.items[1:] |
| 58 |
return item, nil |
| 59 |
} |
| 60 |
|
| 61 |
func (it *DataPolicyIterator) bufLen() int { |
| 62 |
return len(it.items) |
| 63 |
} |
| 64 |
|
| 65 |
func (it *DataPolicyIterator) takeBuf() interface{} { |
| 66 |
b := it.items |
| 67 |
it.items = nil |
| 68 |
return b |
| 69 |
} |