Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
ClickHouse launches Claude-powered Agents and House Mates partner program at Open House 2026 Read more →
네이티브 프로토콜 기본 사항
0 ≤ len < MAX
s := "Hello, world!" // 문자열 길이를 uvarint로 씁니다. buf := make([]byte, binary.MaxVarintLen64) n := binary.PutUvarint(buf, uint64(len(s))) buf = buf[:n] // 문자열 값을 씁니다. buf = append(buf, s...)
r := bytes.NewReader([]byte{ 0xd, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21, }) // 길이를 읽습니다. n, err := binary.ReadUvarint(r) if err != nil { panic(err) } // make()에서 OOM 또는 런타임 예외가 발생하지 않도록 n을 확인합니다. const maxSize = 1024 * 1024 * 10 // 10 MB if n > maxSize || n < 0 { panic("invalid n") } buf := make([]byte, n) if _, err := io.ReadFull(r, buf); err != nil { panic(err) } fmt.Println(string(buf)) // Hello, world!
00000000 0d 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 |.Hello, world!|
DUhlbGxvLCB3b3JsZCE
data := []byte{ 0xd, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21, }
v := int32(1000) // 인코딩. buf := make([]byte, 8) binary.LittleEndian.PutUint32(buf, uint32(v)) // 디코딩. d := int32(binary.LittleEndian.Uint32(buf)) fmt.Println(d) // 1000
00000000 e8 03 00 00 00 00 00 00 |........|
6AMAAAAAAAA
1
true
0
false
이 페이지가 도움이 되었나요?