mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-27 22:26:15 +00:00
39 lines
10 KiB
HTML
39 lines
10 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A COPY FROM STDIN data format implementation."><title>CopyInCodec in servers::postgres::copy_in::codec - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../static.files/rustdoc-1ed95124.css"><meta name="rustdoc-vars" data-root-path="../../../../" data-static-root-path="../../../../static.files/" data-current-crate="servers" data-themes="" data-resource-suffix="" data-rustdoc-version="1.98.1 (48a229cea 2026-09-01)" data-channel="1.98.1" data-search-js="search-9944d736.js" data-stringdex-js="stringdex-2da4960a.js" data-settings-js="settings-170eb4bf.js" ><script src="../../../../static.files/storage-41dd4d93.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../static.files/main-417ebf0a.js"></script><noscript><link rel="stylesheet" href="../../../../static.files/noscript-f7c3ffd8.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><a class="skip-main-content" href="#main-content">Skip to main content</a><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">CopyInCodec</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../servers/index.html">servers</a><span class="version">1.4.0-alpha.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Copy<wbr>InCodec</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.check_column_type" title="check_column_type">check_column_type</a></li><li><a href="#tymethod.create_parser" title="create_parser">create_parser</a></li><li><a href="#tymethod.name" title="name">name</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.format_code" title="format_code">format_code</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In servers::<wbr>postgres::<wbr>copy_<wbr>in::<wbr>codec</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content" tabindex="-1"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../index.html">servers</a>::<wbr><a href="../../index.html">postgres</a>::<wbr><a href="../index.html">copy_in</a>::<wbr><a href="index.html">codec</a></div><h1>Trait <span class="trait">Copy<wbr>InCodec</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../../src/servers/postgres/copy_in/codec.rs.html#94-116">Source</a> </span></div><pre class="rust item-decl"><code>pub(super) trait CopyInCodec:
|
|
<a class="trait" href="https://doc.rust-lang.org/1.98.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>
|
|
+ <a class="trait" href="https://doc.rust-lang.org/1.98.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>
|
|
+ <a class="trait" href="https://doc.rust-lang.org/1.98.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> {
|
|
// Required methods
|
|
fn <a href="#tymethod.name" class="fn">name</a>(&self) -> &'static <a class="primitive" href="https://doc.rust-lang.org/1.98.1/std/primitive.str.html">str</a>;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.check_column_type" class="fn">check_column_type</a>(
|
|
&self,
|
|
data_type: &ConcreteDataType,
|
|
) -> PgWireResult<<a class="primitive" href="https://doc.rust-lang.org/1.98.1/std/primitive.unit.html">()</a>>;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.create_parser" class="fn">create_parser</a>(
|
|
&self,
|
|
columns: &[ColumnSchema],
|
|
timezone: &<a class="primitive" href="https://doc.rust-lang.org/1.98.1/std/primitive.str.html">str</a>,
|
|
) -> PgWireResult<<a class="struct" href="https://doc.rust-lang.org/1.98.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="trait.RecordParser.html" title="trait servers::postgres::copy_in::codec::RecordParser">RecordParser</a> + <a class="trait" href="https://doc.rust-lang.org/1.98.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>>;
|
|
|
|
// Provided method
|
|
fn <a href="#method.format_code" class="fn">format_code</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.98.1/std/primitive.i8.html">i8</a> { ... }
|
|
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A COPY FROM STDIN data format implementation.</p>
|
|
<p>Implementations are shared per statement (hence <code>Send + Sync</code>) and must
|
|
be stateless; per-stream state belongs to the <a href="trait.RecordParser.html" title="trait servers::postgres::copy_in::codec::RecordParser"><code>RecordParser</code></a> they
|
|
create. Every method is tailored to the format: <code>check_column_type</code>
|
|
declares the types the format can decode (csv is bounded by what
|
|
arrow-csv supports).</p>
|
|
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.name" class="method"><a class="src rightside" href="../../../../src/servers/postgres/copy_in/codec.rs.html#96">Source</a><h4 class="code-header">fn <a href="#tymethod.name" class="fn">name</a>(&self) -> &'static <a class="primitive" href="https://doc.rust-lang.org/1.98.1/std/primitive.str.html">str</a></h4></section></summary><div class="docblock"><p>The canonical format name, used in error messages.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.check_column_type" class="method"><a class="src rightside" href="../../../../src/servers/postgres/copy_in/codec.rs.html#104">Source</a><h4 class="code-header">fn <a href="#tymethod.check_column_type" class="fn">check_column_type</a>(&self, data_type: &ConcreteDataType) -> PgWireResult<<a class="primitive" href="https://doc.rust-lang.org/1.98.1/std/primitive.unit.html">()</a>></h4></section></summary><div class="docblock"><p>Validates that a column of <code>data_type</code> can be ingested by this
|
|
format.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.create_parser" class="method"><a class="src rightside" href="../../../../src/servers/postgres/copy_in/codec.rs.html#111-115">Source</a><h4 class="code-header">fn <a href="#tymethod.create_parser" class="fn">create_parser</a>(
|
|
&self,
|
|
columns: &[ColumnSchema],
|
|
timezone: &<a class="primitive" href="https://doc.rust-lang.org/1.98.1/std/primitive.str.html">str</a>,
|
|
) -> PgWireResult<<a class="struct" href="https://doc.rust-lang.org/1.98.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="trait.RecordParser.html" title="trait servers::postgres::copy_in::codec::RecordParser">RecordParser</a> + <a class="trait" href="https://doc.rust-lang.org/1.98.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>></h4></section></summary><div class="docblock"><p>Creates the stateful parser for one copy stream over the targeted
|
|
columns (in COPY field order).</p>
|
|
<p><code>timezone</code> is the session timezone (an IANA name or a UTC offset):
|
|
formats that parse offset-free timestamp strings from text should
|
|
interpret them in this zone, matching SQL INSERT.</p>
|
|
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.format_code" class="method"><a class="src rightside" href="../../../../src/servers/postgres/copy_in/codec.rs.html#99-101">Source</a><h4 class="code-header">fn <a href="#method.format_code" class="fn">format_code</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.98.1/std/primitive.i8.html">i8</a></h4></section></summary><div class="docblock"><p>The format code advertised in the <code>CopyInResponse</code> header: 0 when
|
|
the client sends textual data (the default), 1 for binary.</p>
|
|
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait <b>is</b> <a href="https://doc.rust-lang.org/1.98.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety".</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><div class="negative-marker"></div><section id="impl-CopyInCodec-for-CsvCodec" class="impl"><a class="src rightside" href="../../../../src/servers/postgres/copy_in/csv.rs.html#86-179">Source</a><a href="#impl-CopyInCodec-for-CsvCodec" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.CopyInCodec.html" title="trait servers::postgres::copy_in::codec::CopyInCodec">CopyInCodec</a> for <a class="struct" href="../csv/struct.CsvCodec.html" title="struct servers::postgres::copy_in::csv::CsvCodec">CsvCodec</a></h3></section></div><script src="../../../../trait.impl/servers/postgres/copy_in/codec/trait.CopyInCodec.js" async></script></section></div></main></body></html> |