17
loading...
This website collects cookies to deliver better user experience
client <-> backend service
or service <-> service
. In the article, we are going to review the most popular options and we will try to help to choose the correct way for the next project.is_new
will be a flag.[
{
"id": 1,
"username": "test1",
"is_new": true
},
{
"id": 2,
"username": "test2",
"is_new": false
}
]
struct/class -> JSON -> protobuf -> MsgPack -> DB row -> struct/class
strings
in an array.user
:user_flag
user_flag
row is linked to a row in user
table by user_id
field.[
{
"id": 1,
"username": "test1",
"flags": [
"is_new",
"is_test"
]
},
{
"id": 2,
"username": "test2",
"flags": []
}
]
struct/class -> JSON -> protobuf -> MsgPack -> DB row -> struct/class
set
and unset
and find
functionsTINYINT
, SMALLINT
, MEDIUMINT
, INT
, BIGINT
, BLOB
types.flags
field has the type INT
and the first bit is is_new
flag.[
{
"id": 1,
"username": "test1",
"flags": 1
},
{
"id": 2,
"username": "test2",
"flags": 0
}
]