1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-12-02 20:22:52 +00:00

reuse buffers

This commit is contained in:
Laura
2025-08-31 23:46:22 +02:00
parent 2d65c2f484
commit db138324fa
7 changed files with 50 additions and 34 deletions

8
exa.go
View File

@@ -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) {