Protobuf ↔ Go
Protobuf와 Go 구조체 상호 변환
입력0
출력
0
Protobuf ↔ Go 변환기 소개
Protocol Buffer (proto3) 정의와 Go 구조체 간의 양방향 변환 도구입니다. Proto → Go는 .proto 파일을 파싱하여 Go 구조체를 생성하고, Go → Proto는 Go 구조체를 proto3 메시지 정의로 변환합니다.
자주 묻는 질문
어떤 proto 구문이 지원되나요?▼
Proto3 구문(message, enum, 중첩 타입, repeated 필드, oneof 포함)이 지원됩니다.
타입은 어떻게 매핑되나요?▼
Proto → Go: string→string, int32→int32, int64→int64, bool→bool, bytes→[]byte, float→float32, double→float64, repeated→슬라이스. Go → Proto: 역매핑, 포인터→optional, 슬라이스→repeated, map→map<K,V>.
import와 다중 구조체를 처리할 수 있나요?▼
Proto → Go는 외부 import를 인식하지만 해석하지 않습니다. Go → Proto는 여러 구조체 정의를 지원하고 참조 관계를 자동 감지합니다.