mirror of
https://github.com/coalaura/whiskr.git
synced 2025-12-02 20:22:52 +00:00
reuse buffers
This commit is contained in:
8
exa.go
8
exa.go
@@ -6,7 +6,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -32,13 +31,14 @@ type ExaResults struct {
|
||||
}
|
||||
|
||||
func (e *ExaResults) String() string {
|
||||
var builder strings.Builder
|
||||
buf := GetFreeBuffer()
|
||||
defer pool.Put(buf)
|
||||
|
||||
json.NewEncoder(&builder).Encode(map[string]any{
|
||||
json.NewEncoder(buf).Encode(map[string]any{
|
||||
"results": e.Results,
|
||||
})
|
||||
|
||||
return builder.String()
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
func NewExaRequest(ctx context.Context, path string, data any) (*http.Request, error) {
|
||||
|
||||
Reference in New Issue
Block a user