Skip to content

Commit 9ad9aaa

Browse files
committed
0.4.1
1 parent 06f5bbd commit 9ad9aaa

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "multisql"
3-
version = "0.4.0"
3+
version = "0.4.1"
44
authors = ["Kyran Gostelow <kyran@gostelow.me>", "Taehoon Moon <taehoon.moon@outlook.com>"]
55
edition = "2021"
66
description = "MultiSQL"

src/data/value/mod.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ impl From<i64> for Value {
103103
Value::I64(from)
104104
}
105105
}
106+
impl From<u64> for Value {
107+
fn from(from: u64) -> Value {
108+
Value::U64(from)
109+
}
110+
}
106111
impl From<f64> for Value {
107112
fn from(from: f64) -> Value {
108113
Value::F64(from)
@@ -113,8 +118,15 @@ impl From<String> for Value {
113118
Value::Str(from)
114119
}
115120
}
121+
122+
impl<T: Into<Value>> From<Option<T>> for Value {
123+
fn from(from: Option<T>) -> Value {
124+
from.map(|v| v.into()).unwrap_or(Value::Null)
125+
}
126+
}
127+
116128
impl From<Value> for String {
117-
// unsafe
129+
// assumes all can be cast to string
118130
fn from(from: Value) -> String {
119131
from.cast().unwrap()
120132
}
@@ -124,6 +136,7 @@ impl PartialEq for Value {
124136
fn eq(&self, other: &Value) -> bool {
125137
match (self, other) {
126138
(Value::Bool(l), Value::Bool(r)) => l == r,
139+
(Value::U64(l), Value::U64(r)) => l == r,
127140
(Value::I64(l), Value::I64(r)) => l == r,
128141
(Value::F64(l), Value::F64(r)) => l == r,
129142
(Value::Str(l), Value::Str(r)) => l == r,

0 commit comments

Comments
 (0)