func (p *TProtocol) WriteI64(i int64) error
// Create a new TTransport and TProtocol transport, err := thrift.NewTMemoryBuffer() if err != nil { // handle error } protocol := thrift.NewTBinaryProtocol(transport) // Write a 64-bit integer to the protocol err = protocol.WriteI64(12345) if err != nil { // handle error } // Write another 64-bit integer to the protocol err = protocol.WriteI64(67890) if err != nil { // handle error }
// Create a new TTransport and TProtocol transport, err := thrift.NewTMemoryBuffer() if err != nil { // handle error } protocol := thrift.NewTBinaryProtocol(transport) // Create a struct that contains a 64-bit integer myStruct := &MyStruct{MyInt64: 12345} // Write the struct to the protocol err = myStruct.Write(protocol) if err != nil { // handle error }In this example, we have a struct (defined elsewhere in the code) that contains a 64-bit integer. We use the Write method (generated by the Thrift compiler for this struct) to write it to the protocol. This method internally uses the WriteI64 method to write the integer. Overall, the "github.com/apache/thrift/lib/go/thrift" package is a powerful tool for serializing and deserializing data in Go. It supports a wide range of data types and is highly customizable.