func ReadCString(buf *bytes.Buffer) string { index := bytes.IndexByte(buf.Bytes(), 0) if index < 0 { panic(NewBsonError("Unexpected EOF")) } // Read including null termination, but // return the string without the null. return hack.String(buf.Next(index + 1)[:index]) }
func (cw *ChunkedWriter) Write(p []byte) (n int, err error) { return cw.WriteString(hack.String(p)) }
// String returns the raw value as a string func (v Value) String() string { if v.Inner == nil { return "" } return hack.String(v.Inner.raw()) }