[package]
name = "sea-clickhouse"
version = "0.14.4"
description = "ClickHouse Client with SeaQL integration"
keywords = ["clickhouse", "database"]
readme = "README.md"
authors.workspace = true
repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true

[lib]
name = "clickhouse"
path = "src/lib.rs"

[workspace]
members = ["macros", "types", "sea-orm-arrow-example"]
# `rust-version`-aware dependency resolution;
# applies to all workspace members
resolver = "3"

[workspace.package]
authors = ["ClickHouse Contributors", "Paul Loyd <pavelko95@gmail.com>"]
homepage = "https://github.com/SeaQL/clickhouse-rs"
repository = "https://github.com/SeaQL/clickhouse-rs"
edition = "2024"
license = "MIT OR Apache-2.0"
# N.B. be sure to update this in `rust-toolchain.toml` as well
rust-version = "1.88.0"

[lints.rust]
rust_2018_idioms = { level = "warn", priority = -1 }
unreachable_pub = "warn"
# TODO: missing_docs = "warn"
unexpected_cfgs = "allow" # for `docsrs`

[lints.clippy]
undocumented_unsafe_blocks = "warn"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[[bench]]
name = "select_market_data"
harness = false

[[bench]]
name = "select_nyc_taxi_data"
harness = false
required-features = ["time"]

[[bench]]
name = "select_numbers"
harness = false

[[bench]]
name = "mocked_insert"
harness = false

[[bench]]
name = "mocked_select"
harness = false

[[example]]
name = "inserter"
required-features = ["inserter"]

[[example]]
name = "mock"
required-features = ["test-util"]

[[example]]
name = "clickhouse_cloud"
required-features = ["rustls-tls"]

[[example]]
name = "data_types_derive_simple"
required-features = ["time", "uuid", "chrono"]

[[example]]
name = "data_types_variant"
required-features = ["time"]

[[example]]
name = "time_types_example"
required-features = ["time", "chrono"]

[[example]]
name = "data_rows"
required-features = ["sea-ql"]

[[example]]
name = "data_row_insert"
required-features = ["sea-ql"]

[[example]]
name = "row_batch"
required-features = ["sea-ql"]

[[example]]
name = "data_row_schema"
required-features = ["sea-ql", "chrono", "rust_decimal"]

[[example]]
name = "arrow_batch"
required-features = ["arrow"]

[[example]]
name = "arrow_sensor_data"
required-features = ["arrow", "rust_decimal"]

[[example]]
name = "arrow_insert"
required-features = ["arrow", "rust_decimal", "bigdecimal"]

[profile.release]
debug = true

[features]
default = ["lz4"]

test-util = ["hyper/server"]
inserter = ["dep:quanta"]
uuid = ["dep:uuid", "sea-query?/with-uuid"]
time = ["dep:time", "sea-query?/with-time", "sea-orm-arrow?/with-time"]
lz4 = ["dep:lz4_flex", "dep:cityhash-rs"]
chrono = ["dep:chrono", "sea-query?/with-chrono", "sea-orm-arrow?/with-chrono"]
rust_decimal = ["sea-query?/with-rust_decimal", "sea-orm-arrow?/with-rust_decimal"]
bigdecimal = ["sea-query?/with-bigdecimal", "sea-orm-arrow?/with-bigdecimal"]
futures03 = []
sea-ql = ["sea-query"]
arrow = ["sea-orm-arrow", "sea-ql"]

##  TLS
native-tls = ["dep:hyper-tls"]
# ext: native-tls-alpn
# ext: native-tls-vendored

rustls-tls = ["rustls-tls-aws-lc", "rustls-tls-webpki-roots"]
rustls-tls-aws-lc = [
    "dep:rustls",
    "dep:hyper-rustls",
    "hyper-rustls?/aws-lc-rs",
]
rustls-tls-ring = ["dep:rustls", "dep:hyper-rustls", "hyper-rustls?/ring"]
rustls-tls-webpki-roots = [
    "dep:rustls",
    "dep:hyper-rustls",
    "hyper-rustls?/webpki-tokio",
]
rustls-tls-native-roots = [
    "dep:rustls",
    "dep:hyper-rustls",
    "hyper-rustls?/native-tokio",
]

[dependencies]
clickhouse-macros = { version = "0.3.0" }
clickhouse-types = { version = "0.1.1" }

thiserror = "2.0"
serde = "1.0.106"
bytes = { version = "1.5.0", features = ["serde"] }
tokio = { version = "1.0.1", features = ["rt", "macros"] }
http-body-util = "0.1.2"
hyper = "1.4"
hyper-util = { version = "0.1.6", features = ["client-legacy", "http1"] }
hyper-tls = { version = "0.6.0", optional = true }
rustls = { version = "0.23", default-features = false, optional = true }
hyper-rustls = { version = "0.27.3", default-features = false, features = [
    "http1",
    "tls12",
], optional = true }
url = "2.1.1"
futures-util = { version = "0.3.5", default-features = false, features = ["sink", "io"] }
futures-channel = { version = "0.3.30", features = ["sink"] }
lz4_flex = { version = "0.11.3", default-features = false, features = [
    "std",
], optional = true }
cityhash-rs = { version = "=1.0.1", optional = true } # exact version for safety, this package has been stable for years
uuid = { version = "1", optional = true }
time = { version = "0.3", optional = true }
chrono = { version = "0.4", optional = true, features = ["serde"] }
sea-query = { version = "1.0.0-rc", optional = true, default-features = false, features = [
    "with-json",
] }
sea-orm-arrow = { version = "2.0.0-rc", optional = true, features = [
    "prettyprint",
] }
bstr = { version = "1.11.0", default-features = false }
quanta = { version = "0.12", optional = true }
polonius-the-crab = "0.5.0"

bnum = "0.13.0"

[dev-dependencies]
clickhouse-macros = { version = "0.3.0" }
criterion = "0.6"
serde = { version = "1.0.106", features = ["derive"] }
tokio = { version = "1.0.1", features = ["full", "test-util", "io-util"] }
hyper = { version = "1.1", features = ["server"] }
indexmap = { version = "2.10.0", features = ["serde"] }
linked-hash-map = { version = "0.5.6", features = ["serde_impl"] }
fxhash = { version = "0.2.1" }
serde_bytes = "0.11.4"
serde_json = "1"
serde_repr = "0.1.7"
uuid = { version = "1", features = ["v4", "serde"] }
time = { version = "0.3.17", features = ["macros", "rand", "parsing"] }
fixnum = { version = "0.9.2", features = ["serde", "i32", "i64", "i128"] }
rand = { version = "0.9", features = ["small_rng"] }
trybuild = "1.0"
