Skip to content

Commit 7f9cbc8

Browse files
CeRiAllukasmalkmus
authored andcommitted
Axiom/Datasets: Change CreateMapField to return a string instead of a ptr-to-string, adjust tests accordingly
1 parent 67170f7 commit 7f9cbc8

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

axiom/datasets.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ func (s *DatasetsService) ListMapFields(ctx context.Context, id string) (MapFiel
306306
}
307307

308308
// Create a new map-field with the given name on the dataset identified by the given id.
309-
func (s *DatasetsService) CreateMapField(ctx context.Context, id string, name string) (*string, error) {
309+
func (s *DatasetsService) CreateMapField(ctx context.Context, id string, name string) (string, error) {
310310
ctx, span := s.client.trace(ctx, "Datasets.CreateMapField", trace.WithAttributes(
311311
attribute.String("axiom.dataset_id", id),
312312
attribute.String("axiom.param.name", name),
@@ -319,15 +319,15 @@ func (s *DatasetsService) CreateMapField(ctx context.Context, id string, name st
319319

320320
path, err := url.JoinPath(s.basePath, id, "mapfields")
321321
if err != nil {
322-
return nil, spanError(span, err)
322+
return "", spanError(span, err)
323323
}
324324

325325
var res mapField
326326
if err := s.client.Call(ctx, http.MethodPost, path, req, &res); err != nil {
327-
return nil, spanError(span, err)
327+
return "", spanError(span, err)
328328
}
329329

330-
return &res.Name, nil
330+
return res.Name, nil
331331
}
332332

333333
// Update map-fields on the dataset identified by the given id.

axiom/datasets_integration_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ func (s *DatasetsTestSuite) TestMapFields() {
496496
res, err := s.client.Datasets.CreateMapField(s.ctx, s.dataset.ID, "foo")
497497
s.Require().NoError(err)
498498
s.Require().NotNil(res)
499-
s.Equal("foo", *res)
499+
s.Equal("foo", res)
500500

501501
// ...and verify it's listed on the dataset.
502502
dataset, err := s.client.Datasets.Get(s.ctx, s.dataset.ID)
@@ -646,7 +646,7 @@ func (s *DatasetsTestSuite) TestIngestWithMapFields() {
646646
res, err := s.client.Datasets.CreateMapField(s.ctx, s.dataset.ID, "foo")
647647
s.Require().NoError(err)
648648
s.Require().NotNil(res)
649-
s.Equal("foo", *res)
649+
s.Equal("foo", res)
650650

651651
// Ingest some data containing an object.
652652
ingestObjectDataFn(s, ingestDataMapFields1)

axiom/datasets_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ func TestDatasetsService_CreateMapField(t *testing.T) {
560560
res, err := client.Datasets.CreateMapField(context.Background(), "test", "field1")
561561
require.NoError(t, err)
562562

563-
assert.Equal(t, "field1", *res)
563+
assert.Equal(t, "field1", res)
564564
}
565565

566566
func TestDatasetsService_UpdateMapFields(t *testing.T) {

0 commit comments

Comments
 (0)