// ReadCString reads the the bson document tag. 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(Next(buf, index+1)[:index]) }
func (rqc *RequestContext) generateFinalSql(parsedQuery *sqlparser.ParsedQuery, bindVars map[string]interface{}, buildStreamComment []byte) string { bindVars["#maxLimit"] = rqc.qe.maxResultSize.Get() + 1 sql, err := parsedQuery.GenerateQuery(bindVars) if err != nil { panic(NewTabletError(FAIL, "%s", err)) } if buildStreamComment != nil { sql = append(sql, buildStreamComment...) } // undo hack done by stripTrailing sql = restoreTrailing(sql, bindVars) return hack.String(sql) }
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()) }