risingwave_connector_codec/
lib.rs1#![allow(clippy::derive_partial_eq_without_eq)]
18#![feature(array_chunks)]
19#![feature(coroutines)]
20#![feature(proc_macro_hygiene)]
21#![feature(stmt_expr_attributes)]
22#![feature(box_patterns)]
23#![feature(trait_alias)]
24#![feature(let_chains)]
25#![feature(box_into_inner)]
26#![feature(type_alias_impl_trait)]
27#![feature(associated_type_defaults)]
28#![feature(impl_trait_in_assoc_type)]
29#![feature(iter_from_coroutine)]
30#![feature(if_let_guard)]
31#![feature(iterator_try_collect)]
32#![feature(try_blocks)]
33#![feature(error_generic_member_access)]
34#![feature(negative_impls)]
35#![feature(register_tool)]
36#![feature(assert_matches)]
37#![register_tool(rw)]
38#![recursion_limit = "256"]
39
40pub mod common;
41pub mod decoder;
44
45pub use apache_avro::schema::Schema as AvroSchema;
46pub use apache_avro::types::{Value as AvroValue, ValueKind as AvroValueKind};
47pub use risingwave_pb::plan_common::ColumnDesc;
48pub struct JsonSchema(pub serde_json::Value);
49impl JsonSchema {
50 pub fn parse_str(schema: &str) -> anyhow::Result<Self> {
51 use anyhow::Context;
52
53 let value = serde_json::from_str(schema).context("failed to parse json schema")?;
54 Ok(Self(value))
55 }
56
57 pub fn parse_bytes(schema: &[u8]) -> anyhow::Result<Self> {
58 use anyhow::Context;
59
60 let value = serde_json::from_slice(schema).context("failed to parse json schema")?;
61 Ok(Self(value))
62 }
63}