I wish to do a cached message for client, to avoid all message sent to a new client. but we dont have a way to do that, then I manage to maintain
two tables to do that. on for keep all ,one for keep the newst 10 messages.
but both dont works.
SQL can not support the ORDER
and
when Insert to a table, it can not insert in order also。
so how can I do, or can you make some method to do that,
not everything need to sync。。
PS /home/ubuntu> spacetime sql combat "SELECT * FROM world_message"
WARNING: This command is UNSTABLE and subject to breaking changes.
sender | name | sent | text
-------------------------------------------------------------------------------+----------------+------------------+------
87749735942141927258676195533202707267511107059813012757897815701149281837291 | "我是头号玩家" | 1741868642733860 | "16"
87749735942141927258676195533202707267511107059813012757897815701149281837291 | "我是头号玩家" | 1741868642733624 | "15"
87749735942141927258676195533202707267511107059813012757897815701149281837291 | "我是头号玩家" | 1741868642733379 | "14"
87749735942141927258676195533202707267511107059813012757897815701149281837291 | "我是头号玩家" | 1741868642733152 | "13"
87749735942141927258676195533202707267511107059813012757897815701149281837291 | "我是头号玩家" | 1741868642732828 | "12"
87749735942141927258676195533202707267511107059813012757897815701149281837291 | "我是头号玩家" | 1741868642732522 | "11"
the code is show bellow
ctx.db.world_message_all().insert(new_message.clone());
ctx.db.world_message().insert(new_message)
// more than 10 ,clear all of the table
if ctx.db.world_message().count() >= 10 {
// delete
for msg in ctx.db.world_message().iter() {
ctx.db.world_message().delete(msg);
}
}
Ok(())
}
I wish to do a cached message for client, to avoid all message sent to a new client. but we dont have a way to do that, then I manage to maintain
two tables to do that. on for keep all ,one for keep the newst 10 messages.
but both dont works.
SQL can not support the ORDER
and
when Insert to a table, it can not insert in order also。
so how can I do, or can you make some method to do that,
not everything need to sync。。
PS /home/ubuntu> spacetime sql combat "SELECT * FROM world_message"
WARNING: This command is UNSTABLE and subject to breaking changes.
sender | name | sent | text
-------------------------------------------------------------------------------+----------------+------------------+------
87749735942141927258676195533202707267511107059813012757897815701149281837291 | "我是头号玩家" | 1741868642733860 | "16"
87749735942141927258676195533202707267511107059813012757897815701149281837291 | "我是头号玩家" | 1741868642733624 | "15"
87749735942141927258676195533202707267511107059813012757897815701149281837291 | "我是头号玩家" | 1741868642733379 | "14"
87749735942141927258676195533202707267511107059813012757897815701149281837291 | "我是头号玩家" | 1741868642733152 | "13"
87749735942141927258676195533202707267511107059813012757897815701149281837291 | "我是头号玩家" | 1741868642732828 | "12"
87749735942141927258676195533202707267511107059813012757897815701149281837291 | "我是头号玩家" | 1741868642732522 | "11"
the code is show bellow