datatypes
datatypes copied to clipboard
When json is stored in the database, it will change its location
GORM Playground Link
Print before deposit: {"type":"object","labelWidth":120,"displayType":"row","properties":{"b":{"title":"b","type":"array","widget":"multiSelect","description":"","required":true,"disabled":false,"readOnly":false,"items":{"type":"string"},"enum":[""'dev-01'"",""'dev-02'"",""'dev-03'""],"enumNames":["dev-01","dev-02","dev-03"],"props":{"showSearch":true,"filterOption":true,"optionFilterProp":"label"}},"a":{"title":"a","type":"string","widget":"select","description":"","required":false,"disabled":false,"readOnly":false,"api":"staff","enum":["a","b","c"],"enumNames":["早","中","晚"],"props":{"showSearch":true,"filterOption":true,"optionFilterProp":"label"}},"c":{"title":"ceshi","type":"string","widget":"select","required":false,"disabled":false,"readOnly":false,"api":"hostname","props":{"showSearch":true,"filterOption":true,"optionFilterProp":"label"}}}} After inserting into the database: {"type": "object", "labelWidth": 120, "properties": {"a": {"api": "staff", "enum": ["a", "b", "c"], "type": "string", "props": {"showSearch": true, "filterOption": true, "optionFilterProp": "label"}, "title": "a", "widget": "select", "disabled": false, "readOnly": false, "required": false, "enumNames": ["早", "中", "晚"], "description": ""}, "b": {"enum": [""'dev-01'"", ""'dev-02'"", ""'dev-03'""], "type": "array", "items": {"type": "string"}, "props": {"showSearch": true, "filterOption": true, "optionFilterProp": "label"}, "title": "b", "widget": "multiSelect", "disabled": false, "readOnly": false, "required": true, "enumNames": ["dev-01", "dev-02", "dev-03"], "description": ""}, "c": {"api": "hostname", "type": "string", "props": {"showSearch": true, "filterOption": true, "optionFilterProp": "label"}, "title": "ceshi", "widget": "select", "disabled": false, "readOnly": false, "required": false}}, "displayType": "row"} It looks like gorm made changes to the data structure before storing it in the database
https://github.com/go-gorm/playground/pull/1
Description
That is, I hope that the fields in json are disordered, but after saving, they become ordered (according to a, b, c... or 1, 2, 3, 4...).
Please note that if you use go maps they have no predicatable order.