apache / incubator-horaedb-meta

Meta service of HoraeDB cluster.

Home Page:https://horaedb.apache.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Format http return results to increase readability

chunshao90 opened this issue · comments

Describe This Problem

When I use the http service to get metadata, the returned result is as follows, which is not very readable.

curl --location --request POST 'http://127.0.0.1:8080/api/v1/getShardTables' \
--header 'Content-Type: application/json' \
--data-raw '{
    "clusterName":"defaultCluster",
    "nodeName":"127.0.0.1:8832",
    "shardIDs": [0,1,2,3,4,5,6,7]
}'

{
    "status": "success",
    "data": "map[0:{Shard:{ID:0 Role:0 Version:0} Tables:[]} 1:{Shard:{ID:0 Role:0 Version:0} Tables:[]} 2:{Shard:{ID:0 Role:0 Version:0} Tables:[]} 3:{Shard:{ID:0 Role:0 Version:0} Tables:[]} 4:{Shard:{ID:4 Role:1 Version:2} Tables:[{ID:0 Name:demo SchemaID:0 SchemaName:public PartitionInfo:key:{partition_definitions:{name:\"0\"} partition_definitions:{name:\"1\"} partition_key:\"name\"}} {ID:1 Name:____demo_0 SchemaID:0 SchemaName:public PartitionInfo:key:{partition_definitions:{name:\"0\"} partition_definitions:{name:\"1\"} partition_key:\"name\"}}]} 5:{Shard:{ID:5 Role:1 Version:0} Tables:[]} 6:{Shard:{ID:6 Role:1 Version:0} Tables:[]} 7:{Shard:{ID:7 Role:1 Version:0} Tables:[]}]"
}

Proposal

Use json to format http return results to increase readability.

Additional Context

No response