반응형
ETC/Protocol Buffer
[Protocol Buffer] Child Directory에서 Parent Directory 프로토 파일 Import
[Protocol Buffer] Child Directory에서 Parent Directory 프로토 파일 Import
2019.08.02| |--parent.proto | |--sub |--child.proto 위와 같이 디렉터리 구조가 구성되어있고 child.proto에서 자신의 상위 폴더에 위치한 parent.proto를 import 하고 싶을 때가 있다. 문제 되는 경우 parent.proto syntax = "proto3"; package parent; message Attribute { --- } child.proto syntax = "proto3"; package child; import "../parent.proto"; message Child { parent.Attribute attribute = 1; } (현재 명령어를 입력하는 위치가 parent.proto가 있는 폴더라 가정 할 때) protoc -I=.\ .\pare..
[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필드에 문자열을 채워 메..