Use fsx package and friends from pkglib
This commit is contained in:
parent
1f8c55da7c
commit
0f6803f890
35 changed files with 91 additions and 493 deletions
|
|
@ -11,7 +11,6 @@ import (
|
|||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/tkw1536/pkglib/pools"
|
||||
"github.com/tkw1536/pkglib/timex"
|
||||
)
|
||||
|
||||
|
|
@ -39,12 +38,10 @@ func (ts Triplestore) OpenRaw(ctx context.Context, method, url string, body any,
|
|||
// for "PUT" and "POST" we setup a body
|
||||
if method == http.MethodPut || method == http.MethodPost {
|
||||
if bodyName != "" {
|
||||
// create a new buffer for the body
|
||||
buffer := pools.GetBuffer()
|
||||
defer pools.ReleaseBuffer(buffer)
|
||||
var buffer bytes.Buffer
|
||||
|
||||
// write the file to it
|
||||
writer := multipart.NewWriter(buffer)
|
||||
writer := multipart.NewWriter(&buffer)
|
||||
{
|
||||
part, err := writer.CreateFormFile(bodyName, "filename.txt")
|
||||
if err != nil {
|
||||
|
|
@ -55,7 +52,7 @@ func (ts Triplestore) OpenRaw(ctx context.Context, method, url string, body any,
|
|||
writer.Close()
|
||||
|
||||
// use it for the request
|
||||
reader = buffer
|
||||
reader = &buffer
|
||||
contentType = writer.FormDataContentType()
|
||||
} else {
|
||||
mbytes, err := json.Marshal(body)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import (
|
|||
"github.com/FAU-CDI/wisski-distillery/pkg/unpack"
|
||||
"github.com/tkw1536/goprogram/exit"
|
||||
"github.com/tkw1536/pkglib/errorx"
|
||||
"github.com/tkw1536/pkglib/pools"
|
||||
)
|
||||
|
||||
var errTripleStoreFailedRepository = exit.Error{
|
||||
|
|
@ -39,9 +38,9 @@ func (ts *Triplestore) CreateRepository(ctx context.Context, name, domain, user,
|
|||
}
|
||||
|
||||
// prepare the create repo request
|
||||
createRepo := pools.GetBuffer()
|
||||
defer pools.ReleaseBuffer(createRepo)
|
||||
err := unpack.WriteTemplate(createRepo, map[string]string{
|
||||
var createRepo bytes.Buffer
|
||||
|
||||
err := unpack.WriteTemplate(&createRepo, map[string]string{
|
||||
"GRAPHDB_REPO": name,
|
||||
"INSTANCE_DOMAIN": domain,
|
||||
}, bytes.NewReader(createRepoTTL))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue