2022-04-06 18:34:22 +02:00
|
|
|
import json
|
|
|
|
import os
|
|
|
|
|
2022-04-08 13:51:37 +02:00
|
|
|
struct DbConfig {}
|
2022-04-06 18:34:22 +02:00
|
|
|
|
|
|
|
fn test_json_decode_with_optional_arg() {
|
|
|
|
if ret := print_info() {
|
|
|
|
println(ret)
|
|
|
|
} else {
|
|
|
|
println(err)
|
|
|
|
}
|
|
|
|
assert true
|
|
|
|
}
|
|
|
|
|
|
|
|
fn print_info() ?string {
|
|
|
|
dbconf := json.decode(DbConfig, os.read_file('dbconf.json') ?) ?
|
|
|
|
println(dbconf)
|
|
|
|
return '$dbconf'
|
|
|
|
}
|