Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Change Log

## [master](https://github.com/arangodb/go-driver/tree/master) (N/A)
- Expose `NewType` method

## [1.6.4(https://github.com/arangodb/go-driver/tree/v1.6.4) (2024-09-27)
- Switch to Go 1.22.5
Expand Down
59 changes: 30 additions & 29 deletions test/arangosearch_analyzers_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2018-2023 ArangoDB GmbH, Cologne, Germany
// Copyright 2018-2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -28,6 +28,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/arangodb/go-driver"
"github.com/arangodb/go-driver/util"
)

func newInt(v int) *int {
Expand Down Expand Up @@ -139,7 +140,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
Properties: driver.ArangoSearchAnalyzerProperties{
Min: newInt64(1),
Max: newInt64(14),
PreserveOriginal: newBool(false),
PreserveOriginal: util.NewType(false),
},
},
},
Expand All @@ -152,7 +153,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
Properties: driver.ArangoSearchAnalyzerProperties{
Min: newInt64(1),
Max: newInt64(14),
PreserveOriginal: newBool(false),
PreserveOriginal: util.NewType(false),
},
},
ExpectedDefinition: &driver.ArangoSearchAnalyzerDefinition{
Expand All @@ -161,7 +162,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
Properties: driver.ArangoSearchAnalyzerProperties{
Min: newInt64(1),
Max: newInt64(14),
PreserveOriginal: newBool(false),
PreserveOriginal: util.NewType(false),

// Check defaults for 3.6
StartMarker: newString(""),
Expand All @@ -179,7 +180,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
Properties: driver.ArangoSearchAnalyzerProperties{
Min: newInt64(1),
Max: newInt64(14),
PreserveOriginal: newBool(false),
PreserveOriginal: util.NewType(false),
StartMarker: newString("^"),
EndMarker: newString("^"),
StreamType: newArangoSearchNGramStreamType(driver.ArangoSearchNGramStreamUTF8),
Expand All @@ -199,7 +200,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
Properties: driver.ArangoSearchAnalyzerProperties{
Min: newInt64(1),
Max: newInt64(14),
PreserveOriginal: newBool(false),
PreserveOriginal: util.NewType(false),
StartMarker: newString("^"),
EndMarker: newString("^"),
StreamType: newArangoSearchNGramStreamType(driver.ArangoSearchNGramStreamUTF8),
Expand All @@ -217,11 +218,11 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
Type: driver.ArangoSearchAnalyzerTypeAQL,
Properties: driver.ArangoSearchAnalyzerProperties{
QueryString: `FOR year IN [ 2011, 2012, 2013 ] FOR quarter IN [ 1, 2, 3, 4 ] RETURN { year, quarter, formatted: CONCAT(quarter, " / ", year)}`,
CollapsePositions: newBool(true),
KeepNull: newBool(false),
BatchSize: newInt(10),
CollapsePositions: util.NewType(true),
KeepNull: util.NewType(false),
BatchSize: util.NewType(10),
ReturnType: driver.ArangoSearchAnalyzerAQLReturnTypeString.New(),
MemoryLimit: newInt(1024 * 1024),
MemoryLimit: util.NewType(1024 * 1024),
},
},
},
Expand All @@ -233,9 +234,9 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
Type: driver.ArangoSearchAnalyzerTypeGeoPoint,
Properties: driver.ArangoSearchAnalyzerProperties{
Options: &driver.ArangoSearchAnalyzerGeoOptions{
MaxCells: newInt(20),
MinLevel: newInt(4),
MaxLevel: newInt(23),
MaxCells: util.NewType(20),
MinLevel: util.NewType(4),
MaxLevel: util.NewType(23),
},
Latitude: []string{},
Longitude: []string{},
Expand All @@ -250,9 +251,9 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
Type: driver.ArangoSearchAnalyzerTypeGeoJSON,
Properties: driver.ArangoSearchAnalyzerProperties{
Options: &driver.ArangoSearchAnalyzerGeoOptions{
MaxCells: newInt(20),
MinLevel: newInt(4),
MaxLevel: newInt(23),
MaxCells: util.NewType(20),
MinLevel: util.NewType(4),
MaxLevel: util.NewType(23),
},
Type: driver.ArangoSearchAnalyzerGeoJSONTypeShape.New(),
},
Expand All @@ -267,9 +268,9 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
Properties: driver.ArangoSearchAnalyzerProperties{
Format: driver.FormatLatLngInt.New(),
Options: &driver.ArangoSearchAnalyzerGeoOptions{
MaxCells: newInt(20),
MinLevel: newInt(4),
MaxLevel: newInt(23),
MaxCells: util.NewType(20),
MinLevel: util.NewType(4),
MaxLevel: util.NewType(23),
},
Type: driver.ArangoSearchAnalyzerGeoJSONTypeShape.New(),
},
Expand All @@ -280,9 +281,9 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
Properties: driver.ArangoSearchAnalyzerProperties{
Format: driver.FormatLatLngInt.New(),
Options: &driver.ArangoSearchAnalyzerGeoOptions{
MaxCells: newInt(20),
MinLevel: newInt(4),
MaxLevel: newInt(23),
MaxCells: util.NewType(20),
MinLevel: util.NewType(4),
MaxLevel: util.NewType(23),
},
Type: driver.ArangoSearchAnalyzerGeoJSONTypeShape.New(),
},
Expand Down Expand Up @@ -326,7 +327,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
Name: "my-stopWords",
Type: driver.ArangoSearchAnalyzerTypeStopwords,
Properties: driver.ArangoSearchAnalyzerProperties{
Hex: newBool(true),
Hex: util.NewType(true),
Stopwords: []string{
"616e64",
"746865",
Expand All @@ -337,7 +338,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
Name: "my-stopWords",
Type: driver.ArangoSearchAnalyzerTypeStopwords,
Properties: driver.ArangoSearchAnalyzerProperties{
Hex: newBool(true),
Hex: util.NewType(true),
Stopwords: []string{
"616e64",
"746865",
Expand All @@ -356,7 +357,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
Analyzer: &driver.ArangoSearchAnalyzerDefinition{
Type: driver.ArangoSearchAnalyzerTypeStopwords,
Properties: driver.ArangoSearchAnalyzerProperties{
Hex: newBool(true),
Hex: util.NewType(true),
Stopwords: []string{
"616e64",
"746865",
Expand All @@ -373,7 +374,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
Analyzer: &driver.ArangoSearchAnalyzerDefinition{
Type: driver.ArangoSearchAnalyzerTypeStopwords,
Properties: driver.ArangoSearchAnalyzerProperties{
Hex: newBool(true),
Hex: util.NewType(true),
Stopwords: []string{
"616e64",
"746865",
Expand Down Expand Up @@ -450,7 +451,7 @@ func TestArangoSearchAnalyzerGet(t *testing.T) {
Properties: driver.ArangoSearchAnalyzerProperties{
Min: newInt64(1),
Max: newInt64(14),
PreserveOriginal: newBool(false),
PreserveOriginal: util.NewType(false),
},
}
ensureAnalyzer(ctx, db, def, t)
Expand Down Expand Up @@ -484,7 +485,7 @@ func TestArangoSearchAnalyzerGetAll(t *testing.T) {
Properties: driver.ArangoSearchAnalyzerProperties{
Min: newInt64(1),
Max: newInt64(14),
PreserveOriginal: newBool(false),
PreserveOriginal: util.NewType(false),
},
}
ensureAnalyzer(ctx, db, def, t)
Expand Down Expand Up @@ -524,7 +525,7 @@ func TestArangoSearchAnalyzerRemove(t *testing.T) {
Properties: driver.ArangoSearchAnalyzerProperties{
Min: newInt64(1),
Max: newInt64(14),
PreserveOriginal: newBool(false),
PreserveOriginal: util.NewType(false),
},
}
a := ensureAnalyzer(ctx, db, def, t)
Expand Down
11 changes: 6 additions & 5 deletions test/collection_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2017-2023 ArangoDB GmbH, Cologne, Germany
// Copyright 2017-2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -31,6 +31,7 @@ import (
"github.com/stretchr/testify/require"

driver "github.com/arangodb/go-driver"
"github.com/arangodb/go-driver/util"
)

// ensureCollection is a helper to check if a collection exists and create if if needed.
Expand Down Expand Up @@ -114,7 +115,7 @@ func TestCollection_CacheEnabled(t *testing.T) {
t.Run("False", func(t *testing.T) {
name := "test_create_collection_cache_false"
_, err := db.CreateCollection(nil, name, &driver.CreateCollectionOptions{
CacheEnabled: newBool(false),
CacheEnabled: util.NewType(false),
})
require.NoError(t, err)

Expand All @@ -131,7 +132,7 @@ func TestCollection_CacheEnabled(t *testing.T) {
t.Run("True", func(t *testing.T) {
name := "test_create_collection_cache_true"
_, err := db.CreateCollection(nil, name, &driver.CreateCollectionOptions{
CacheEnabled: newBool(true),
CacheEnabled: util.NewType(true),
})
require.NoError(t, err)

Expand All @@ -148,7 +149,7 @@ func TestCollection_CacheEnabled(t *testing.T) {
t.Run("With update", func(t *testing.T) {
name := "test_create_collection_cache_update"
_, err := db.CreateCollection(nil, name, &driver.CreateCollectionOptions{
CacheEnabled: newBool(false),
CacheEnabled: util.NewType(false),
})
require.NoError(t, err)

Expand All @@ -162,7 +163,7 @@ func TestCollection_CacheEnabled(t *testing.T) {
require.False(t, prop.CacheEnabled)

err = col.SetProperties(nil, driver.SetCollectionPropertiesOptions{
CacheEnabled: newBool(true),
CacheEnabled: util.NewType(true),
})
require.NoError(t, err)

Expand Down
13 changes: 7 additions & 6 deletions test/index_ensure_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2017-2023 ArangoDB GmbH, Cologne, Germany
// Copyright 2017-2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,6 +29,7 @@ import (
"github.com/stretchr/testify/require"

driver "github.com/arangodb/go-driver"
"github.com/arangodb/go-driver/util"
)

// TestEnsureFullTextIndex creates a collection with a full text index.
Expand Down Expand Up @@ -537,8 +538,8 @@ func TestEnsureInvertedIndex(t *testing.T) {
Name: "inverted-opt",
PrimarySort: driver.InvertedIndexPrimarySort{
Fields: []driver.ArangoSearchPrimarySortEntry{
{Field: "test1", Ascending: newBool(true)},
{Field: "test2", Ascending: newBool(false)},
{Field: "test1", Ascending: util.NewType(true)},
{Field: "test2", Ascending: util.NewType(false)},
},
Compression: driver.PrimarySortCompressionLz4,
},
Expand All @@ -554,8 +555,8 @@ func TestEnsureInvertedIndex(t *testing.T) {
Name: "inverted-opt-nested",
PrimarySort: driver.InvertedIndexPrimarySort{
Fields: []driver.ArangoSearchPrimarySortEntry{
{Field: "test1", Ascending: newBool(true)},
{Field: "test2", Ascending: newBool(false)},
{Field: "test1", Ascending: util.NewType(true)},
{Field: "test2", Ascending: util.NewType(false)},
},
Compression: driver.PrimarySortCompressionLz4,
},
Expand Down Expand Up @@ -588,7 +589,7 @@ func TestEnsureInvertedIndex(t *testing.T) {
Name: "inverted-opt-optimize-top-k",
PrimarySort: driver.InvertedIndexPrimarySort{
Fields: []driver.ArangoSearchPrimarySortEntry{
{Field: "field1", Ascending: newBool(true)},
{Field: "field1", Ascending: util.NewType(true)},
},
Compression: driver.PrimarySortCompressionLz4,
},
Expand Down
7 changes: 4 additions & 3 deletions test/view_alias_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2020-2023 ArangoDB GmbH, Cologne, Germany
// Copyright 2020-2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -27,6 +27,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/arangodb/go-driver"
"github.com/arangodb/go-driver/util"
)

// ensureArangoSearchView is a helper to check if an arangosearch view exists and create it if needed.
Expand Down Expand Up @@ -76,8 +77,8 @@ func TestSearchViewsAlias(t *testing.T) {
Name: nameInvInd,
PrimarySort: driver.InvertedIndexPrimarySort{
Fields: []driver.ArangoSearchPrimarySortEntry{
{Field: "test1", Ascending: newBool(true)},
{Field: "test2", Ascending: newBool(false)},
{Field: "test1", Ascending: util.NewType(true)},
{Field: "test2", Ascending: util.NewType(false)},
},
Compression: driver.PrimarySortCompressionLz4,
},
Expand Down
Loading