google_cloud_bigquery/write/format.rs
1// Copyright 2026 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
15mod arrow;
16mod proto;
17
18/// The data format accepted by a writer.
19///
20/// This trait is sealed and cannot be implemented for types outside this crate.
21pub trait DataFormat: sealed::DataFormat {
22 /// The representation of rows for this data format.
23 type Rows;
24}
25
26pub(crate) mod sealed {
27 use crate::model::AppendRowsRequest;
28
29 pub trait DataFormat {
30 fn format_name(&self) -> &'static str;
31
32 fn make_request(&self, write_stream: &str, rows: Self::Rows) -> AppendRowsRequest
33 where
34 Self: super::DataFormat;
35 }
36}
37
38pub use arrow::Arrow;
39pub(crate) use proto::Proto;