From 323e53d9c0f4bed83cde07a214eb03a1b3904fc7 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Mon, 13 Nov 2023 08:39:43 +0800 Subject: [PATCH 1/2] Group imports: std, external, crate --- butane/src/lib.rs | 3 ++- butane/tests/basic.rs | 3 +-- butane/tests/common/blog.rs | 1 - butane/tests/custom_enum_derived.rs | 1 - butane/tests/custom_pg.rs | 4 ++-- butane/tests/custom_type.rs | 1 - butane/tests/fake.rs | 4 +--- butane/tests/json.rs | 3 +-- butane/tests/many.rs | 2 -- butane/tests/migration-tests.rs | 9 ++++---- butane/tests/nullable.rs | 1 - butane/tests/query.rs | 3 +-- butane/tests/r2d2.rs | 8 +++---- butane/tests/uuid.rs | 3 +-- butane_cli/src/main.rs | 3 +-- butane_codegen/src/filter.rs | 3 ++- butane_codegen/src/lib.rs | 3 ++- butane_core/src/autopk.rs | 6 ++++-- butane_core/src/codegen/dbobj.rs | 7 ++++--- butane_core/src/codegen/migration.rs | 3 ++- butane_core/src/codegen/mod.rs | 10 +++++---- butane_core/src/custom.rs | 3 ++- butane_core/src/db/connmethods.rs | 5 +++-- butane_core/src/db/helper.rs | 11 +++++----- butane_core/src/db/mod.rs | 15 ++++++------- butane_core/src/db/pg.rs | 16 +++++++------- butane_core/src/db/r2.rs | 3 ++- butane_core/src/db/sqlite.rs | 15 ++++++------- butane_core/src/fkey.rs | 9 ++++---- butane_core/src/lib.rs | 7 +++---- butane_core/src/many.rs | 11 +++++----- butane_core/src/migrations/adb.rs | 7 ++++--- butane_core/src/migrations/fsmigrations.rs | 15 ++++++------- butane_core/src/migrations/memmigrations.rs | 8 ++++--- butane_core/src/migrations/migration.rs | 7 ++++--- butane_core/src/migrations/mod.rs | 7 ++++--- butane_core/src/query/fieldexpr.rs | 7 ++++--- butane_core/src/query/mod.rs | 8 ++++--- butane_core/src/sqlval.rs | 12 +++++------ butane_core/src/uuid.rs | 3 ++- butane_core/tests/connection.rs | 1 - butane_core/tests/transactions.rs | 1 - butane_test_helper/src/lib.rs | 7 ++++--- docs/getting-started.md | 21 ++++++++++++------- example/src/main.rs | 3 +-- .../getting_started/src/bin/delete_post.rs | 5 +++-- .../getting_started/src/bin/publish_post.rs | 5 +++-- .../getting_started/src/bin/show_posts.rs | 2 +- .../getting_started/src/bin/write_post.rs | 3 ++- 49 files changed, 159 insertions(+), 139 deletions(-) diff --git a/butane/src/lib.rs b/butane/src/lib.rs index 36b96803..1e2be3de 100644 --- a/butane/src/lib.rs +++ b/butane/src/lib.rs @@ -171,9 +171,10 @@ pub mod prelude { //! Its use is recommended, but not required. If not used, the use //! of butane's macros may require some of its re-exports to be //! used manually. + pub use butane_core::db::BackendConnection; + #[doc(no_inline)] pub use crate::DataObject; #[doc(no_inline)] pub use crate::DataResult; - pub use butane_core::db::BackendConnection; } diff --git a/butane/tests/basic.rs b/butane/tests/basic.rs index d0f88ad6..74ae3af9 100644 --- a/butane/tests/basic.rs +++ b/butane/tests/basic.rs @@ -3,12 +3,11 @@ use butane::db::Connection; use butane::{butane_type, find, model, query, AutoPk, ForeignKey}; use butane::{colname, prelude::*}; +use butane_test_helper::*; #[cfg(feature = "datetime")] use chrono::{naive::NaiveDateTime, offset::Utc, DateTime}; use serde::Serialize; -use butane_test_helper::*; - #[butane_type] pub type Whatsit = String; diff --git a/butane/tests/common/blog.rs b/butane/tests/common/blog.rs index cddea691..ff64503c 100644 --- a/butane/tests/common/blog.rs +++ b/butane/tests/common/blog.rs @@ -3,7 +3,6 @@ use butane::{dataresult, model}; use butane::{db::Connection, ForeignKey, Many}; #[cfg(feature = "datetime")] use chrono::{naive::NaiveDateTime, offset::Utc}; - #[cfg(feature = "fake")] use fake::Dummy; diff --git a/butane/tests/custom_enum_derived.rs b/butane/tests/custom_enum_derived.rs index 170662b1..3b3a7fd7 100644 --- a/butane/tests/custom_enum_derived.rs +++ b/butane/tests/custom_enum_derived.rs @@ -3,7 +3,6 @@ use butane::db::Connection; use butane::prelude::*; use butane::{model, query}; use butane::{FieldType, FromSql, SqlVal, ToSql}; - use butane_test_helper::*; #[derive(PartialEq, Eq, Debug, Clone, FieldType)] diff --git a/butane/tests/custom_pg.rs b/butane/tests/custom_pg.rs index 91af88a9..8da2a35a 100644 --- a/butane/tests/custom_pg.rs +++ b/butane/tests/custom_pg.rs @@ -1,14 +1,14 @@ // We wrap everything in an inner module just so it's easier to have the feature gate in one place #[cfg(feature = "pg")] mod custom_pg { + use std::result::Result; + use butane::custom::{SqlTypeCustom, SqlValRefCustom}; use butane::prelude::*; use butane::{butane_type, db::Connection, model}; use butane::{AutoPk, FieldType, FromSql, SqlType, SqlVal, SqlValRef, ToSql}; use butane_test_helper::{maketest, maketest_pg}; - use std::result::Result; - // newtype so we can implement traits for it. #[butane_type(Custom(POINT))] #[derive(Debug, PartialEq, Clone)] diff --git a/butane/tests/custom_type.rs b/butane/tests/custom_type.rs index 93a298a0..668a1ab9 100644 --- a/butane/tests/custom_type.rs +++ b/butane/tests/custom_type.rs @@ -2,7 +2,6 @@ use butane::db::Connection; use butane::prelude::*; use butane::{butane_type, model, query}; use butane::{FieldType, FromSql, SqlType, SqlVal, SqlValRef, ToSql}; - use butane_test_helper::*; #[butane_type(Text)] diff --git a/butane/tests/fake.rs b/butane/tests/fake.rs index 3650b53a..563c7599 100644 --- a/butane/tests/fake.rs +++ b/butane/tests/fake.rs @@ -1,14 +1,12 @@ use butane::db::Connection; use butane::{find, DataObject, ForeignKey}; - use butane_test_helper::*; mod common; fn fake_blog_post(conn: Connection) { - use fake::{Fake, Faker}; - use common::blog::{Blog, Post, Tag}; + use fake::{Fake, Faker}; let mut fake_blog: Blog = Faker.fake(); fake_blog.save(&conn).unwrap(); diff --git a/butane/tests/json.rs b/butane/tests/json.rs index 2321179d..73d1bc37 100644 --- a/butane/tests/json.rs +++ b/butane/tests/json.rs @@ -5,11 +5,10 @@ use std::collections::{BTreeMap, HashMap}; use butane::model; use butane::prelude::*; use butane::{db::Connection, FieldType}; +use butane_test_helper::*; use serde::{Deserialize, Serialize}; use serde_json::Value; -use butane_test_helper::*; - #[model] #[derive(PartialEq, Eq, Debug, Clone)] struct FooJJ { diff --git a/butane/tests/many.rs b/butane/tests/many.rs index 96bdf1fc..e36b18ae 100644 --- a/butane/tests/many.rs +++ b/butane/tests/many.rs @@ -1,9 +1,7 @@ use butane::db::Connection; use butane::prelude::*; use butane::{model, query::OrderDirection, AutoPk, Many}; - use butane_test_helper::testall; - #[cfg(any(feature = "pg", feature = "sqlite"))] use butane_test_helper::*; diff --git a/butane/tests/migration-tests.rs b/butane/tests/migration-tests.rs index 9eb5fe7c..b2e17134 100644 --- a/butane/tests/migration-tests.rs +++ b/butane/tests/migration-tests.rs @@ -4,15 +4,14 @@ use butane::migrations::{ }; use butane::{db::Connection, prelude::*, SqlType, SqlVal}; use butane_core::codegen::{butane_type_with_migrations, model_with_migrations}; -use proc_macro2::TokenStream; -use quote::quote; -use sqlparser::dialect::GenericDialect; -use sqlparser::parser::Parser as SqlParser; - #[cfg(feature = "pg")] use butane_test_helper::pg_connection; #[cfg(feature = "sqlite")] use butane_test_helper::sqlite_connection; +use proc_macro2::TokenStream; +use quote::quote; +use sqlparser::dialect::GenericDialect; +use sqlparser::parser::Parser as SqlParser; #[test] fn current_migration_basic() { diff --git a/butane/tests/nullable.rs b/butane/tests/nullable.rs index fe691408..b3ebac2b 100644 --- a/butane/tests/nullable.rs +++ b/butane/tests/nullable.rs @@ -1,7 +1,6 @@ use butane::db::Connection; use butane::prelude::*; use butane::{model, query}; - use butane_test_helper::*; #[model] diff --git a/butane/tests/query.rs b/butane/tests/query.rs index 2c8bb46c..0267e576 100644 --- a/butane/tests/query.rs +++ b/butane/tests/query.rs @@ -2,11 +2,10 @@ use butane::db::Connection; use butane::prelude::*; use butane::query::BoolExpr; use butane::{colname, filter, find, query, Many}; +use butane_test_helper::*; #[cfg(feature = "datetime")] use chrono::{TimeZone, Utc}; -use butane_test_helper::*; - mod common; use common::blog; use common::blog::{Blog, Post, PostMetadata, Tag}; diff --git a/butane/tests/r2d2.rs b/butane/tests/r2d2.rs index fa06aca5..c4183e03 100644 --- a/butane/tests/r2d2.rs +++ b/butane/tests/r2d2.rs @@ -1,13 +1,11 @@ #[cfg(any(feature = "pg", feature = "sqlite"))] -use butane_test_helper::setup_db; - +use butane::db; #[cfg(feature = "pg")] use butane_test_helper::pg_connspec; +#[cfg(any(feature = "pg", feature = "sqlite"))] +use butane_test_helper::setup_db; #[cfg(feature = "sqlite")] use butane_test_helper::sqlite_connspec; - -#[cfg(any(feature = "pg", feature = "sqlite"))] -use butane::db; #[cfg(any(feature = "pg", feature = "sqlite"))] use r2d2_for_test as r2d2; diff --git a/butane/tests/uuid.rs b/butane/tests/uuid.rs index f26ae5fa..5ad48205 100644 --- a/butane/tests/uuid.rs +++ b/butane/tests/uuid.rs @@ -1,9 +1,8 @@ use butane::db::Connection; use butane::model; use butane::prelude::*; -use uuid_for_test::Uuid; - use butane_test_helper::*; +use uuid_for_test::Uuid; #[model] #[derive(PartialEq, Eq, Debug, Clone)] diff --git a/butane_cli/src/main.rs b/butane_cli/src/main.rs index c0b12b48..f0d9402c 100644 --- a/butane_cli/src/main.rs +++ b/butane_cli/src/main.rs @@ -1,11 +1,10 @@ use std::path::PathBuf; -use clap::{value_parser, Arg, ArgMatches}; - use butane_cli::{ base_dir, clean, clear_data, collapse_migrations, delete_table, detach_latest_migration, embed, get_migrations, handle_error, list_migrations, migrate, Result, }; +use clap::{value_parser, Arg, ArgMatches}; fn main() { let app = clap::Command::new("butane") diff --git a/butane_codegen/src/filter.rs b/butane_codegen/src/filter.rs index ab116467..08583950 100755 --- a/butane_codegen/src/filter.rs +++ b/butane_codegen/src/filter.rs @@ -1,9 +1,10 @@ -use super::*; use proc_macro2::Span; use proc_macro2::TokenStream as TokenStream2; use quote::{quote, quote_spanned, ToTokens}; use syn::{spanned::Spanned, BinOp, Expr, ExprBinary, ExprMethodCall, ExprPath, Ident, LitStr}; +use super::*; + pub fn for_expr(dbres: &Ident, expr: &Expr) -> TokenStream2 { handle_expr("e!(<#dbres as butane::DataResult>::DBO::fields()), expr) } diff --git a/butane_codegen/src/lib.rs b/butane_codegen/src/lib.rs index e88d0f9b..be2d226d 100644 --- a/butane_codegen/src/lib.rs +++ b/butane_codegen/src/lib.rs @@ -5,13 +5,14 @@ #![deny(missing_docs)] extern crate proc_macro; +use std::path::PathBuf; + use butane_core::migrations::adb::{DeferredSqlType, TypeIdentifier}; use butane_core::{codegen, make_compile_error, migrations, SqlType}; use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; use proc_macro2::TokenTree; use quote::quote; -use std::path::PathBuf; use syn::{Expr, Ident}; mod filter; diff --git a/butane_core/src/autopk.rs b/butane_core/src/autopk.rs index f4baf429..3e1109de 100644 --- a/butane_core/src/autopk.rs +++ b/butane_core/src/autopk.rs @@ -1,9 +1,11 @@ //! Contains the [AutoPk] type for autoincrementing primary keys. -use super::{FieldType, FromSql, PrimaryKeyType, Result, SqlType, SqlVal, SqlValRef, ToSql}; -use serde::{Deserialize, Serialize}; use std::cmp::{Ordering, PartialOrd}; +use serde::{Deserialize, Serialize}; + +use super::{FieldType, FromSql, PrimaryKeyType, Result, SqlType, SqlVal, SqlValRef, ToSql}; + /// Wrapper around a [PrimaryKeyType] to indicate the the primary key /// will be initialized automatically when the object is created in /// the database. diff --git a/butane_core/src/codegen/dbobj.rs b/butane_core/src/codegen/dbobj.rs index 554810d3..2eb2433a 100644 --- a/butane_core/src/codegen/dbobj.rs +++ b/butane_core/src/codegen/dbobj.rs @@ -1,11 +1,12 @@ -use super::*; -use crate::migrations::adb::{DeferredSqlType, TypeIdentifier, MANY_SUFFIX}; -use crate::SqlType; use proc_macro2::TokenStream as TokenStream2; use proc_macro2::{Ident, Span}; use quote::{quote, quote_spanned}; use syn::{spanned::Spanned, Field, ItemStruct}; +use super::*; +use crate::migrations::adb::{DeferredSqlType, TypeIdentifier, MANY_SUFFIX}; +use crate::SqlType; + // Configuration that can be specified with attributes to override default behavior #[derive(Clone, Debug, Default)] pub struct Config { diff --git a/butane_core/src/codegen/migration.rs b/butane_core/src/codegen/migration.rs index 3c4d613e..a6540f87 100644 --- a/butane_core/src/codegen/migration.rs +++ b/butane_core/src/codegen/migration.rs @@ -1,3 +1,5 @@ +use syn::{Field, ItemStruct}; + use super::{ dbobj, fields, get_default, get_deferred_sql_type, get_many_sql_type, is_auto, is_foreign_key, is_many_to_many, is_option, is_row_field, is_unique, pk_field, @@ -5,7 +7,6 @@ use super::{ use crate::migrations::adb::{create_many_table, AColumn, ARef, ATable, DeferredSqlType, TypeKey}; use crate::migrations::{MigrationMut, MigrationsMut}; use crate::Result; -use syn::{Field, ItemStruct}; pub fn write_table_to_disk( ms: &mut impl MigrationsMut, diff --git a/butane_core/src/codegen/mod.rs b/butane_core/src/codegen/mod.rs index a46f5001..75e0aab4 100644 --- a/butane_core/src/codegen/mod.rs +++ b/butane_core/src/codegen/mod.rs @@ -1,8 +1,5 @@ //! Code-generation backend -use crate::migrations::adb::{DeferredSqlType, TypeIdentifier, TypeKey}; -use crate::migrations::{MigrationMut, MigrationsMut}; -use crate::{SqlType, SqlVal}; use proc_macro2::TokenStream as TokenStream2; use proc_macro2::{Ident, Span, TokenTree}; use quote::{quote, ToTokens}; @@ -13,6 +10,10 @@ use syn::{ MetaNameValue, }; +use crate::migrations::adb::{DeferredSqlType, TypeIdentifier, TypeKey}; +use crate::migrations::{MigrationMut, MigrationsMut}; +use crate::{SqlType, SqlVal}; + const OPTION_TYNAMES: [&str; 3] = ["Option", "option::Option", "std::option::Option"]; const MANY_TYNAMES: [&str; 2] = ["Many", "butane::Many"]; const FKEY_TYNAMES: [&str; 2] = ["ForeignKey", "butane::ForeignKey"]; @@ -614,9 +615,10 @@ impl From for CompilerErrorMsg { #[cfg(test)] mod tests { - use super::*; use syn::parse::Parser; + use super::*; + #[test] fn test_get_type_argument_option() { let expected_type_path: syn::Path = syn::parse_quote!(butane::ForeignKey); diff --git a/butane_core/src/custom.rs b/butane_core/src/custom.rs index 40c1ac60..00d8a2e6 100644 --- a/butane_core/src/custom.rs +++ b/butane_core/src/custom.rs @@ -5,9 +5,10 @@ //! source repository. Not supported for the Sqlite backend as Sqlite //! supports a very limited set of types to begin with. -use serde::{Deserialize, Serialize}; use std::fmt; +use serde::{Deserialize, Serialize}; + /// For use with [SqlType::Custom](crate::SqlType) #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] pub enum SqlTypeCustom { diff --git a/butane_core/src/db/connmethods.rs b/butane_core/src/db/connmethods.rs index 71cf74dc..eb3d3ad7 100644 --- a/butane_core/src/db/connmethods.rs +++ b/butane_core/src/db/connmethods.rs @@ -1,11 +1,12 @@ //! Not expected to be called directly by most users. Used by code //! generated by `#[model]`, `query!`, and other macros. -use crate::query::{BoolExpr, Expr, Order}; -use crate::{Result, SqlType, SqlVal, SqlValRef}; use std::ops::{Deref, DerefMut}; use std::vec::Vec; +use crate::query::{BoolExpr, Expr, Order}; +use crate::{Result, SqlType, SqlVal, SqlValRef}; + /// Methods available on a database connection. Most users do not need /// to call these methods directly and will instead use methods on /// [DataObject][crate::DataObject] or the `query!` macro. This trait is diff --git a/butane_core/src/db/helper.rs b/butane_core/src/db/helper.rs index 0b4a0269..948d38b2 100644 --- a/butane_core/src/db/helper.rs +++ b/butane_core/src/db/helper.rs @@ -3,17 +3,18 @@ // may occur if no backends are selected #![allow(unused)] +use std::borrow::Cow; +use std::fmt::Write; + +#[cfg(feature = "datetime")] +use chrono::naive::NaiveDateTime; + use super::Column; use crate::migrations::adb::{AColumn, TypeIdentifier}; use crate::query::Expr::{Condition, Placeholder, Val}; use crate::query::{BoolExpr::*, Expr, Join, Order, OrderDirection}; use crate::Error; use crate::{query, Result, SqlType, SqlVal}; -use std::borrow::Cow; -use std::fmt::Write; - -#[cfg(feature = "datetime")] -use chrono::naive::NaiveDateTime; pub trait PlaceholderSource { fn next_placeholder(&mut self) -> Cow; diff --git a/butane_core/src/db/mod.rs b/butane_core/src/db/mod.rs index 815fc849..90fe56ca 100644 --- a/butane_core/src/db/mod.rs +++ b/butane_core/src/db/mod.rs @@ -12,9 +12,6 @@ //! what a `BackendConnection` can do, but allows using a single concrete type that is not tied to a particular //! database backend. It is returned by the `connect` method. -use crate::query::BoolExpr; -use crate::{migrations::adb, Error, Result, SqlVal, SqlValRef}; -use serde::{Deserialize, Serialize}; use std::borrow::Cow; use std::fmt::Debug; use std::fs; @@ -22,6 +19,11 @@ use std::io::Write; use std::ops::{Deref, DerefMut}; use std::path::Path; +use serde::{Deserialize, Serialize}; + +use crate::query::BoolExpr; +use crate::{migrations::adb, Error, Result, SqlVal, SqlValRef}; + mod connmethods; mod helper; mod macros; @@ -32,16 +34,15 @@ pub mod sqlite; #[cfg(feature = "r2d2")] pub mod r2; +pub use connmethods::{ + BackendRow, BackendRows, Column, ConnectionMethods, MapDeref, QueryResult, RawQueryResult, +}; #[cfg(feature = "r2d2")] pub use r2::ConnectionManager; // Macros are always exported at the root of the crate use crate::connection_method_wrapper; -pub use connmethods::{ - BackendRow, BackendRows, Column, ConnectionMethods, MapDeref, QueryResult, RawQueryResult, -}; - /// Database connection. pub trait BackendConnection: ConnectionMethods + Debug + Send + 'static { /// Begin a database transaction. The transaction object must be diff --git a/butane_core/src/db/pg.rs b/butane_core/src/db/pg.rs index dcd75353..6521358b 100644 --- a/butane_core/src/db/pg.rs +++ b/butane_core/src/db/pg.rs @@ -1,4 +1,13 @@ //! Postgresql database backend +use std::cell::RefCell; +use std::fmt::Write; + +use bytes::BufMut; +#[cfg(feature = "datetime")] +use chrono::NaiveDateTime; +use postgres::fallible_iterator::FallibleIterator; +use postgres::GenericClient; + use super::connmethods::VecRows; use super::helper; use super::*; @@ -6,13 +15,6 @@ use crate::custom::{SqlTypeCustom, SqlValRefCustom}; use crate::migrations::adb::{AColumn, ARef, ATable, Operation, TypeIdentifier, ADB}; use crate::{debug, query}; use crate::{Result, SqlType, SqlVal, SqlValRef}; -use bytes::BufMut; -#[cfg(feature = "datetime")] -use chrono::NaiveDateTime; -use postgres::fallible_iterator::FallibleIterator; -use postgres::GenericClient; -use std::cell::RefCell; -use std::fmt::Write; /// The name of the postgres backend. pub const BACKEND_NAME: &str = "pg"; diff --git a/butane_core/src/db/r2.rs b/butane_core/src/db/r2.rs index e99afff5..e5f5a61f 100644 --- a/butane_core/src/db/r2.rs +++ b/butane_core/src/db/r2.rs @@ -1,7 +1,8 @@ +pub use r2d2::ManageConnection; + use super::connmethods::ConnectionMethodWrapper; use super::*; use crate::Result; -pub use r2d2::ManageConnection; /// R2D2 support for Butane. Implements [`r2d2::ManageConnection`]. #[derive(Clone, Debug)] diff --git a/butane_core/src/db/sqlite.rs b/butane_core/src/db/sqlite.rs index 48a53996..6000ba93 100644 --- a/butane_core/src/db/sqlite.rs +++ b/butane_core/src/db/sqlite.rs @@ -1,7 +1,15 @@ //! SQLite database backend +use std::borrow::Cow; +use std::fmt::Write; +use std::pin::Pin; #[cfg(feature = "log")] use std::sync::Once; +#[cfg(feature = "datetime")] +use chrono::naive::NaiveDateTime; +use fallible_streaming_iterator::FallibleStreamingIterator; +use pin_project::pin_project; + use super::helper; use super::*; use crate::db::connmethods::BackendRows; @@ -10,13 +18,6 @@ use crate::migrations::adb::{AColumn, ARef, ATable, Operation, TypeIdentifier, A use crate::query; use crate::query::Order; use crate::{Result, SqlType, SqlVal, SqlValRef}; -#[cfg(feature = "datetime")] -use chrono::naive::NaiveDateTime; -use fallible_streaming_iterator::FallibleStreamingIterator; -use pin_project::pin_project; -use std::borrow::Cow; -use std::fmt::Write; -use std::pin::Pin; #[cfg(feature = "datetime")] const SQLITE_DT_FORMAT: &str = "%Y-%m-%d %H:%M:%S"; diff --git a/butane_core/src/fkey.rs b/butane_core/src/fkey.rs index 560f7ab7..f102096e 100644 --- a/butane_core/src/fkey.rs +++ b/butane_core/src/fkey.rs @@ -1,14 +1,15 @@ //! Implementation of foreign key relationships between models. #![deny(missing_docs)] -use crate::db::ConnectionMethods; -use crate::*; -use once_cell::unsync::OnceCell; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::borrow::Cow; use std::fmt::{Debug, Formatter}; #[cfg(feature = "fake")] use fake::{Dummy, Faker}; +use once_cell::unsync::OnceCell; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +use crate::db::ConnectionMethods; +use crate::*; /// Used to implement a relationship between models. /// diff --git a/butane_core/src/lib.rs b/butane_core/src/lib.rs index 3a930f3c..80b754ee 100644 --- a/butane_core/src/lib.rs +++ b/butane_core/src/lib.rs @@ -1,8 +1,9 @@ #![allow(clippy::iter_nth_zero)] #![allow(clippy::upper_case_acronyms)] //grandfathered, not going to break API to rename -use serde::{Deserialize, Serialize}; use std::cmp::{Eq, PartialEq}; use std::default::Default; + +use serde::{Deserialize, Serialize}; use thiserror::Error as ThisError; pub mod codegen; @@ -19,10 +20,8 @@ pub mod uuid; mod autopk; pub use autopk::AutoPk; - -use db::{BackendRow, Column, ConnectionMethods}; - use custom::SqlTypeCustom; +use db::{BackendRow, Column, ConnectionMethods}; pub use query::Query; pub use sqlval::*; diff --git a/butane_core/src/many.rs b/butane_core/src/many.rs index 8dd3cef3..e0e09c4c 100644 --- a/butane_core/src/many.rs +++ b/butane_core/src/many.rs @@ -1,14 +1,15 @@ //! Implementation of many-to-many relationships between models. #![deny(missing_docs)] -use crate::db::{Column, ConnectionMethods}; -use crate::query::{BoolExpr, Expr, OrderDirection, Query}; -use crate::{DataObject, Error, FieldType, PrimaryKeyType, Result, SqlType, SqlVal, ToSql}; -use once_cell::unsync::OnceCell; -use serde::{Deserialize, Serialize}; use std::borrow::Cow; #[cfg(feature = "fake")] use fake::{Dummy, Faker}; +use once_cell::unsync::OnceCell; +use serde::{Deserialize, Serialize}; + +use crate::db::{Column, ConnectionMethods}; +use crate::query::{BoolExpr, Expr, OrderDirection, Query}; +use crate::{DataObject, Error, FieldType, PrimaryKeyType, Result, SqlType, SqlVal, ToSql}; fn default_oc() -> OnceCell> { OnceCell::default() diff --git a/butane_core/src/migrations/adb.rs b/butane_core/src/migrations/adb.rs index 639fee9f..4214bdd3 100644 --- a/butane_core/src/migrations/adb.rs +++ b/butane_core/src/migrations/adb.rs @@ -2,13 +2,14 @@ //! CLI tool, there is no need to use this module. Even if applying //! migrations without this tool, you are unlikely to need this module. +use std::cmp::Ordering; +use std::collections::{BTreeMap, BTreeSet, HashMap}; + #[cfg(feature = "json")] use once_cell::sync::Lazy; +use serde::{de::Deserializer, de::Visitor, ser::Serializer, Deserialize, Serialize}; use crate::{Error, Result, SqlType, SqlVal}; -use serde::{de::Deserializer, de::Visitor, ser::Serializer, Deserialize, Serialize}; -use std::cmp::Ordering; -use std::collections::{BTreeMap, BTreeSet, HashMap}; /// Suffix added to [`crate::many::Many`] tables. pub const MANY_SUFFIX: &str = "_Many"; diff --git a/butane_core/src/migrations/fsmigrations.rs b/butane_core/src/migrations/fsmigrations.rs index 27ab4358..9e0f93a1 100644 --- a/butane_core/src/migrations/fsmigrations.rs +++ b/butane_core/src/migrations/fsmigrations.rs @@ -1,17 +1,18 @@ -use super::adb::{ATable, DeferredSqlType, TypeKey, ADB}; -use super::fs::{Filesystem, OsFilesystem}; -use super::{Migration, MigrationMut, Migrations, MigrationsMut}; -use crate::{ConnectionMethods, DataObject, Error, Result}; -use fs2::FileExt; -use serde::{Deserialize, Serialize}; use std::borrow::Cow; use std::collections::BTreeMap; use std::fs::{File, OpenOptions}; - use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::rc::Rc; +use fs2::FileExt; +use serde::{Deserialize, Serialize}; + +use super::adb::{ATable, DeferredSqlType, TypeKey, ADB}; +use super::fs::{Filesystem, OsFilesystem}; +use super::{Migration, MigrationMut, Migrations, MigrationsMut}; +use crate::{ConnectionMethods, DataObject, Error, Result}; + type SqlTypeMap = BTreeMap; const TYPES_FILENAME: &str = "types.json"; diff --git a/butane_core/src/migrations/memmigrations.rs b/butane_core/src/migrations/memmigrations.rs index b926fc64..b5adfe21 100644 --- a/butane_core/src/migrations/memmigrations.rs +++ b/butane_core/src/migrations/memmigrations.rs @@ -1,10 +1,12 @@ +use std::borrow::Cow; +use std::collections::BTreeMap; + +use serde::{Deserialize, Serialize}; + use super::adb::{ATable, DeferredSqlType, TypeKey, ADB}; use super::{ButaneMigration, Migration, MigrationMut, Migrations, MigrationsMut}; use crate::query::BoolExpr; use crate::{ConnectionMethods, DataObject, Result}; -use serde::{Deserialize, Serialize}; -use std::borrow::Cow; -use std::collections::BTreeMap; /// A migration stored in memory. #[derive(Clone, Debug, Deserialize, Serialize)] diff --git a/butane_core/src/migrations/migration.rs b/butane_core/src/migrations/migration.rs index e00a525c..ac6240f4 100644 --- a/butane_core/src/migrations/migration.rs +++ b/butane_core/src/migrations/migration.rs @@ -1,11 +1,12 @@ +use std::borrow::Cow; +use std::cmp::PartialEq; +use std::fmt::Debug; + use super::adb::{ATable, DeferredSqlType, TypeKey, ADB}; use super::ButaneMigration; use crate::db::ConnectionMethods; use crate::query::{BoolExpr, Expr}; use crate::{db, sqlval::ToSql, DataObject, DataResult, Error, Result}; -use std::borrow::Cow; -use std::cmp::PartialEq; -use std::fmt::Debug; /// Type representing a database migration. A migration describes how /// to bring the database from state A to state B. In general, the diff --git a/butane_core/src/migrations/mod.rs b/butane_core/src/migrations/mod.rs index c7b05e98..f02f7b55 100644 --- a/butane_core/src/migrations/mod.rs +++ b/butane_core/src/migrations/mod.rs @@ -1,13 +1,14 @@ //! For working with migrations. If using the butane CLI tool, it is //! not necessary to use these types directly. +use std::path::Path; + +use fallible_iterator::FallibleIterator; + use crate::db::BackendRows; use crate::db::{Column, ConnectionMethods}; use crate::sqlval::{FromSql, SqlValRef, ToSql}; use crate::{db, query, DataObject, DataResult, Error, Result, SqlType}; -use fallible_iterator::FallibleIterator; -use std::path::Path; - pub mod adb; use adb::{AColumn, ATable, DeferredSqlType, Operation, TypeIdentifier, ADB}; diff --git a/butane_core/src/query/fieldexpr.rs b/butane_core/src/query/fieldexpr.rs index f529443f..d0c396c7 100644 --- a/butane_core/src/query/fieldexpr.rs +++ b/butane_core/src/query/fieldexpr.rs @@ -1,12 +1,13 @@ //! Not expected to be used directly. +use std::borrow::{Borrow, Cow}; +use std::cmp::{PartialEq, PartialOrd}; +use std::marker::PhantomData; + use crate::fkey::ForeignKey; use crate::query::{BoolExpr, Column, Expr, Join}; use crate::sqlval::{FieldType, SqlVal, ToSql}; use crate::DataObject; -use std::borrow::{Borrow, Cow}; -use std::cmp::{PartialEq, PartialOrd}; -use std::marker::PhantomData; macro_rules! binary_op { ($func_name:ident, $bound:path, $cond:ident) => { diff --git a/butane_core/src/query/mod.rs b/butane_core/src/query/mod.rs index 6a38b568..6eea949e 100644 --- a/butane_core/src/query/mod.rs +++ b/butane_core/src/query/mod.rs @@ -2,12 +2,14 @@ //! the `query!`, `filter!`, and `find!` macros instead of using this //! module directly. -use crate::db::{BackendRows, ConnectionMethods, QueryResult}; -use crate::{DataResult, Result, SqlVal}; -use fallible_iterator::FallibleIterator; use std::borrow::Cow; use std::marker::PhantomData; +use fallible_iterator::FallibleIterator; + +use crate::db::{BackendRows, ConnectionMethods, QueryResult}; +use crate::{DataResult, Result, SqlVal}; + mod fieldexpr; pub use fieldexpr::{DataOrd, FieldExpr, ManyFieldExpr}; diff --git a/butane_core/src/sqlval.rs b/butane_core/src/sqlval.rs index 0aa7c5c9..f00f9fd3 100644 --- a/butane_core/src/sqlval.rs +++ b/butane_core/src/sqlval.rs @@ -1,18 +1,18 @@ //! Types and traits for interacting with a value that can be stored in the database. -use crate::custom::{SqlValCustom, SqlValRefCustom}; -use crate::{DataObject, Error::CannotConvertSqlVal, Result, SqlType}; -use serde::{Deserialize, Serialize}; use std::borrow::Cow; #[cfg(feature = "json")] use std::collections::{BTreeMap, HashMap}; use std::fmt; -#[cfg(feature = "pg")] -use crate::custom::SqlTypeCustom; - #[cfg(feature = "datetime")] use chrono::{naive::NaiveDateTime, DateTime}; +use serde::{Deserialize, Serialize}; + +#[cfg(feature = "pg")] +use crate::custom::SqlTypeCustom; +use crate::custom::{SqlValCustom, SqlValRefCustom}; +use crate::{DataObject, Error::CannotConvertSqlVal, Result, SqlType}; #[derive(Clone, Debug)] pub enum SqlValRef<'a> { diff --git a/butane_core/src/uuid.rs b/butane_core/src/uuid.rs index afbac738..888e50de 100644 --- a/butane_core/src/uuid.rs +++ b/butane_core/src/uuid.rs @@ -1,11 +1,12 @@ //! Uuid support #![deny(missing_docs)] +use uuid::Uuid; + use crate::{ Error::CannotConvertSqlVal, FieldType, FromSql, PrimaryKeyType, Result, SqlType, SqlVal, SqlValRef, ToSql, }; -use uuid::Uuid; impl ToSql for Uuid { fn to_sql(&self) -> SqlVal { diff --git a/butane_core/tests/connection.rs b/butane_core/tests/connection.rs index a79b8e1e..4b4f0aaf 100644 --- a/butane_core/tests/connection.rs +++ b/butane_core/tests/connection.rs @@ -1,5 +1,4 @@ use butane_core::db::{connect, BackendConnection, Connection, ConnectionSpec}; - use butane_test_helper::*; fn connection_not_closed(conn: Connection) { diff --git a/butane_core/tests/transactions.rs b/butane_core/tests/transactions.rs index 891e2b25..8f642176 100644 --- a/butane_core/tests/transactions.rs +++ b/butane_core/tests/transactions.rs @@ -1,5 +1,4 @@ use butane_core::db::{BackendConnection, Connection}; - use butane_test_helper::*; fn commit_empty_transaction(mut conn: Connection) { diff --git a/butane_test_helper/src/lib.rs b/butane_test_helper/src/lib.rs index 67e10ac5..8cbe6556 100644 --- a/butane_test_helper/src/lib.rs +++ b/butane_test_helper/src/lib.rs @@ -1,11 +1,12 @@ -use butane_core::db::{connect, get_backend, pg, sqlite, Backend, Connection, ConnectionSpec}; -use butane_core::migrations::{self, MemMigrations, Migration, Migrations, MigrationsMut}; -use once_cell::sync::Lazy; use std::io::{BufRead, BufReader, Read, Write}; use std::ops::Deref; use std::path::PathBuf; use std::process::{ChildStderr, Command, Stdio}; use std::sync::Mutex; + +use butane_core::db::{connect, get_backend, pg, sqlite, Backend, Connection, ConnectionSpec}; +use butane_core::migrations::{self, MemMigrations, Migration, Migrations, MigrationsMut}; +use once_cell::sync::Lazy; use uuid::Uuid; pub fn pg_connection() -> (Connection, PgSetupData) { diff --git a/docs/getting-started.md b/docs/getting-started.md index dcf6846f..32e68237 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -49,6 +49,7 @@ connection parameters. At this point, we can add a method (in our ``` rust use butane::db::{Connection, ConnectionSpec}; + pub fn establish_connection() -> Connection { butane::db::connect(&ConnectionSpec::load(".butane/connection.json").unwrap()).unwrap() } @@ -248,9 +249,10 @@ doc = false And write its code (in `src/bin/write_post.rs`). ``` rust -use getting_started::*; use std::io::{stdin, Read}; +use getting_started::*; + fn main() { let conn = establish_connection(); @@ -318,7 +320,8 @@ Let's add another binary to `Cargo.toml`, this one called `show_posts`, and writ ``` rust use butane::query; -use getting_started::models::*; + +use getting_started::models::Post; use getting_started::*; fn main() { @@ -350,10 +353,12 @@ mark it as published, and save it again. Add `publish_post` binary to `Cargo.toml`, and write its code (in `src/bin/publish_post.rs`). ``` rust -use self::models::Post; +use std::env::args; + use butane::prelude::*; + +use getting_started::models::Post; use getting_started::*; -use std::env::args; fn main() { let id = args() @@ -384,11 +389,13 @@ commonly) with the `delete` method on `Query` to delete directly. Here's our `delete_post` program (in `src/bin/delete_post.rs`): ``` rust -use self::models::Post; -use getting_started::*; -use butane::query; use std::env::args; +use butane::query; + +use getting_started::models::Post; +use getting_started::*; + fn main() { let target = args().nth(1).expect("Expected a target to match against"); let pattern = format!("%{}%", target); diff --git a/example/src/main.rs b/example/src/main.rs index 8027a2d9..bc60dec1 100644 --- a/example/src/main.rs +++ b/example/src/main.rs @@ -1,8 +1,7 @@ #![allow(dead_code)] use butane::db::{Connection, ConnectionSpec}; -use butane::{find, model, query, AutoPk, Error, ForeignKey, Many}; - use butane::prelude::*; +use butane::{find, model, query, AutoPk, Error, ForeignKey, Many}; type Result = std::result::Result; diff --git a/examples/getting_started/src/bin/delete_post.rs b/examples/getting_started/src/bin/delete_post.rs index dc979464..02a8d493 100644 --- a/examples/getting_started/src/bin/delete_post.rs +++ b/examples/getting_started/src/bin/delete_post.rs @@ -1,7 +1,8 @@ -use self::models::Post; +use std::env::args; + use butane::query; +use getting_started::models::Post; use getting_started::*; -use std::env::args; fn main() { let target = args().nth(1).expect("Expected a target to match against"); diff --git a/examples/getting_started/src/bin/publish_post.rs b/examples/getting_started/src/bin/publish_post.rs index 0a8df84b..6073d7f4 100644 --- a/examples/getting_started/src/bin/publish_post.rs +++ b/examples/getting_started/src/bin/publish_post.rs @@ -1,8 +1,9 @@ #![allow(clippy::expect_fun_call)] -use self::models::Post; +use std::env::args; + use butane::prelude::*; +use getting_started::models::Post; use getting_started::*; -use std::env::args; fn main() { let id = args() diff --git a/examples/getting_started/src/bin/show_posts.rs b/examples/getting_started/src/bin/show_posts.rs index 1f0103c3..cc879a16 100644 --- a/examples/getting_started/src/bin/show_posts.rs +++ b/examples/getting_started/src/bin/show_posts.rs @@ -1,5 +1,5 @@ use butane::query; -use getting_started::models::*; +use getting_started::models::Post; use getting_started::*; fn main() { diff --git a/examples/getting_started/src/bin/write_post.rs b/examples/getting_started/src/bin/write_post.rs index 6bdf6259..ad58b7cf 100644 --- a/examples/getting_started/src/bin/write_post.rs +++ b/examples/getting_started/src/bin/write_post.rs @@ -1,6 +1,7 @@ -use getting_started::*; use std::io::{stdin, Read}; +use getting_started::*; + fn main() { let conn = establish_connection(); From 08caf3cd0dda66b75796b9a143060726ba900b4b Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Mon, 13 Nov 2023 09:35:27 +0800 Subject: [PATCH 2/2] Remove * imports --- butane/tests/fake.rs | 5 ++--- butane_codegen/src/filter.rs | 3 +-- butane_core/src/codegen/dbobj.rs | 9 ++++++--- butane_core/src/db/mod.rs | 6 +++--- butane_core/src/db/pg.rs | 10 +++++++--- butane_core/src/db/r2.rs | 12 +++++++++--- butane_core/src/db/sqlite.rs | 15 ++++++++++----- butane_core/src/fkey.rs | 4 +++- butane_core/src/lib.rs | 2 +- 9 files changed, 42 insertions(+), 24 deletions(-) diff --git a/butane/tests/fake.rs b/butane/tests/fake.rs index 563c7599..42cf9ef4 100644 --- a/butane/tests/fake.rs +++ b/butane/tests/fake.rs @@ -1,13 +1,12 @@ use butane::db::Connection; use butane::{find, DataObject, ForeignKey}; use butane_test_helper::*; +use fake::{Fake, Faker}; mod common; +use common::blog::{Blog, Post, Tag}; fn fake_blog_post(conn: Connection) { - use common::blog::{Blog, Post, Tag}; - use fake::{Fake, Faker}; - let mut fake_blog: Blog = Faker.fake(); fake_blog.save(&conn).unwrap(); diff --git a/butane_codegen/src/filter.rs b/butane_codegen/src/filter.rs index 08583950..b97d57b6 100755 --- a/butane_codegen/src/filter.rs +++ b/butane_codegen/src/filter.rs @@ -1,10 +1,9 @@ +use butane_core::make_compile_error; use proc_macro2::Span; use proc_macro2::TokenStream as TokenStream2; use quote::{quote, quote_spanned, ToTokens}; use syn::{spanned::Spanned, BinOp, Expr, ExprBinary, ExprMethodCall, ExprPath, Ident, LitStr}; -use super::*; - pub fn for_expr(dbres: &Ident, expr: &Expr) -> TokenStream2 { handle_expr("e!(<#dbres as butane::DataResult>::DBO::fields()), expr) } diff --git a/butane_core/src/codegen/dbobj.rs b/butane_core/src/codegen/dbobj.rs index 2eb2433a..330473b7 100644 --- a/butane_core/src/codegen/dbobj.rs +++ b/butane_core/src/codegen/dbobj.rs @@ -1,9 +1,12 @@ use proc_macro2::TokenStream as TokenStream2; use proc_macro2::{Ident, Span}; -use quote::{quote, quote_spanned}; -use syn::{spanned::Spanned, Field, ItemStruct}; +use quote::{quote, quote_spanned, ToTokens}; +use syn::{spanned::Spanned, Field, ItemStruct, LitStr}; -use super::*; +use super::{ + fields, get_autopk_sql_type, get_type_argument, is_auto, is_many_to_many, is_row_field, + make_ident_literal_str, make_lit, pk_field, MANY_TYNAMES, +}; use crate::migrations::adb::{DeferredSqlType, TypeIdentifier, MANY_SUFFIX}; use crate::SqlType; diff --git a/butane_core/src/db/mod.rs b/butane_core/src/db/mod.rs index 90fe56ca..2a14970a 100644 --- a/butane_core/src/db/mod.rs +++ b/butane_core/src/db/mod.rs @@ -25,6 +25,9 @@ use crate::query::BoolExpr; use crate::{migrations::adb, Error, Result, SqlVal, SqlValRef}; mod connmethods; +pub use connmethods::{ + BackendRow, BackendRows, Column, ConnectionMethods, MapDeref, QueryResult, RawQueryResult, +}; mod helper; mod macros; #[cfg(feature = "pg")] @@ -34,9 +37,6 @@ pub mod sqlite; #[cfg(feature = "r2d2")] pub mod r2; -pub use connmethods::{ - BackendRow, BackendRows, Column, ConnectionMethods, MapDeref, QueryResult, RawQueryResult, -}; #[cfg(feature = "r2d2")] pub use r2::ConnectionManager; diff --git a/butane_core/src/db/pg.rs b/butane_core/src/db/pg.rs index 6521358b..ba19fc2e 100644 --- a/butane_core/src/db/pg.rs +++ b/butane_core/src/db/pg.rs @@ -1,6 +1,7 @@ //! Postgresql database backend +use std::borrow::Cow; use std::cell::RefCell; -use std::fmt::Write; +use std::fmt::{Debug, Write}; use bytes::BufMut; #[cfg(feature = "datetime")] @@ -10,11 +11,14 @@ use postgres::GenericClient; use super::connmethods::VecRows; use super::helper; -use super::*; use crate::custom::{SqlTypeCustom, SqlValRefCustom}; +use crate::db::{ + Backend, BackendConnection, BackendRow, BackendTransaction, Column, Connection, + ConnectionMethods, RawQueryResult, Transaction, +}; use crate::migrations::adb::{AColumn, ARef, ATable, Operation, TypeIdentifier, ADB}; use crate::{debug, query}; -use crate::{Result, SqlType, SqlVal, SqlValRef}; +use crate::{query::BoolExpr, Error, Result, SqlType, SqlVal, SqlValRef}; /// The name of the postgres backend. pub const BACKEND_NAME: &str = "pg"; diff --git a/butane_core/src/db/r2.rs b/butane_core/src/db/r2.rs index e5f5a61f..27d7ea7b 100644 --- a/butane_core/src/db/r2.rs +++ b/butane_core/src/db/r2.rs @@ -1,8 +1,14 @@ +//! R2D2 support for Butane. +use std::ops::Deref; + pub use r2d2::ManageConnection; -use super::connmethods::ConnectionMethodWrapper; -use super::*; -use crate::Result; +use crate::connection_method_wrapper; +use crate::db::connmethods::ConnectionMethodWrapper; +use crate::db::{ + BackendConnection, Column, Connection, ConnectionMethods, ConnectionSpec, RawQueryResult, +}; +use crate::{query::BoolExpr, Result, SqlVal, SqlValRef}; /// R2D2 support for Butane. Implements [`r2d2::ManageConnection`]. #[derive(Clone, Debug)] diff --git a/butane_core/src/db/sqlite.rs b/butane_core/src/db/sqlite.rs index 6000ba93..71c062d0 100644 --- a/butane_core/src/db/sqlite.rs +++ b/butane_core/src/db/sqlite.rs @@ -1,6 +1,8 @@ //! SQLite database backend use std::borrow::Cow; -use std::fmt::Write; +use std::fmt::{Debug, Write}; +use std::ops::Deref; +use std::path::Path; use std::pin::Pin; #[cfg(feature = "log")] use std::sync::Once; @@ -11,13 +13,16 @@ use fallible_streaming_iterator::FallibleStreamingIterator; use pin_project::pin_project; use super::helper; -use super::*; -use crate::db::connmethods::BackendRows; +use crate::connection_method_wrapper; +use crate::db::{ + Backend, BackendConnection, BackendRow, BackendRows, BackendTransaction, Column, Connection, + ConnectionMethods, RawQueryResult, Transaction, +}; use crate::debug; use crate::migrations::adb::{AColumn, ARef, ATable, Operation, TypeIdentifier, ADB}; use crate::query; -use crate::query::Order; -use crate::{Result, SqlType, SqlVal, SqlValRef}; +use crate::query::{BoolExpr, Order}; +use crate::{Error, Result, SqlType, SqlVal, SqlValRef}; #[cfg(feature = "datetime")] const SQLITE_DT_FORMAT: &str = "%Y-%m-%d %H:%M:%S"; diff --git a/butane_core/src/fkey.rs b/butane_core/src/fkey.rs index f102096e..fb779182 100644 --- a/butane_core/src/fkey.rs +++ b/butane_core/src/fkey.rs @@ -9,7 +9,9 @@ use once_cell::unsync::OnceCell; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use crate::db::ConnectionMethods; -use crate::*; +use crate::{ + AsPrimaryKey, DataObject, Error, FieldType, FromSql, Result, SqlType, SqlVal, SqlValRef, ToSql, +}; /// Used to implement a relationship between models. /// diff --git a/butane_core/src/lib.rs b/butane_core/src/lib.rs index 80b754ee..b196242e 100644 --- a/butane_core/src/lib.rs +++ b/butane_core/src/lib.rs @@ -23,7 +23,7 @@ pub use autopk::AutoPk; use custom::SqlTypeCustom; use db::{BackendRow, Column, ConnectionMethods}; pub use query::Query; -pub use sqlval::*; +pub use sqlval::{AsPrimaryKey, FieldType, FromSql, PrimaryKeyType, SqlVal, SqlValRef, ToSql}; pub type Result = std::result::Result;