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
27 changes: 14 additions & 13 deletions v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ Implementation of Driver V2 make use of runtime JSON/VPACK serialization, reduci

## Features

| Implemented | Test Coverage | Description |
|-------------|---------------|-------------------------------------------------------------------------|
| ✓ | ✓ | HTTP JSON & VPACK Connection |
| - | - | HTTP2 JSON & VPACK Connection |
| - | - | VST Connection |
| + | - | Database API Implementation |
| + | - | Collection API Implementation |
| ✓ | ✓ | Collection Document Creation |
| + | - | Collection Document Update |
| ✓ | ✓ | Collection Document Read |
| ✓ | ✓ | Query Execution |
| + | - | Transaction Execution |
| - | - | ArangoDB Operations (Views, Users, Graphs) |
| Implemented | Test Coverage | Description |
|-------------|---------------|--------------------------------------------|
| ✓ | ✓ | HTTP JSON & VPACK Connection |
| - | - | HTTP2 JSON & VPACK Connection |
| - | - | VST Connection |
| + | - | Database API Implementation |
| + | - | Collection API Implementation |
| ✓ | ✓ | Collection Document Creation |
| + | - | Collection Document Update |
| ✓ | ✓ | Collection Document Read |
| ✓ | ✓ | Collection Index |
| ✓ | ✓ | Query Execution |
| + | - | Transaction Execution |
| - | - | ArangoDB Operations (Views, Users, Graphs) |
40 changes: 40 additions & 0 deletions v2/arangodb/analyzers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// DISCLAIMER
//
// Copyright 2023 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.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
// Author Jakub Wierzbowski
//

package arangodb

// AnalyzerFeature specifies a feature to an analyzer
type AnalyzerFeature string

const (
// AnalyzerFeatureFrequency how often a term is seen, required for PHRASE()
AnalyzerFeatureFrequency AnalyzerFeature = "frequency"

// AnalyzerFeatureNorm the field normalization factor
AnalyzerFeatureNorm AnalyzerFeature = "norm"

// AnalyzerFeaturePosition sequentially increasing term position, required for PHRASE(). If present then the frequency feature is also required
AnalyzerFeaturePosition AnalyzerFeature = "position"

// AnalyzerFeatureOffset can be specified if 'position' feature is set
AnalyzerFeatureOffset AnalyzerFeature = "offset"
)
1 change: 1 addition & 0 deletions v2/arangodb/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ type Collection interface {
Remove(ctx context.Context) error

CollectionDocuments
CollectionIndexes
}
4 changes: 2 additions & 2 deletions v2/arangodb/collection_documents_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type CollectionDocumentCreate interface {
// A ConflictError is returned when a `_key` field contains a duplicate key, other any other field violates an index constraint.
CreateDocument(ctx context.Context, document interface{}) (CollectionDocumentCreateResponse, error)

// CreateDocument creates a single document in the collection.
// CreateDocumentWithOptions creates a single document in the collection.
// The document data is loaded from the given document, the document meta data is returned.
// If the document data already contains a `_key` field, this will be used as key of the new document,
// otherwise a unique key is created.
Expand All @@ -57,7 +57,7 @@ type CollectionDocumentCreate interface {
// If the create request itself fails or one of the arguments is invalid, an error is returned.
CreateDocuments(ctx context.Context, documents interface{}) (CollectionDocumentCreateResponseReader, error)

// CreateDocuments creates multiple documents in the collection.
// CreateDocumentsWithOptions creates multiple documents in the collection.
// The document data is loaded from the given documents slice, the documents meta data is returned.
// If a documents element already contains a `_key` field, this will be used as key of the new document,
// otherwise a unique key is created.
Expand Down
2 changes: 2 additions & 0 deletions v2/arangodb/collection_documents_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ func (c collectionDocuments) DocumentExists(ctx context.Context, key string) (bo
switch code := resp.Code(); code {
case http.StatusOK:
return true, nil
case http.StatusNotFound:
return false, nil
default:
return false, shared.NewResponseStruct().AsArangoErrorWithCode(code)
}
Expand Down
4 changes: 2 additions & 2 deletions v2/arangodb/collection_documents_read.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type CollectionDocumentRead interface {
// If no document exists with given key, a NotFoundError is returned.
ReadDocument(ctx context.Context, key string, result interface{}) (DocumentMeta, error)

// ReadDocument reads a single document with given key from the collection.
// ReadDocumentWithOptions reads a single document with given key from the collection.
// The document data is stored into result, the document meta data is returned.
// If no document exists with given key, a NotFoundError is returned.
ReadDocumentWithOptions(ctx context.Context, key string, result interface{}, opts *CollectionDocumentReadOptions) (DocumentMeta, error)
Expand All @@ -45,7 +45,7 @@ type CollectionDocumentRead interface {
// If no document exists with a given key, a NotFoundError is returned at its errors index.
ReadDocuments(ctx context.Context, keys []string) (CollectionDocumentReadResponseReader, error)

// ReadDocuments reads multiple documents with given keys from the collection.
// ReadDocumentsWithOptions reads multiple documents with given keys from the collection.
// The documents data is stored into elements of the given results slice,
// the documents meta data is returned.
// If no document exists with a given key, a NotFoundError is returned at its errors index.
Expand Down
4 changes: 2 additions & 2 deletions v2/arangodb/collection_documents_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type CollectionDocumentUpdate interface {
// If no document exists with given key, a NotFoundError is returned.
UpdateDocument(ctx context.Context, key string, document interface{}) (CollectionDocumentUpdateResponse, error)

// UpdateDocument updates a single document with given key in the collection.
// UpdateDocumentWithOptions updates a single document with given key in the collection.
// The document meta data is returned.
// If no document exists with given key, a NotFoundError is returned.
UpdateDocumentWithOptions(ctx context.Context, key string, document interface{}, options *CollectionDocumentUpdateOptions) (CollectionDocumentUpdateResponse, error)
Expand All @@ -47,7 +47,7 @@ type CollectionDocumentUpdate interface {
// If keys is nil, each element in the updates slice must contain a `_key` field.
UpdateDocuments(ctx context.Context, documents interface{}) (CollectionDocumentUpdateResponseReader, error)

// UpdateDocuments updates multiple document with given keys in the collection.
// UpdateDocumentsWithOptions updates multiple document with given keys in the collection.
// The updates are loaded from the given updates slice, the documents meta data are returned.
// If no document exists with a given key, a NotFoundError is returned at its errors index.
// If keys is nil, each element in the updates slice must contain a `_key` field.
Expand Down
2 changes: 2 additions & 0 deletions v2/arangodb/collection_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func newCollection(db *database, name string, modifiers ...connection.RequestMod
d := &collection{db: db, name: name, modifiers: append(db.modifiers, modifiers...)}

d.collectionDocuments = newCollectionDocuments(d)
d.collectionIndexes = newCollectionIndexes(d)

return d
}
Expand All @@ -51,6 +52,7 @@ type collection struct {
modifiers []connection.RequestModifier

*collectionDocuments
*collectionIndexes
}

func (c collection) Remove(ctx context.Context) error {
Expand Down
Loading