Skip to content

Commit c27914f

Browse files
authored
Fix python optional bug and ttl ms (#70)
* fix python optional payload * cli ttl ms * Update ttl to ttl_ms * Update docs * Fix format * Fix lint
1 parent ff0e56e commit c27914f

32 files changed

+580
-324
lines changed

cli/schema.memorix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Namespace standalone {
4747
id: u32
4848
other_id: u64
4949
}
50-
ttl: env(ABC_TTL)
50+
ttl_ms: env(ABC_TTL)
5151
public: [
5252
get
5353
set

cli/src/export_schema.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub struct ExportNamespace {
3030
pub struct ExportCacheItem<T> {
3131
pub key: Option<T>,
3232
pub payload: T,
33-
pub ttl: Option<Value>,
33+
pub ttl_ms: Option<Value>,
3434
pub extend_on_get: Option<Value>,
3535
pub expose: Vec<CacheOperation>,
3636
}
@@ -105,7 +105,7 @@ fn namespace_to_export_namespace(namespace: &Namespace, expose_all: bool) -> Exp
105105
key: x.key,
106106
payload: x.payload,
107107
expose: v,
108-
ttl: x.ttl,
108+
ttl_ms: x.ttl_ms,
109109
extend_on_get: x.extend_on_get,
110110
},
111111
)

cli/src/flat_schema.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn namespace_to_flat_namespace(
162162
&mut type_object_items,
163163
),
164164
expose: x.expose.clone(),
165-
ttl: x.ttl.clone(),
165+
ttl_ms: x.ttl_ms.clone(),
166166
extend_on_get: x.extend_on_get.clone(),
167167
},
168168
)

cli/src/languages/python.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ fn namespace_to_code(
198198
.join(""),
199199
options = {
200200
let content = [
201-
item.ttl.as_ref().map(|x| {
201+
item.ttl_ms.as_ref().map(|x| {
202202
format!(
203-
"{base_indent} ttl={},",
203+
"{base_indent} ttl_ms={},",
204204
value_to_code(x)
205205
)
206206
}),

cli/src/languages/rust.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ fn namespace_to_code(
201201
{base_indent} }})"#,
202202
content = [
203203
format!(
204-
"{base_indent} ttl: {},",
205-
item.ttl.as_ref().map_or("None".to_string(), |x| format!(
204+
"{base_indent} ttl_ms: {},",
205+
item.ttl_ms.as_ref().map_or("None".to_string(), |x| format!(
206206
"Some({})",
207207
value_to_code(x)
208208
))

cli/src/languages/typescript.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ super_call= match name_tree.is_empty() {
184184
.join(", "),
185185
options = {
186186
let content = [
187-
item.ttl.as_ref().map(|x| format!(
188-
"{base_indent} ttl: {},",value_to_code(x))),
187+
item.ttl_ms.as_ref().map(|x| format!(
188+
"{base_indent} ttl_ms: {},",value_to_code(x))),
189189
item.extend_on_get.as_ref().map(|x| format!(
190190
"{base_indent} extendOnGet: {},",value_to_code(x))),
191191
]

cli/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ Cache {
375375
session_token: string
376376
expiry: u64
377377
}
378-
ttl: env(USER_SESSION_TTL)
378+
ttl_ms: env(USER_SESSION_TTL_MS)
379379
}
380380
}
381381
@@ -401,7 +401,7 @@ Namespace UserService {
401401
session_token: string
402402
expiry: u64
403403
}
404-
ttl: env(USER_SESSION_TTL)
404+
ttl_ms: env(USER_SESSION_TTL_MS)
405405
}
406406
}
407407
@@ -499,7 +499,7 @@ Type {
499499
how_many_atoms: {
500500
payload: u32
501501
key: u64
502-
ttl: env( TTL_HOW_MANY_ATOMS )
502+
ttl_ms: env( TTL_MS_HOW_MANY_ATOMS )
503503
}
504504
}
505505
PubSub {

cli/src/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ pub struct EnumItem {
135135
pub struct CacheItem {
136136
pub key: Option<TypeItem>,
137137
pub payload: TypeItem,
138-
pub ttl: Option<Value>,
138+
pub ttl_ms: Option<Value>,
139139
pub extend_on_get: Option<Value>,
140140
pub public: Option<Vec<CacheOperation>>,
141141
}
142142
impl_from_and_to_sdl_for_struct! {
143143
(CacheItem, 5),
144144
(key: TypeItem, 0, false),
145145
(payload: TypeItem, 1, true),
146-
(ttl: Value, 2, false),
146+
(ttl_ms: Value, 2, false),
147147
(extend_on_get: Value, 3, false),
148148
(public: Vec<CacheOperation>, 4, false),
149149
}

cli/src/schema2.memorix

Lines changed: 0 additions & 27 deletions
This file was deleted.

cli/src/schema3.memorix

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)