bin

bin

Member Since 3 years ago

Shangri-La

Experience Points
6
follower
Lessons Completed
1
follow
Lessons Completed
57
stars
Best Reply Awards
12
repos

10 contributions in the last year

Pinned
⚡ Vim todo list plugin
⚡ A dark Vim colorscheme
Activity
Oct
23
1 month ago
Activity icon
issue

bin issue comment launchbadge/sqlx

bin
bin

SQLX Mysql Enum decode error

 ColumnDecode { index: "\"template_type\"", source: "mismatched types; Rust type `template::app::model::TemplateType` (as SQL type `ENUM`) is not compatible with SQL type `ENUM`" }
#[derive(Serialize, Deserialize, Clone, Debug, EnumString, ToString, Type)]
// #[sqlx(rename="template_type", rename_all = "snake_case")] 
pub enum TemplateType {
    Email,
    Pns
}


#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Template {
    pub tname: String,
    pub template_type: TemplateType,
    pub created_at: DateTime::<Utc>
}
bin
bin

I am experiencing the same issue; I've added #[repr(u8)] to my enums and represent them as TINYINTs instead in MariaDB as a temporary fix.

Activity icon
issue

bin issue comment launchbadge/sqlx

bin
bin

[Proposal] [Next] Query Logging Improvements

A lot of people will probably agree with me when I say there's room for improvement with how we currently log queries.

  1. Logging is very noisy because we always print the whole query at INFO. I think at most we should be printing at INFO is the source file and line of the query (which we can do with #[track_caller] and std::panic::Location::caller()), maybe the first couple keywords in the query as context, and the time the query took. We should only be logging the full query (with parameters interpolated) at TRACE.

  2. Logging is expensive because we pretty-print the SQL. I think we shouldn't be doing nearly that much to it. At most, we should be removing excess indentation so the query isn't weirdly left-padded in logs. I think sqlformat can help us there instead of rolling it ourselves. (cc @shssoichiro)

  3. It doesn't make sense for ConnectOptions::{log_statements, log_slow_statements} to take a log::LevelFilter; instead, it should be Option<log::Level>. Then, if someone is using a crate like tracing that includes log but doesn't want to use log directly, they can still disable query logging by passing None (#939).

  4. (Bug) we don't actually obey the log-level setting for sqlx::query, only the global log setting. This doesn't need to be in next, though; I'll be fixing it shortly. Done: #945

bin
bin

I'd suggest adding the ability to entirely disable logging of the actual query and print just a warning message with the line number when a query is slow, as this would be useful for very large queries. I use large batch insert queries that max out the number of placeholders, and formatting these to log causes my inserts to take about thirty times longer in debug builds and around three times longer in release. It chews up quite a lot of CPU in the process compared to the non-logging insertions (which are mainly I/O bound.)

Oct
1
2 months ago
Activity icon
issue

bin issue comment JedWatson/react-select

bin
bin

How to change the value of React-Select using React-Hook-Form

I'm using react-hook-form to manage my forms and also using react-select for my select elements What I want to do is actually very simple but I just couldn't do it and I'm stuck here.

I want to change the value of react-select with external conditions but how do I do this with react-hook-form

The code sample I've written. I want to get the selected value on the radio and set it to react-select

https://codesandbox.io/s/react-hook-form-controller-v5-forked-ndh54?file=/src/index.jsx

note: if the react-select value changes, the radio does not need to be changed either. the main purpose is to manipulate react-select from radio

bin
bin

The above example is currently not working on version 5.0.0 with typescript; the options prop gives a type error that necessitates ts-ignore. Any ideas on how to resolve this?

Sep
18
2 months ago
started
started time in 2 months ago
Sep
5
3 months ago
started
started time in 2 months ago