Skip to content

Commit

Permalink
feat: support pgoptions (#173)
Browse files Browse the repository at this point in the history
* support pgoptions

Signed-off-by: Runji Wang <wangrunji0408@163.com>

* bump version

Signed-off-by: Runji Wang <wangrunji0408@163.com>

* fix clippy

Signed-off-by: Runji Wang <wangrunji0408@163.com>

---------

Signed-off-by: Runji Wang <wangrunji0408@163.com>
  • Loading branch information
wangrunji0408 authored Mar 16, 2023
1 parent 33e9c11 commit 9311624
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.13.1] - 2023-03-16

* Support postgres options.

## [0.13.0] - 2023-02-15

* `sqllogictest-bin` now uses the strict validator to update records (the runner still doesn't check schema).
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
members = ["examples/*", "sqllogictest", "sqllogictest-bin", "sqllogictest-engines", "tests"]

[workspace.package]
version = "0.13.0"
version = "0.13.1"
edition = "2021"
homepage = "https://github.com/risinglightdb/sqllogictest-rs"
keywords = ["sql", "database", "parser", "cli"]
Expand Down
3 changes: 3 additions & 0 deletions sqllogictest-bin/src/engines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ impl From<&DBConfig> for PostgresConfig {
.dbname(&config.db)
.user(&config.user)
.password(&config.pass);
if let Some(options) = &config.options {
pg_config.options(options);
}

pg_config
}
Expand Down
16 changes: 9 additions & 7 deletions sqllogictest-bin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,15 @@ use sqllogictest::{
Record, Runner,
};

#[derive(Copy, Clone, Debug, PartialEq, Eq, ArgEnum)]
#[derive(Default, Copy, Clone, Debug, PartialEq, Eq, ArgEnum)]
#[must_use]
pub enum Color {
#[default]
Auto,
Always,
Never,
}

impl Default for Color {
fn default() -> Self {
Color::Auto
}
}

#[derive(Parser, Debug, Clone)]
#[clap(about, version, author)]
struct Opt {
Expand Down Expand Up @@ -88,6 +83,9 @@ struct Opt {
/// The database password.
#[clap(short = 'w', long, default_value = "postgres")]
pass: String,
/// The database options.
#[clap(long)]
options: Option<String>,

/// Overrides the test files with the actual output of the database.
#[clap(long)]
Expand All @@ -108,6 +106,8 @@ struct DBConfig {
user: String,
/// The database password.
pass: String,
/// Command line options.
options: Option<String>,
}

impl DBConfig {
Expand All @@ -134,6 +134,7 @@ pub async fn main_okk() -> Result<()> {
db,
user,
pass,
options,
r#override,
format,
} = Opt::parse();
Expand Down Expand Up @@ -189,6 +190,7 @@ pub async fn main_okk() -> Result<()> {
db,
user,
pass,
options,
};

if r#override || format {
Expand Down

0 comments on commit 9311624

Please sign in to comment.