A Multi-Language configuration component.
```mysql CREATE TABLE tmulingo ( id VARCHAR(32) PRIMARY KEY, owner VARCHAR(60) NOT NULL, namespace VARCHAR(60) NOT NULL, msgkey VARCHAR(200) NOT NULL, langkey VARCHAR(20) NOT NULL, version VARCHAR(20) NOT NULL, msgcontent VARCHAR(2048) NOT NULL, memo VARCHAR(200) NULL, createat TIMESTAMP NOT NULL, update_at TIMESTAMP NOT NULL ) comment 'multi language message configuration'
```
mysql_async
to provide Conn
to run the store functionstracing
& tracing_subscriber
to enable tracing and loggingThe domain Application is the function entrance which need be initialized at first.
```rust
use crcntmulingo::includes::Application;
fn createapplication() {
let pool: Pool = Pool::new("mysql://
```
The Application's create_mulingo
need seven arguments:
- owner: the owner of the item
- ns: namespace of the item
- langkey: the language key, e.g.: en
, zh_CN
, ...
- msgkey: the item key
- msg: the item content
- memo: the item memo, optional
```rust use crcnt_mulingo::includes::*;
async fn createmulingo() {
let ns: MulingoNameSpace = "com.payby.promotion".into();
let owner: MulingoOwner = "SYSPROMOTION".into();
let langkey: MulingoLangKey = "en".into();
let version: MulingoVersion = "0.1.2".into();
let msgkey: MulingoMsgKey = "EC_600001".into();
let msg: MulingoMsgContent = "The promotion code is overflow".into();
let memo: Option
let entity = app.createmulingo(owner, ns, langkey, msg_key, version, msg, memo) .await; } ```
The Application's fetch_latest_mulingo
can get the mulingo item of the latest version.
```rust use crcnt_mulingo::includes::*;
async fn createmulingo() { let ns: MulingoNameSpace = "com.payby.promotion".into(); let owner: MulingoOwner = "SYSPROMOTION".into(); let langkey: MulingoLangKey = "en".into(); let msgkey: MulingoMsgKey = "EC_600001".into();
let mulingo = app.fetchlatestmulingo(&owner, &ns, &msgkey, &langkey).await; } ```