๋ฐ์ํ
Protocol buffer
[Protocol Buffer] ํ๋กํ ์ฝ ๋ฒํผ ์ค์นํ๊ธฐ (Windows)
[Protocol Buffer] ํ๋กํ ์ฝ ๋ฒํผ ์ค์นํ๊ธฐ (Windows)
2019.06.23ํ๋กํ ์ฝ ๋ฒํผ ๋ค์ด๋ก๋ https://github.com/protocolbuffers/protobuf/releases protocolbuffers/protobuf Protocol Buffers - Google's data interchange format - protocolbuffers/protobuf github.com ์คํฌ๋กค์ ๋ด๋ฆฌ๋ค ๋ณด๋ฉด ๋ค์๊ณผ ๊ฐ์ ๋ค์ด๋ก๋ ๋งํฌ๋ค์ด ์ฃผ๋ฃจ๋ฃฉ ๋์จ๋ค. ๋ณธ์ธ์ ํ๊ฒฝ์ Windows 64bit์ด๋ฏ๋ก protoc-3.8.0-win64.zip ๋ฅผ ๋ฐ์๋ค. E:\protoc ๋ผ๋ ํด๋๋ฅผ ์๋ก ์์ฑํ์ฌ ์์ถ์ ํ์๋ค. ํ๊ฒฝ๋ณ์ ๋ฑ๋ก E:\protoc\protoc-3.8.0-win64\bin ๋ฅผ ํ๊ฒฝ๋ณ์์ ์ถ๊ฐ์์ผ์ค๋ค. (Windows7 ํ๋ฉด ๊ธฐ์ค) ํ
์คํธ cmd์ฐฝ์์ ์ ์์ ์ผ๋ก..
[ProtocolBuffer] ํ๋กํ ์ฝ ๋ฒํผ bytes ํ๋๋ฅผ json ๋ณํ ์ ์ฃผ์ ํ ์
[ProtocolBuffer] ํ๋กํ ์ฝ ๋ฒํผ bytes ํ๋๋ฅผ json ๋ณํ ์ ์ฃผ์ ํ ์
2019.06.20ํ๋กํ ์ฝ ๋ฒํผ์์ ์ฐ๋ฆฌ๊ฐ ์ ์ํ ๋ฉ์ธ์ง๋ฅผ jsonํ์
์ผ๋ก ๋ณํ ํ ๋ bytes ํ๋์ ๋ํด ์ฃผ์ ํ ์ ์ด ์๋ค. ์ผ๋ฐ์ ์ธ string ํ์
์ ์
๋ ฅํ ๋ฌธ์์ด์ ์ฐ๋ฆฌ๊ฐ ์๋ํ ๋๋ก json ๋ณํ์์๋ ์ ์ง๋ฅผ ํ๊ณ ์์ง๋ง, bytes ํ์
์ ์
๋ ฅํ ๋ฌธ์์ด์ json์ผ๋ก ๋ณํ ์ ๊ทธ๋๋ก ์ ์ง๋์ง ์๋๋ค. ๊ฐ๋จํ ํ
์คํธ๋ฅผ ์ํด Go์ธ์ด๋ฅผ ์ฌ์ฉํ์ฌ ํ
์คํธ๋ฅผ ์งํํ์๋ค. [user.proto] syntax = "proto3"; package message; message User { int64 userId = 1; string nickname = 2; bytes danmoji = 3; } ๋ฉ์ธ์ง์ ํฌ๋งท์ ์์ ๊ฐ๋ค. ์ด์ stringํ์
์ธ nicknameํ๋์, bytesํ์
์ธ danmojiํ๋์ ๋ฌธ์์ด์ ์ฑ์ ๋ฉ..