ravendb

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2024 License: MIT Imports: 34 Imported by: 0

README

compile

This is information on how to use the library. For docs on working on the library itself see readme-dev.md.

This library requires go 1.11 or later.

API reference: https://godoc.org/github.com/ravendb/ravendb-go-client

This library is in beta state. All the basic functionality works and passes extensive test suite, but the API for more esoteric features might change.

If you encounter bugs, have suggestions or feature requests, please open an issue.

Documentation

To learn basics of RavenDB, read RavenDB Documentation or Dive into RavenDB.

Getting started

Full source code of those examples is in examples directory.

To run a a specific example, e.g. crudStore, you can run:

  • .\scripts\run_example.ps1 crudStore : works on mac / linux if you have powershell installed
  • go run examples\log.go examples\main.go crudStore : on mac / linux change paths to examples/log.go etc.
  1. Import the package
import (
	ravendb "github.com/ravendb/ravendb-go-client"
)
  1. Initialize document store (you should have one DocumentStore instance per application)
func getDocumentStore(databaseName string) (*ravendb.DocumentStore, error) {
	serverNodes := []string{"http://live-test.ravendb.net"}
	store := ravendb.NewDocumentStore(serverNodes, databaseName)
	if err := store.Initialize(); err != nil {
		return nil, err
	}
	return store, nil
}

To setup an document store with security, you'll need to provide the client certificate for authentication. Here is how to setup a document store with a certificate:

func getDocumentStore(databaseName string) (*ravendb.DocumentStore, error) {
	cerPath := "/path/to/certificate.crt"
	keyPath := "/path/to/certificate.key"
	serverNodes := []string{"https://a.tasty.ravendb.run", 
		"https://b.tasty.ravendb.run", "https://c.tasty.ravendb.run"}

	cer, err := tls.LoadX509KeyPair(cerPath, keyPath)
	if err != nil {
		return nil, err
	}
	store := ravendb.NewDocumentStore(serverNodes, databaseName)
	store.Certificate = &cer
	x509cert, err :=  x509.ParseCertificate(cer.Certificate[0])
	if err != nil {
		return nil, err
	}
	store.TrustStore = x509cert
	if err := store.Initialize(); err != nil {
		return nil, err
	}
	return store, nil
}

If you are using an encrypted certificate, see the sample code on how to translate that to tls.Certificate here: https://play.golang.org/p/8OYTuZtZIQ

  1. Open a session and close it when done
session, err = store.OpenSession()
if err != nil {
	log.Fatalf("store.OpenSession() failed with %s", err)
}
// ... use session
session.Close()
  1. Call SaveChanges() to persist changes in a session:
var e *northwind.Employee
err = session.Load(&e, "employees/7-A")
if err != nil {
    log.Fatalf("session.Load() failed with %s\n", err)
}

origName := e.FirstName
e.FirstName = e.FirstName + "Changed"
err = session.Store(e)
if err != nil {
    log.Fatalf("session.Store() failed with %s\n", err)
}

err = session.SaveChanges()
if err != nil {
    log.Fatalf("session.SaveChanges() failed with %s\n", err)
}

var e2 *northwind.Employee
err = session.Load(&e2, "employees/7-A")
if err != nil {
    log.Fatalf("session.Load() failed with %s\n", err)
}
fmt.Printf("Updated Employee.FirstName from '%s' to '%s'\n", origName, e2.FirstName)

See loadUpdateSave() in examples/main.go for full example.

CRUD example

Storing documents

product := &northwind.Product{
    Name:         "iPhone X",
    PricePerUnit: 999.99,
    Category:     "electronis",
    ReorderLevel: 15,
}
err = session.Store(product)
if err != nil {
    log.Fatalf("session.Store() failed with %s\n", err)
}

See crudStore() in examples/main.go for full example.

Loading documents

var e *northwind.Employee
err = session.Load(&e, "employees/7-A")
if err != nil {
    log.Fatalf("session.Load() failed with %s\n", err)
}
fmt.Printf("employee: %#v\n", e)

See crudLoad() in examples/main.go for full example.

Loading documents with includes

Some entities point to other entities via id. For example Employee has ReportsTo field which is an id of Employee that it reports to.

To improve performance by minimizing number of server requests, we can use includes functionality to load such linked entities.

// load employee with id "employees/7-A" and entity whose id is ReportsTo
var e *northwind.Employee
err = session.Include("ReportsTo").Load(&e, "employees/5-A")
if err != nil {
    log.Fatalf("session.Load() failed with %s\n", err)
}
if e.ReportsTo == "" {
    fmt.Printf("Employee with id employees/5-A doesn't report to anyone\n")
    return
}

numRequests := session.GetNumberOfRequests()
var reportsTo *northwind.Employee
err = session.Load(&reportsTo, e.ReportsTo)
if err != nil {
    log.Fatalf("session.Load() failed with %s\n", err)
}
if numRequests != session.GetNumberOfRequests() {
    fmt.Printf("Something's wrong, this shouldn't send a request to the server\n")
} else {
    fmt.Printf("Loading e.ReportsTo employee didn't require a new request to the server because we've loaded it in original requests thanks to using Include functionality\n")
}

See crudLoadWithInclude() in examples/main.go for full example.

Updating documents

// load entity from the server
var p *northwind.Product
err = session.Load(&p, productID)
if err != nil {
    log.Fatalf("session.Load() failed with %s\n", err)
}

// update price
origPrice = p.PricePerUnit
newPrice = origPrice + 10
p.PricePerUnit = newPrice
err = session.Store(p)
if err != nil {
    log.Fatalf("session.Store() failed with %s\n", err)
}

// persist changes on the server
err = session.SaveChanges()
if err != nil {
    log.Fatalf("session.SaveChanges() failed with %s\n", err)
}

See crudUpdate() in examples/main.go for full example.

Deleting documents

Delete using entity:

// ... store a product and remember its id in productID

var p *northwind.Product
err = session.Load(&p, productID)
if err != nil {
    log.Fatalf("session.Load() failed with %s\n", err)
}

err = session.Delete(p)
if err != nil {
    log.Fatalf("session.Delete() failed with %s\n", err)
}

err = session.SaveChanges()
if err != nil {
    log.Fatalf("session.SaveChanges() failed with %s\n", err)
}

See crudDeleteUsingEntity() in examples/main.go for full example.

Entity must be a value that we either stored in the database in the current session via Store() or loaded from database using Load(), LoadMulti(), query etc.

Delete using id:

// ... store a product and remember its id in productID

err = session.DeleteByID(productID, "")
if err != nil {
    log.Fatalf("session.Delete() failed with %s\n", err)
}

err = session.SaveChanges()
if err != nil {
    log.Fatalf("session.SaveChanges() failed with %s\n", err)
}

Second argument to DeleteByID is optional changeVector, for fine-grain concurrency control.

See crudDeleteUsingID() in examples/main.go for full example.

Querying documents

Selecting what to query

First you need to decide what to query.

RavenDB stores documents in collections. By default each type (struct) is stored in its own collection e.g. all Employee structs are stored in employees collection.

You can query by collection name:

q := session.QueryCollection("employees")

See queryCollectionByName() in examples/main.go for full example.

To get a collection name for a given type use ravendb.GetCollectionNameDefault(&MyStruct{}).

You can query a collection for a given type:

tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)

See queryCollectionByType() in examples/main.go for full example.

You can query an index:

q := session.QueryIndex("Orders/ByCompany")

See queryIndex() in examples/main.go for full example.

Limit what is returned

tp := reflect.TypeOf(&northwind.Product{})
q := session.QueryCollectionForType(tp)

q = q.WaitForNonStaleResults(0)
q = q.WhereEquals("Name", "iPhone X")
q = q.OrderBy("PricePerUnit")
q = q.Take(2) // limit to 2 results

See queryComplex() in examples/main.go for full example.

Obtain the results

You can get all matching results:

var products []*northwind.Product
err = q.GetResults(&products)

See queryComplex() in examples/main.go for full example.

You can get just first one:

var first *northwind.Employee
err = q.First(&first)

See queryFirst() in examples/main.go for full example.

Overview of DocumentQuery methods

SelectFields() - projections using a single field

// RQL equivalent: from employees select FirstName
q = q.SelectFields(reflect.TypeOf(""), "FirstName")

var names []string
err = q.GetResults(&names)

See querySelectSingleField() in examples/main.go for full example.

SelectFields() - projections using multiple fields

type employeeNameTitle struct {
	FirstName string
	Title     string
}

// RQL equivalent: from employees select FirstName, Title
tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)
q = q.SelectFields(reflect.TypeOf(&employeeNameTitle{}), "FirstName", "Title")

See querySelectFields() in examples/main.go for full example.

Distinct()

// RQL equivalent: from employees select distinct Title
tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)
q = q.SelectFields(reflect.TypeOf(""), "Title")
q = q.Distinct()

See queryDistinct() in examples/main.go for full example.

WhereEquals() / WhereNotEquals()

// RQL equivalent: from employees where Title = 'Sales Representative'
tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)
q = q.WhereEquals("Title", "Sales Representative")

See queryEquals() in examples/main.go for full example.

WhereIn

// RQL equivalent: from employees where Title in ['Sales Representative', 'Sales Manager']
tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)
q = q.WhereIn("Title", []interface{}{"Sales Representative", "Sales Manager"})

See queryIn() in examples/main.go for full example.

WhereStartsWith() / WhereEndsWith()

// RQL equivalent:
// from employees where startsWith('Ro')
tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)
q = q.WhereStartsWith("FirstName", "Ro")

See queryStartsWith() and queryEndsWith in examples/main.go for full example.

WhereBetween()

// RQL equivalent:
// from orders where Freight between 11 and 13
tp := reflect.TypeOf(&northwind.Order{})
q := session.QueryCollectionForType(tp)
q = q.WhereBetween("Freight", 11, 13)

See queryBetween() in examples/main.go for full example.

WhereGreaterThan() / WhereGreaterThanOrEqual() / WhereLessThan() / WhereLessThanOrEqual()

// RQL equivalent:
// from orders where Freight Freight > 11
tp := reflect.TypeOf(&northwind.Order{})
q := session.QueryCollectionForType(tp)
// can also be WhereGreaterThanOrEqual(), WhereLessThan(), WhereLessThanOrEqual()
q = q.WhereGreaterThan("Freight", 11)

See queryGreater() in examples/main.go for full example.

WhereExists()

Checks if the field exists.

// RQL equivalent:
// from employees where exists ("ReportsTo")
tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)
q = q.WhereExists("ReportsTo")

See queryExists() in examples/main.go for full example.

ContainsAny() / ContainsAll()

// RQL equivalent:
// from employees where FirstName in ("Anne", "Nancy")
tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)
q = q.ContainsAny("FirstName", []interface{}{"Anne", "Nancy"})

See queryContainsAny() in examples/main.go for full example.

Performs full-text search:

// RQL equivalent:
// from employees where search(FirstName, 'Anne Nancy')
tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)
q = q.Search("FirstName", "Anne Nancy")

See querySearch() in examples/main.go for full example.

OpenSubclause() / CloseSubclause()

// RQL equivalent:
// from employees where (FirstName = 'Steven') or (Title = 'Sales Representative' and LastName = 'Davolio')
tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)
q = q.WhereEquals("FirstName", "Steven")
q = q.OrElse()
q = q.OpenSubclause()
q = q.WhereEquals("Title", "Sales Representative")
q = q.WhereEquals("LastName", "Davolio")
q = q.CloseSubclause()

See querySubclause() in examples/main.go for full example.

Not()

// RQL equivalent:
// from employees where not FirstName = 'Steven'
tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)
q = q.Not()
q = q.WhereEquals("FirstName", "Steven")

See queryNot() in examples/main.go for full example.

AndAlso() / OrElse()

// RQL equivalent:
// from employees where FirstName = 'Steven' or FirstName  = 'Nancy'
tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)
q = q.WhereEquals("FirstName", "Steven")
// can also be AndElse()
q = q.OrElse()
q = q.WhereEquals("FirstName", "Nancy")

See queryOrElse() in examples/main.go for full example.

UsingDefaultOperator()

Sets default operator (which will be used if no AndAlso() / OrElse() was called. Just after query instantiation, OR is used as default operator. Default operator can be changed only adding any conditions.

OrderBy() / RandomOrdering()

// RQL equivalent:
// from employees order by FirstName
tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)
// can also be RandomOrdering()
q = q.OrderBy("FirstName")

See queryOrderBy() in examples/main.go for full example.

Take()

// RQL equivalent:
// from employees order by FirstName desc
tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)
q = q.OrderByDescending("FirstName")
q = q.Take(2)

See queryTake() in examples/main.go for full example.

Skip()

// RQL equivalent:
// from employees order by FirstName desc
tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)
q = q.OrderByDescending("FirstName")
q = q.Take(2)
q = q.Skip(1)

See querySkip() in examples/main.go for full example.

Getting query statistics

To obtain query statistics use Statistics() method.

var stats *ravendb.QueryStatistics
tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)
q = q.WhereGreaterThan("FirstName", "Bernard")
q = q.OrderByDescending("FirstName")
q.Statistics(&stats)

Statistics:

Statistics:
{IsStale:           false,
 DurationInMs:      0,
 TotalResults:      7,
 SkippedResults:    0,
 Timestamp:         2019-02-13 02:57:31.5226409 +0000 UTC,
 IndexName:         "Auto/employees/ByLastNameAndReportsToAndSearch(FirstName)AndTitle",
 IndexTimestamp:    2019-02-13 02:57:31.5226409 +0000 UTC,
 LastQueryTime:     2019-02-13 03:50:25.7602429 +0000 UTC,
 TimingsInMs:       {},
 ResultEtag:        7591488513381790088,
 ResultSize:        0,
 ScoreExplanations: {}}

See queryStatistics() in examples/main.go for full example.

GetResults() / First() / Single() / Count()

GetResults() - returns all results

First() - first result

Single() - first result, returns error if there's more entries

Count() - returns the number of the results (not affected by take())

See queryFirst(), querySingle() and queryCount() in examples/main.go for full example.

Attachments

Store attachments

fileStream, err := os.Open(path)
if err != nil {
    log.Fatalf("os.Open() failed with '%s'\n", err)
}
defer fileStream.Close()

fmt.Printf("new employee id: %s\n", e.ID)
err = session.Advanced().Attachments().Store(e, "photo.png", fileStream, "image/png")

// could also be done using document id
// err = session.Advanced().Attachments().Store(e.ID, "photo.png", fileStream, "image/png")

if err != nil {
    log.Fatalf("session.Advanced().Attachments().Store() failed with '%s'\n", err)
}

err = session.SaveChanges()

See storeAttachments() in examples/main.go for full example.

Get attachments

attachment, err := session.Advanced().Attachments().Get(docID, "photo.png")
if err != nil {
    log.Fatalf("session.Advanced().Attachments().Get() failed with '%s'\n", err)
}
defer attachment.Close()
fmt.Print("Attachment details:\n")
pretty.Print(attachment.Details)
// read attachment data
// attachment.Data is io.Reader
var attachmentData bytes.Buffer
n, err := io.Copy(&attachmentData, attachment.Data)
if err != nil {
    log.Fatalf("io.Copy() failed with '%s'\n", err)
}
fmt.Printf("Attachment size: %d bytes\n", n)

Attachment details:

{AttachmentName: {Name:        "photo.png",
                  Hash:        "MvUEcrFHSVDts5ZQv2bQ3r9RwtynqnyJzIbNYzu1ZXk=",
                  ContentType: "image/png",
                  Size:        4579},
 ChangeVector:   "A:4905-dMAeI9ANZ06DOxCRLnSmNw",
 DocumentID:     "employees/44-A"}
Attachment size: 4579 bytes

See getAttachments() in examples/main.go for full example.

Check if attachment exists

name := "photo.png"
exists, err := session.Advanced().Attachments().Exists(docID, name)
if err != nil {
    log.Fatalf("session.Advanced().Attachments().Exists() failed with '%s'\n", err)
}

See checkAttachmentExists() in examples/main.go for full example.

Get attachment names

names, err := session.Advanced().Attachments().GetNames(doc)
if err != nil {
    log.Fatalf("session.Advanced().Attachments().GetNames() failed with '%s'\n", err)
}

Attachment names:

[{Name:        "photo.png",
  Hash:        "MvUEcrFHSVDts5ZQv2bQ3r9RwtynqnyJzIbNYzu1ZXk=",
  ContentType: "image/png",
  Size:        4579}]

See getAttachmentNames() in examples/main.go for full example.

Bulk insert

When storing multiple documents, use bulk insertion.

bulkInsert := store.BulkInsert("")

names := []string{"Anna", "Maria", "Miguel", "Emanuel", "Dayanara", "Aleida"}
for _, name := range names {
    e := &northwind.Employee{
        FirstName: name,
    }
    id, err := bulkInsert.Store(e, nil)
    if err != nil {
        log.Fatalf("bulkInsert.Store() failed with '%s'\n", err)
    }
}
// flush data and finish
err = bulkInsert.Close()

See bulkInsert() in examples/main.go for full example.

Observing changes in the database

Listen for database changes e.g. document changes.

changes := store.Changes("")

err = changes.EnsureConnectedNow()
if err != nil {
    log.Fatalf("changes.EnsureConnectedNow() failed with '%s'\n", err)
}

cb := func(change *ravendb.DocumentChange) {
    fmt.Print("change:\n")
    pretty.Print(change)
}
docChangesCancel, err := changes.ForAllDocuments(cb)
if err != nil {
    log.Fatalf("changes.ForAllDocuments() failed with '%s'\n", err)
}

defer docChangesCancel()

e := &northwind.Employee{
    FirstName: "Jon",
    LastName:  "Snow",
}
err = session.Store(e)
if err != nil {
    log.Fatalf("session.Store() failed with '%s'\n", err)
}

err = session.SaveChanges()
if err != nil {
    log.Fatalf("session.SaveChanges() failed with '%s'\n", err)
}
// cb should now be called notifying there's a new document

Example change:

{Type:           "Put",
 ID:             "Raven/Hilo/employees",
 CollectionName: "@hilo",
 ChangeVector:   "A:4892-bJERJNLunE+4xQ/yDEuk1Q"}

See changes() in examples/main.go for full example.

Streaming

Streaming allows interating over documents matching certain criteria.

It's useful when there's a large number of results as it limits memory use by reading documents in batches (as opposed to all at once).

Stream documents with ID prefix

Here we iterate over all documents in products collection:

args := &ravendb.StartsWithArgs{
    StartsWith: "products/",
}
iterator, err := session.Advanced().Stream(args)
if err != nil {
    log.Fatalf("session.Advanced().Stream() failed with '%s'\n", err)
}
for {
    var p *northwind.Product
    streamResult, err := iterator.Next(&p)
    if err != nil {
        // io.EOF means there are no more results
        if err == io.EOF {
            err = nil
        } else {
            log.Fatalf("iterator.Next() failed with '%s'\n", err)
        }
        break
    }
    // handle p
}

See streamWithIDPrefix() in examples/main.go for full example.

This returns:

streamResult:
{ID:           "products/1-A",
 ChangeVector: "A:96-bJERJNLunE+4xQ/yDEuk1Q",
 Metadata:     {},
 Document:     ... same as product but as map[string]interface{} ...

product:
{ID:              "products/1-A",
 Name:            "Chai",
 Supplier:        "suppliers/1-A",
 Category:        "categories/1-A",
 QuantityPerUnit: "10 boxes x 20 bags",
 PricePerUnit:    18,
 UnitsInStock:    1,
 UnistsOnOrder:   0,
 Discontinued:    false,
 ReorderLevel:    10}

Stream query results

tp := reflect.TypeOf(&northwind.Product{})
q := session.QueryCollectionForType(tp)
q = q.WhereGreaterThan("PricePerUnit", 15)
q = q.OrderByDescending("PricePerUnit")

iterator, err := session.Advanced().StreamQuery(q, nil)
if err != nil {
    log.Fatalf("session.Advanced().StreamQuery() failed with '%s'\n", err)
}
// rest of processing as above

See streamQueryResults() in examples/main.go for full example.

Revisions

Note: make sure to enable revisions in a given store using NewConfigureRevisionsOperation operation.

e := &northwind.Employee{
    FirstName: "Jon",
    LastName:  "Snow",
}
err = session.Store(e)
if err != nil {
    log.Fatalf("session.Store() failed with '%s'\n", err)
}
err = session.SaveChanges()
if err != nil {
    log.Fatalf("session.SaveChanges() failed with '%s'\n", err)
}

// modify document to create a new revision
e.FirstName = "Jhonny"
err = session.SaveChanges()
if err != nil {
    log.Fatalf("session.SaveChanges() failed with '%s'\n", err)
}

var revisions []*northwind.Employee
err = session.Advanced().Revisions().GetFor(&revisions, e.ID)

See revisions() in examples/main.go for full example.

Returns:

[{ID:          "employees/43-A",
  LastName:    "Snow",
  FirstName:   "Jhonny",
  Title:       "",
  Address:     nil,
  HiredAt:     {},
  Birthday:    {},
  HomePhone:   "",
  Extension:   "",
  ReportsTo:   "",
  Notes:       [],
  Territories: []},
 {ID:          "employees/43-A",
  LastName:    "Snow",
  FirstName:   "Jon",
  Title:       "",
  Address:     nil,
  HiredAt:     {},
  Birthday:    {},
  HomePhone:   "",
  Extension:   "",
  ReportsTo:   "",
  Notes:       [],
  Territories: []}]

Suggestions

Suggestions provides similarity queries. Here we're asking for FirstName values similar to Micael and the database suggests Michael.

index := ravendb.NewIndexCreationTask("EmployeeIndex")
index.Map = "from doc in docs.Employees select new { doc.FirstName }"
index.Suggestion("FirstName")

err = store.ExecuteIndex(index, "")
if err != nil {
    log.Fatalf("store.ExecuteIndex() failed with '%s'\n", err)
}

tp := reflect.TypeOf(&northwind.Employee{})
q := session.QueryCollectionForType(tp)
su := ravendb.NewSuggestionWithTerm("FirstName")
su.Term = "Micael"
suggestionQuery := q.SuggestUsing(su)
results, err := suggestionQuery.Execute()

See suggestions() in examples/main.go for full example.

Returns:

{FirstName: {Name:        "FirstName",
             Suggestions: ["michael"]}}

Advanced patching

To update documents more efficiently than sending the whole document, you can patch just a given field or atomically add/substract values of numeric fields.

err = session.Advanced().IncrementByID(product.ID, "PricePerUnit", 15)
if err != nil {
    log.Fatalf("session.Advanced().IncrementByID() failed with %s\n", err)
}

err = session.Advanced().Patch(product, "Category", "expensive products")
if err != nil {
    log.Fatalf("session.Advanced().PatchEntity() failed with %s\n", err)
}

err = session.SaveChanges()
if err != nil {
    log.Fatalf("session.SaveChanges() failed with %s\n", err)
}

See advancedPatching() in examples/main.go for full example.

Subscriptions

opts := ravendb.SubscriptionCreationOptions{
    Query: "from Products where PricePerUnit > 17 and PricePerUnit < 19",
}
subscriptionName, err := store.Subscriptions().Create(&opts, "")
if err != nil {
    log.Fatalf("store.Subscriptions().Create() failed with %s\n", err)
}
wopts := ravendb.NewSubscriptionWorkerOptions(subscriptionName)
worker, err := store.Subscriptions().GetSubscriptionWorker(tp, wopts, "")
if err != nil {
    log.Fatalf("store.Subscriptions().GetSubscriptionWorker() failed with %s\n", err)
}

results := make(chan *ravendb.SubscriptionBatch, 16)
cb := func(batch *ravendb.SubscriptionBatch) error {
    results <- batch
    return nil
}
err = worker.Run(cb)
if err != nil {
    log.Fatalf("worker.Run() failed with %s\n", err)
}

// wait for first batch result
select {
case batch := <-results:
    fmt.Print("Batch of subscription results:\n")
    pretty.Print(batch)
case <-time.After(time.Second * 5):
    fmt.Printf("Timed out waiting for first subscription batch\n")

}

_ = worker.Close()

See subscriptions() in examples/main.go for full example.

Cluster wide transactions

Setup a session

To set session transaction as cluster wide you've to set TransactionMode in SessionOptions as TransactionMode_ClusterWide

session, err := store.OpenSessionWithOptions(&ravendb.SessionOptions{
    Database:        "",
    RequestExecutor: nil,
    TransactionMode: ravendb.TransactionMode_ClusterWide,
    DisableAtomicDocumentWritesInClusterWideTransaction: nil,
})

Cluster transactions

In order to create cluster transactions you have to get cluster transaction object from your session or you can use it as fluent API.

clusterTransaction := session.Advanced().ClusterTransaction()

In case of wrong session configuration clusterTransaction object will be nil.

Inserting new CompareExchangeValue

objectToInsert := &YourStruct{[...]}
key := "exampleKeyOfItem"
value, error := session.Advanced().ClusterTransaction().CreateCompareExchangeValue(key, objectToInsert)

Getting existing CompareExchangeValue from server

You can retrieve your value using various methods.

- Get value by key
dataType := reflect.TypeOf(&YourStruct{}) // identifies your data-struct type
key := "exampleKeyOfItem"
value, error := session.Advanced().ClusterTransaction().GetCompareExchangeValue(dataType, key)
- Get values by keys
dataType := reflect.TypeOf(&YourStruct{}) // identifies your data-struct type
keys := []string{"item/1", "item/2"}
value, error := session.Advanced().ClusterTransaction().GetCompareExchangeValuesWithKeys(dataType, keys)

Returns map where keys are identifiers.

Get values whose IDs start with a string
dataType := reflect.TypeOf(&YourStruct{}) // identifies your data-struct type
startsWith := "item/"
start := 0
pageSize := 25
values, error := session.Advanced().ClusterTransaction().GetCompareExchangeValues(dataType, startsWith, start, pageSize)

Returns map where keys are identifiers.

Delete CompareExchangeValue

By field key and index
key := "item/1"
index := 5
err := session.Advanced().ClusterTransaction().DeleteCompareExchangeValueByKey(key, index)
By CompareExchangeValue object
var compareExchangeValue *ravendb.CompareExchangeValue

//Load by API
compareExchangeValue , error := session.Advanced().ClusterTransaction().GetCompareExchangeValue[...]

err := session.Advanced().ClusterTransaction().DeleteCompareExchangeValue(compareExchangeValue)

Documentation

Overview

Package ravendb implements a driver for RavenDB NOSQL document database.

For more documentation see https://github.com/ravendb/ravendb-go-client/blob/master/readme.md

Index

Constants

View Source
const (
	AttachmentDocument = "Document"
	AttachmentRevision = "Revision"
)
View Source
const (
	//CommandNone                = "NONE"
	CommandPut                 = "PUT"
	CommandPatch               = "PATCH"
	CommandDelete              = "DELETE"
	CommandAttachmentPut       = "ATTACHMENT_PUT"
	CommandAttachmentDelete    = "ATTACHMENT_DELETE"
	CommandClientAnyCommand    = "CLIENT_ANY_COMMAND"
	CommandClientNotAttachment = "CLIENT_NOT_ATTACHMENT"
	CompareExchangePut         = "COMPARE_EXCHANGE_PUT"
	CompareExchangeDelete      = "COMPARE_EXCHANGE_DELETE"
)

Note: this is enum in Java but those are serialized to json as strings so making them strings is better in Go

View Source
const (
	ConnectionStringTypeNone  = "None"
	ConnectionStringTypeRaven = "Raven"
	ConnectionStringTypeSQL   = "Sql"
)
View Source
const (
	// Name of struct field that represents identity property
	IdentityProperty = "ID"

	MetadataCollection             = "@collection"
	MetadataProjection             = "@projection"
	MetadataKey                    = "@metadata"
	MetadataID                     = "@id"
	MetadataConflict               = "@conflict"
	MetadataIDProperty             = "Id"
	MetadataFlags                  = "@flags"
	MetadataAttachments            = "@attachments"
	MetadataInddexScore            = "@index-score"
	MetadataLastModified           = "@last-modified"
	MetadataRavenGoType            = "Raven-Go-Type"
	MetadataChangeVector           = "@change-vector"
	MetadataExpires                = "@expires"
	MetadataAllDocumentsCollection = "@all_docs"

	IndexingSideBySideIndexNamePrefix = "ReplacementOf/"
	IndexingFieldNameDocumentID       = "id()"
	IndexingFieldNameReduceKeyHash    = "hash(key())"
	IndexingFieldNameReduceKeyValue   = "key()"
	IndexingFieldAllFields            = "__all_fields"
	IndexingFieldsNameSpatialShare    = "spatial(shape)"
	//TBD CUSTOM_SORT_FIELD_NAME = "__customSort";
	IndexingSpatialDefaultDistnaceErrorPct = 0.025

	TransactionMode_SingleNode  = 0
	TransactionMode_ClusterWide = 1
)
View Source
const (
	DatabasePromotionStatusWaitingForFirstPromotion = "WaitingForFirstPromotion"
	DatabasePromotionStatusNotResponding            = "NotResponding"
	DatabasePromotionStatusIndexNotUpToDate         = "IndexNotUpToDate"
	DatabasePromotionStatusChangeVectorNotMerged    = "ChangeVectorNotMerged"
	DatabasePromotionStatusWaitingForResponse       = "WaitingForResponse"
	DatabasePromotionStatusOk                       = "Ok"
)
View Source
const (
	DocumentChangeNone     = "None"
	DocumentChangePut      = "Put"
	DocumentChangeDelete   = "Delete"
	DocumentChangeConflict = "Conflict"
	DocumentChangeCommon   = "Common"
)
View Source
const (
	FacetAggregationNone    = "None"
	FacetAggregationMax     = "Max"
	FacetAggregationMin     = "Min"
	FacetAggregationAverage = "Average"
	FacetAggregationSum     = "Sum"
)
View Source
const (
	FacetTermSortModeValueAsc  = "ValueAsc"
	FacetTermSortModeValueDesc = "ValueDesc"
	FacetTermSortModeCountAsc  = "CountAsc"
	FacetTermSortModeCountDesc = "CountDesc"
)
View Source
const (
	FieldIndexingNo      = "No"
	FieldIndexingSearch  = "Search"
	FieldIndexingExact   = "Exact"
	FieldIndexingDefault = "Default"
)
View Source
const (
	FieldStorageYes = "Yes"
	FieldStorageNo  = "No"
)
View Source
const (
	FieldTermVectorNo                      = "No"
	FieldTermVectorYes                     = "Yes"
	FieldTermVectorWithPositions           = "WithPositions"
	FieldTermVectorWithOffsets             = "WithOffsets"
	FieldTermVectorWithPositionsAndOffsets = "WithPositionsAndOffsets"
)
View Source
const (
	GroupByMethodNone  = "None"
	GroupByMethodArray = "Array"
)
View Source
const (
	IndexChangeNone                   = "None"
	IndexChangeBatchCompleted         = "BatchCompleted"
	IndexChangeIndexAdded             = "IndexAdded"
	IndexChangeIndexRemoved           = "IndexRemoved"
	IndexChangeIndexDemotedToIdle     = "IndexDemotedToIdle"
	IndexChangeIndexPromotedFromIdle  = "IndexPromotedFromIdle"
	IndexChangeIndexDemotedToDisabled = "IndexDemotedToDisabled"
	IndexChangeIndexMarkedAsErrored   = "IndexMarkedAsErrored"
	IndexChangeSideBySideReplace      = "SideBySideReplace"
	IndexChangeRenamed                = "Renamed"
	IndexChangeIndexPaused            = "IndexPaused"
	IndexChangeLockModeChanged        = "LockModeChanged"
	IndexChangePriorityChanged        = "PriorityChanged"
)
View Source
const (
	IndexLockModeUnlock       = "Unlock"
	IndexLockModeLockedIgnore = "LockedIgnore"
	IndexLockModeLockedError  = "LockedError"
)
View Source
const (
	IndexPriorityLow    = "Low"
	IndexPriorityNormal = "Normal"
	IndexPriorityHigh   = "High"
)
View Source
const (
	IndexRunningStatusRunning  = "Running"
	IndexRunningStatusPaused   = "Paused"
	IndexRunningStatusDisabled = "Disabled"
)
View Source
const (
	IndexStateNormal   = "Normal"
	IndexStateDisabled = "Disabled"
	IndexStateIdle     = "Idle"
	IndexStateError    = "Error"
)
View Source
const (
	IndexTypeNone          = "None"
	IndexTypeAutoMap       = "AutoMap"
	IndexTypeAutoMapReduce = "AutoMapReduce"
	IndexTypeMap           = "Map"
	IndexTypeMapReduce     = "MapReduce"
	IndexTypeFaulty        = "Faulty"
)
View Source
const (
	MoreLikeThisOptionsDefaultMaximumNumberOfTokensParsed = 5000
	MoreLikeThisOptionsDefaultMinimumTermFrequency        = 2
	MoreLikeThisOptionsDefaultMinimumDocumentFrequency    = 5
	MoreLikeThisOptionsDefaultMaximumDocumentFrequence    = math.MaxInt32
	MoreLikeThisOptionsDefaultBoost                       = false
	MoreLikeThisOptionsDefaultBoostFactor                 = 1
	MoreLikeThisOptionsDefaultMinimumWordLength           = 0
	MoreLikeThisOptionsDefaultMaximumWordLength           = 0
	MoreLikeThisOptionsDefaultMaximumQueryTerms           = 25
)
View Source
const (
	OrderingTypeString       = "STRING"
	OrderingTypeLong         = "LONG"
	OrderingTypeDouble       = "DOUBLE"
	OrderingTypeAlphaNumeric = "ALPHA_NUMERIC"
)
View Source
const (
	PatchStatusDocumentDoesNotExist = "DocumentDoesNotExist"
	PatchStatusCreated              = "Created"
	PatchStatusPatched              = "Patched"
	PatchStatusSkipped              = "Skipped"
	PatchStatusNotModified          = "NotModified"
)
View Source
const (
	QueryOperatorAnd = "And"
	QueryOperatorOr  = "Or"
)
View Source
const (
	RavenCommandResponseTypeEmpty  = "EMPTY"
	RavenCommandResponseTypeObject = "OBJECT"
	RavenCommandResponseTypeRaw    = "RAW"
)
View Source
const (
	ReadBalanceBehaviorNone        = "None"
	ReadBalanceBehaviorRoundRobin  = "RoundRobin"
	ReadBalanceBehaviorFastestNode = "FastestNode"
)
View Source
const (
	ServerNodeRoleNone       = "None"
	ServerNodeRolePromotable = "Promotable"
	ServerNodeRoleMember     = "Member"
	ServerNodeRoleRehab      = "Rehab"
)
View Source
const (
	SpatialFieldGeography = "Geography"
	SpatialFieldCartesian = "Cartesian"
)
View Source
const (
	//about 4.78 meters at equator, should be good enough (see: http://unterbahn.com/2009/11/metric-dimensions-of-geohash-partitions-at-the-equator/)
	SpatialOptionsDefaultGeohashLevel = 9
	//about 4.78 meters at equator, should be good enough
	SpatialOptionsDefaultQuadTreeLevel = 23
)
View Source
const (
	SpatialRelationWithin     = "Within"
	SpatialRelationContains   = "Contains"
	SpatialRelationDisjoin    = "Disjoint"
	SpatialRelationIntersects = "Intersects"
)
View Source
const (
	SpatialSearchStrategyGeohashPrefixTree = "GeohashPrefixTree"
	SpatialSearchStrategyQuadPrefixTree    = "QuadPrefixTree"
	SpatialSearchStrategyBoundingBox       = "BoundingBox"
)
View Source
const (
	SpatialUnitsKilometers = "Kilometers"
	SpatialUnitsMiles      = "Miles"
)
View Source
const (
	StringDistanceNone        = "None"
	StringDistanceDefault     = "Default"
	StringDistanceLevenshtein = "Levenshtein"
	StringDistanceJaroWinkler = "JaroWinkler"
	StringDistanceNGram       = "NGram"
)
View Source
const (
	SubscriptionClientMessageNone                 = "None"
	SubscriptionClientMessageAcknowledge          = "Acknowledge"
	SubscriptionClientMessageDisposedNotification = "DisposedNotification"
)
View Source
const (
	// SubscriptionOpeningStrategyOpenIfFree:
	// The client will successfully open a subscription only if there isn't any other currently connected client.
	// Otherwise it will end up with SubscriptionInUseError
	SubscriptionOpeningStrategyOpenIfFree = "OpenIfFree"
	// SubscriptionOpeningStrategyTakeOver:
	// The connecting client will successfully open a subscription even if there is another active subscription's consumer.
	// If the new client takes over an existing client then the existing one will get a SubscriptionInUseException.
	//
	// The subscription will always be held by the last connected client.
	SubscriptionOpeningStrategyTakeOver = "TakeOver"
	// SubscriptionOpeningStrategyWaitForFree:
	// If the client currently cannot open the subscription because it is used by another client but it will wait for that client
	// to complete and keep attempting to gain the subscription
	SubscriptionOpeningStrategyWaitForFree = "WaitForFree"
)
View Source
const (
	SuggestionSortModeNone       = "None"
	SuggestionSortModePopularity = "Popularity"
)
View Source
const (
	MethodsTypeCmpXChg = "CmpXChg"
)

Variables

View Source
var (

	// HTTPClientPostProcessor allows to tweak http client after it has been created
	// this allows replacing Transport with a custom transport that does logging,
	// proxying or tweaks each http request
	HTTPClientPostProcessor func(*http.Client)

	// if true, adds lots of logging to track bugs in request executor
	DebugLogRequestExecutor bool = false
	DebugTopology           bool = false
)
View Source
var (
	SuggestionOptionsDefaultOptions  = NewSuggestionOptions()
	SuggestionOptionsDefaultAccuracy = float32(0.5)
	SuggestionOptionsDefaultPageSize = 15
	SuggestionOptionsDefaultDistance = StringDistanceLevenshtein
	SuggestionOptionsDefaultSortMode = SuggestionSortModePopularity
)
View Source
var (
	// DefaultFacetOptions are default facet options
	DefaultFacetOptions = &FacetOptions{}
)
View Source
var (
	// LogSubscriptions allows to monitor read/writes made by SubscriptionWorker to a tcp connection. For debugging.
	LogSubscriptionWorker func(op string, d []byte) = func(op string, d []byte) {

	}
)
View Source
var (
	// if true, does verbose logging.
	LogVerbose = false
)

Functions

func FieldsFor

func FieldsFor(s interface{}) []string

FieldsFor returns names of all fields for the value of a struct type. They can be used in e.g. DocumentQuery.SelectFields: fields := ravendb.FieldsFor(&MyType{}) q = q.SelectFields(fields...)

func GetCollectionNameDefault

func GetCollectionNameDefault(entityOrType interface{}) string

GetCollectionNameDefault is a default way of

func GetWrappedError

func GetWrappedError(err error) error

GetWrappedError returns an error wrapped by this error If no error is wrapped, returns nil

func IsPlural

func IsPlural(word string) bool

IsPlural retruns true if word is plural

func IsSingular

func IsSingular(word string) bool

IsSingular returns true if a word is singular

func NewHttpPost

func NewHttpPost(uri string, data []byte) (*http.Request, error)

func ParseTime

func ParseTime(s string) (time.Time, error)

ParseTime parses string time value returned by RavenDB server The value can't be parsed with a single string format

func Pluralize

func Pluralize(word string, count int, inclusive bool) string

Pluralize or singularize a word based on the passed in count.

func RaftId

func RaftId() (string, error)

func RoundToServerTime

func RoundToServerTime(t time.Time) time.Time

RoundToServerTime rounds t to the same precision as round-tripping to the server and back. Useful for comparing time.Time values for equality with values returned by the server

func ToPlural

func ToPlural(word string) string

ToPlural makes a pluralized version of a word

func ToSingular

func ToSingular(word string) string

ToSingular singularizes a word.

func WithFiddler

func WithFiddler() error

WithFiddler Setup proxy for fiddler. Is used for debugging purposes.

Types

type AdvancedSessionExtensionBase

type AdvancedSessionExtensionBase struct {
	// contains filtered or unexported fields
}

AdvancedSessionExtensionBase implements common advanced session operations

func (*AdvancedSessionExtensionBase) Defer

func (e *AdvancedSessionExtensionBase) Defer(commands ...ICommandData)

Defer defers multiple commands to be executed on SaveChnages

type AdvancedSessionOperations

type AdvancedSessionOperations struct {
	// contains filtered or unexported fields
}

AdvancedSessionOperations exposes advanced session operations

func (*AdvancedSessionOperations) AddAfterSaveChangesListener

func (o *AdvancedSessionOperations) AddAfterSaveChangesListener(handler func(*AfterSaveChangesEventArgs)) int

func (*AdvancedSessionOperations) AddBeforeDeleteListener

func (o *AdvancedSessionOperations) AddBeforeDeleteListener(handler func(*BeforeDeleteEventArgs)) int

func (*AdvancedSessionOperations) AddBeforeQueryListener

func (o *AdvancedSessionOperations) AddBeforeQueryListener(handler func(*BeforeQueryEventArgs)) int

func (*AdvancedSessionOperations) AddBeforeStoreListener

func (o *AdvancedSessionOperations) AddBeforeStoreListener(handler func(*BeforeStoreEventArgs)) int

func (*AdvancedSessionOperations) Attachments

func (*AdvancedSessionOperations) Clear

func (o *AdvancedSessionOperations) Clear()

func (*AdvancedSessionOperations) ClusterTransaction

func (*AdvancedSessionOperations) Defer

func (o *AdvancedSessionOperations) Defer(commands ...ICommandData)

func (*AdvancedSessionOperations) Eagerly

func (*AdvancedSessionOperations) Evict

func (o *AdvancedSessionOperations) Evict(entity interface{}) error

func (*AdvancedSessionOperations) Exists

func (o *AdvancedSessionOperations) Exists(id string) (bool, error)

func (*AdvancedSessionOperations) GetChangeVectorFor

func (o *AdvancedSessionOperations) GetChangeVectorFor(instance interface{}) (*string, error)

func (*AdvancedSessionOperations) GetCurrentSessionNode

func (o *AdvancedSessionOperations) GetCurrentSessionNode() (*ServerNode, error)

func (*AdvancedSessionOperations) GetDocumentID

func (o *AdvancedSessionOperations) GetDocumentID(instance interface{}) string

func (*AdvancedSessionOperations) GetDocumentStore

func (o *AdvancedSessionOperations) GetDocumentStore() *DocumentStore

func (*AdvancedSessionOperations) GetLastModifiedFor

func (o *AdvancedSessionOperations) GetLastModifiedFor(instance interface{}) (*time.Time, error)

func (*AdvancedSessionOperations) GetMaxNumberOfRequestsPerSession

func (o *AdvancedSessionOperations) GetMaxNumberOfRequestsPerSession() int

func (*AdvancedSessionOperations) GetMetadataFor

func (o *AdvancedSessionOperations) GetMetadataFor(instance interface{}) (*MetadataAsDictionary, error)

func (*AdvancedSessionOperations) GetNumberOfRequests

func (o *AdvancedSessionOperations) GetNumberOfRequests() int

GetNumberOfRequests returns number of requests sent to the server

func (*AdvancedSessionOperations) GetRequestExecutor

func (o *AdvancedSessionOperations) GetRequestExecutor() *RequestExecutor

func (*AdvancedSessionOperations) HasChanged

func (o *AdvancedSessionOperations) HasChanged(entity interface{}) (bool, error)

func (*AdvancedSessionOperations) HasChanges

func (o *AdvancedSessionOperations) HasChanges() bool

func (*AdvancedSessionOperations) IgnoreChangesFor

func (o *AdvancedSessionOperations) IgnoreChangesFor(entity interface{}) error

func (*AdvancedSessionOperations) Increment

func (o *AdvancedSessionOperations) Increment(entity interface{}, path string, valueToAdd interface{}) error

func (*AdvancedSessionOperations) IncrementByID

func (o *AdvancedSessionOperations) IncrementByID(id string, path string, valueToAdd interface{}) error

func (*AdvancedSessionOperations) IsLoaded

func (o *AdvancedSessionOperations) IsLoaded(id string) bool

func (*AdvancedSessionOperations) Lazily

func (*AdvancedSessionOperations) LoadIntoStream

func (o *AdvancedSessionOperations) LoadIntoStream(ids []string, output io.Writer) error

func (*AdvancedSessionOperations) LoadStartingWith

func (o *AdvancedSessionOperations) LoadStartingWith(results interface{}, args *StartsWithArgs) error

func (*AdvancedSessionOperations) LoadStartingWithIntoStream

func (o *AdvancedSessionOperations) LoadStartingWithIntoStream(output io.Writer, args *StartsWithArgs) error

func (*AdvancedSessionOperations) Patch

func (o *AdvancedSessionOperations) Patch(entity interface{}, path string, value interface{}) error

func (*AdvancedSessionOperations) PatchArray

func (o *AdvancedSessionOperations) PatchArray(entity interface{}, pathToArray string, arrayAdder func(*JavaScriptArray)) error

func (*AdvancedSessionOperations) PatchArrayByID

func (o *AdvancedSessionOperations) PatchArrayByID(id string, pathToArray string, arrayAdder func(*JavaScriptArray)) error

func (*AdvancedSessionOperations) PatchByID

func (o *AdvancedSessionOperations) PatchByID(id string, path string, value interface{}) error

func (*AdvancedSessionOperations) Query

func (*AdvancedSessionOperations) QueryCollection

func (o *AdvancedSessionOperations) QueryCollection(collectionName string) *DocumentQuery

func (*AdvancedSessionOperations) QueryCollectionForType

func (o *AdvancedSessionOperations) QueryCollectionForType(typ reflect.Type) *DocumentQuery

func (*AdvancedSessionOperations) QueryIndex

func (o *AdvancedSessionOperations) QueryIndex(indexName string) *DocumentQuery

func (*AdvancedSessionOperations) RawQuery

func (o *AdvancedSessionOperations) RawQuery(rawQuery string) *RawDocumentQuery

func (*AdvancedSessionOperations) Refresh

func (o *AdvancedSessionOperations) Refresh(entity interface{}) error

func (*AdvancedSessionOperations) RemoveAfterSaveChangesListener

func (o *AdvancedSessionOperations) RemoveAfterSaveChangesListener(handlerID int)

func (*AdvancedSessionOperations) RemoveBeforeDeleteListener

func (o *AdvancedSessionOperations) RemoveBeforeDeleteListener(handlerID int)

func (*AdvancedSessionOperations) RemoveBeforeQueryListener

func (o *AdvancedSessionOperations) RemoveBeforeQueryListener(handlerID int)

func (*AdvancedSessionOperations) RemoveBeforeStoreListener

func (o *AdvancedSessionOperations) RemoveBeforeStoreListener(handlerID int)

func (*AdvancedSessionOperations) Revisions

func (*AdvancedSessionOperations) SetMaxNumberOfRequestsPerSession

func (o *AdvancedSessionOperations) SetMaxNumberOfRequestsPerSession(n int)

func (*AdvancedSessionOperations) SetTransactionMode

func (o *AdvancedSessionOperations) SetTransactionMode(mode TransactionMode)

func (*AdvancedSessionOperations) Stream

func (*AdvancedSessionOperations) StreamQuery

func (o *AdvancedSessionOperations) StreamQuery(query *DocumentQuery, streamQueryStats *StreamQueryStatistics) (*StreamIterator, error)

func (*AdvancedSessionOperations) StreamQueryInto

func (o *AdvancedSessionOperations) StreamQueryInto(query *DocumentQuery, output io.Writer) error

func (*AdvancedSessionOperations) StreamRawQuery

func (o *AdvancedSessionOperations) StreamRawQuery(query *RawDocumentQuery, streamQueryStats *StreamQueryStatistics) (*StreamIterator, error)

func (*AdvancedSessionOperations) StreamRawQueryInto

func (o *AdvancedSessionOperations) StreamRawQueryInto(query *RawDocumentQuery, output io.Writer) error

func (*AdvancedSessionOperations) WaitForIndexesAfterSaveChanges

func (o *AdvancedSessionOperations) WaitForIndexesAfterSaveChanges(options func(*IndexesWaitOptsBuilder))

func (*AdvancedSessionOperations) WaitForReplicationAfterSaveChanges

func (o *AdvancedSessionOperations) WaitForReplicationAfterSaveChanges(options func(*ReplicationWaitOptsBuilder))

func (*AdvancedSessionOperations) WhatChanged

func (o *AdvancedSessionOperations) WhatChanged() (map[string][]*DocumentsChanges, error)

type AfterSaveChangesEventArgs

type AfterSaveChangesEventArgs struct {
	Session    *InMemoryDocumentSessionOperations
	DocumentID string
	Entity     interface{}
	// contains filtered or unexported fields
}

AfterSaveChangesEventArgs describes arguments for "after save changes" listener

func (*AfterSaveChangesEventArgs) GetDocumentMetadata

func (a *AfterSaveChangesEventArgs) GetDocumentMetadata() *MetadataAsDictionary

GetDocumentMetadata returns metadata for the entity represented by this event

type AggregationDocumentQuery

type AggregationDocumentQuery = aggregationQueryBase

Note: AggregationDocumentQuery is fused into AggregationQueryBase because in Java AggregationQueryBase calls functions implemented in AggregationDocumentQuery and that doesn't translate to Go's embedding

func (*AggregationDocumentQuery) AndAggregateByFacet

func (q *AggregationDocumentQuery) AndAggregateByFacet(facet FacetBase) *AggregationDocumentQuery

from AggregationDocumentQuery

func (*AggregationDocumentQuery) GetIndexQuery

func (q *AggregationDocumentQuery) GetIndexQuery() (*IndexQuery, error)

type AggressiveCacheOptions

type AggressiveCacheOptions struct {
	Duration time.Duration
}

TODO: should this be exported?

type AllTopologyNodesDownError

type AllTopologyNodesDownError struct {
	// contains filtered or unexported fields
}

AllTopologyNodesDownError represents "all topology nodes are down" error

func (*AllTopologyNodesDownError) Error

func (e *AllTopologyNodesDownError) Error() string

Error makes it conform to error interface

func (*AllTopologyNodesDownError) WrappedError

func (e *AllTopologyNodesDownError) WrappedError() error

hackish way to get a wrapped error

type AttachmentDetails

type AttachmentDetails struct {
	AttachmentName
	ChangeVector *string `json:"ChangeVector"`
	DocumentID   string  `json:"DocumentId"`
}

AttachmentDetails represents details of an attachment

type AttachmentName

type AttachmentName struct {
	Name        string `json:"Name"`
	Hash        string `json:"Hash"`
	ContentType string `json:"ContentType"`
	Size        int64  `json:"Size"`
}

AttachmentName represents infor about an attachment

type AttachmentResult

type AttachmentResult struct {
	Data    io.Reader
	Details *AttachmentDetails
	// contains filtered or unexported fields
}

AttachmentResult represents an attachment

func (*AttachmentResult) Close

func (r *AttachmentResult) Close() error

Close closes the attachment

type AttachmentType

type AttachmentType = string

type AttachmentsSessionOperations

type AttachmentsSessionOperations = DocumentSessionAttachments

TODO: make a unique wrapper type

type AuthorizationError

type AuthorizationError struct {
	// contains filtered or unexported fields
}

AuthorizationError represents authorization error

func (*AuthorizationError) Error

func (e *AuthorizationError) Error() string

Error makes it conform to error interface

func (*AuthorizationError) WrappedError

func (e *AuthorizationError) WrappedError() error

hackish way to get a wrapped error

type BadRequestError

type BadRequestError struct {
	RavenError
}

BadRequestError maps to server's 400 Bad Request response This is additional information sent by the server

func (*BadRequestError) Error

func (e *BadRequestError) Error() string

Error makes it conform to error interface

func (*BadRequestError) WrappedError

func (e *BadRequestError) WrappedError() error

hackish way to get a wrapped error

type BadResponseError

type BadResponseError struct {
	RavenError
}

BadResponseError represents "bad response" error

func (*BadResponseError) Error

func (e *BadResponseError) Error() string

Error makes it conform to error interface

func (*BadResponseError) WrappedError

func (e *BadResponseError) WrappedError() error

hackish way to get a wrapped error

type BatchCommand

type BatchCommand struct {
	RavenCommandBase

	Result *JSONArrayResult
	// contains filtered or unexported fields
}

BatchCommand represents batch command

func (*BatchCommand) Close

func (c *BatchCommand) Close() error

func (*BatchCommand) CreateRequest

func (c *BatchCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*BatchCommand) SetResponse

func (c *BatchCommand) SetResponse(response []byte, fromCache bool) error

type BatchOperation

type BatchOperation struct {
	// contains filtered or unexported fields
}

BatchOperation represents a batch operation

type BatchOptions

type BatchOptions struct {
	// contains filtered or unexported fields
}

BatchOptions describes options for batch operations

func NewBatchOptions

func NewBatchOptions() *BatchOptions

NewBatchOptions returns new BatchOptions

type BeforeDeleteEventArgs

type BeforeDeleteEventArgs struct {
	Session    *InMemoryDocumentSessionOperations
	DocumentID string
	Entity     interface{}
	// contains filtered or unexported fields
}

BeforeDeleteEventArgs describes arguments for "before delete" listener

func (*BeforeDeleteEventArgs) GetDocumentMetadata

func (a *BeforeDeleteEventArgs) GetDocumentMetadata() *MetadataAsDictionary

GetDocumentMetadata returns metadata for the entity being deleted

type BeforeQueryEventArgs

type BeforeQueryEventArgs struct {
	Session            *InMemoryDocumentSessionOperations
	QueryCustomization *DocumentQueryCustomization
}

BeforeQueryEventArgs describes arguments for "before query" event

type BeforeStoreEventArgs

type BeforeStoreEventArgs struct {
	Session    *InMemoryDocumentSessionOperations
	DocumentID string
	Entity     interface{}
	// contains filtered or unexported fields
}

BeforeStoreEventArgs describe arguments for "before store" listener

func (*BeforeStoreEventArgs) GetDocumentMetadata

func (a *BeforeStoreEventArgs) GetDocumentMetadata() *MetadataAsDictionary

GetDocumentMetadata returns metadata for entity represented by this event

type BulkInsertAbortedError

type BulkInsertAbortedError struct {
	RavenError
}

BulkInsertAbortedError represents "bulk insert aborted" error

func (*BulkInsertAbortedError) Error

func (e *BulkInsertAbortedError) Error() string

Error makes it conform to error interface

func (*BulkInsertAbortedError) WrappedError

func (e *BulkInsertAbortedError) WrappedError() error

hackish way to get a wrapped error

type BulkInsertCommand

type BulkInsertCommand struct {
	RavenCommandBase

	Result *http.Response
	// contains filtered or unexported fields
}

BulkInsertCommand describes build insert command

func NewBulkInsertCommand

func NewBulkInsertCommand(id int64, stream io.Reader, useCompression bool) *BulkInsertCommand

NewBulkInsertCommand returns new BulkInsertCommand

func (*BulkInsertCommand) CreateRequest

func (c *BulkInsertCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*BulkInsertCommand) Send

func (c *BulkInsertCommand) Send(client *http.Client, req *http.Request) (*http.Response, error)

func (*BulkInsertCommand) SetResponse

func (c *BulkInsertCommand) SetResponse(response []byte, fromCache bool) error

type BulkInsertOperation

type BulkInsertOperation struct {
	Command *BulkInsertCommand
	// contains filtered or unexported fields
}

BulkInsertOperation represents bulk insert operation

func NewBulkInsertOperation

func NewBulkInsertOperation(database string, store *DocumentStore) *BulkInsertOperation

NewBulkInsertOperation returns new BulkInsertOperation

func (*BulkInsertOperation) Abort

func (o *BulkInsertOperation) Abort() error

Abort aborts insert operation

func (*BulkInsertOperation) Close

func (o *BulkInsertOperation) Close() error

Close closes operation

func (*BulkInsertOperation) GetID

func (o *BulkInsertOperation) GetID(entity interface{}) (string, error)

GetID returns id for an entity

func (*BulkInsertOperation) Store

func (o *BulkInsertOperation) Store(entity interface{}, metadata *MetadataAsDictionary) (string, error)

Store schedules entity for storing and returns its id. metadata can be nil

func (*BulkInsertOperation) StoreWithID

func (o *BulkInsertOperation) StoreWithID(entity interface{}, id string, metadata *MetadataAsDictionary) error

StoreWithID stores an entity with a given id

func (*BulkInsertOperation) WaitForID

func (o *BulkInsertOperation) WaitForID() error

WaitForID waits for operation id to finish

type BulkInsertProtocolViolationError

type BulkInsertProtocolViolationError struct {
	RavenError
}

func (*BulkInsertProtocolViolationError) Error

func (e *BulkInsertProtocolViolationError) Error() string

Error makes it conform to error interface

func (*BulkInsertProtocolViolationError) WrappedError

func (e *BulkInsertProtocolViolationError) WrappedError() error

hackish way to get a wrapped error

type CancelFunc

type CancelFunc func()

type CancellationError

type CancellationError struct {
}

func (*CancellationError) Error

func (e *CancellationError) Error() string

type CertificateNameMismatchError

type CertificateNameMismatchError struct {
	// contains filtered or unexported fields
}

CertificateNameMismatchError is returned when subscription is in use

func (*CertificateNameMismatchError) Error

func (e *CertificateNameMismatchError) Error() string

Error makes it conform to error interface

func (*CertificateNameMismatchError) WrappedError

func (e *CertificateNameMismatchError) WrappedError() error

hackish way to get a wrapped error

type ChangeProcessingError

type ChangeProcessingError struct {
	RavenError
}

func (*ChangeProcessingError) Error

func (e *ChangeProcessingError) Error() string

Error makes it conform to error interface

func (*ChangeProcessingError) WrappedError

func (e *ChangeProcessingError) WrappedError() error

hackish way to get a wrapped error

type ChangeType

type ChangeType int

ChangeType describes a type of a change in a document

const (
	// TODO: make those into a string?
	DocumentChangeDocumentDeleted ChangeType = iota
	DocumentChangeDocumentAdded
	DocumentChangeFieldChanged
	DocumentChangeNewField
	DocumentChangeRemovedField
	DocumentChangeArrayValueChanged
	DocumentChangeArrayValueAdded
	DocumentChangeArrayValueRemoved
	DocumentChangeFieldTypeChanged
	DocumentChangeEntityTypeChanged
)

type CircleCriteria

type CircleCriteria struct {
	SpatialCriteriaCommon
	// contains filtered or unexported fields
}

CircleCriteria describes circle criteria

func NewCircleCriteria

func NewCircleCriteria(radius float64, latitude float64, longitude float64, radiusUnits SpatialUnits, relation SpatialRelation, distErrorPercent float64) *CircleCriteria

NewCircleCriteria returns new CircleCriteria

func (*CircleCriteria) GetShapeToken

func (c *CircleCriteria) GetShapeToken(addQueryParameter func(interface{}) string) *shapeToken

GetShapeToken returns shapeToken

func (*CircleCriteria) ToQueryToken

func (c *CircleCriteria) ToQueryToken(fieldName string, addQueryParameter func(interface{}) string) queryToken

ToQueryToken creates a token

type ClientConfiguration

type ClientConfiguration struct {
	Etag       int64 `json:"Etag"`
	IsDisabled bool  `json:"Disabled"`
	// TODO: should this be *int ?
	MaxNumberOfRequestsPerSession int                 `json:"MaxNumberOfRequestsPerSession"`
	ReadBalanceBehavior           ReadBalanceBehavior `json:"ReadBalanceBehavior"`
}

ClientConfiguration represents client configuration

type ClientVersionMismatchError

type ClientVersionMismatchError struct {
	RavenError
}

ClientVersionMismatchError is returned when subscription is in use

func (*ClientVersionMismatchError) Error

func (e *ClientVersionMismatchError) Error() string

Error makes it conform to error interface

func (*ClientVersionMismatchError) WrappedError

func (e *ClientVersionMismatchError) WrappedError() error

hackish way to get a wrapped error

type ClusterRequestExecutor

type ClusterRequestExecutor = RequestExecutor

Note: for simplicity ClusterRequestExecutor logic is implemented in RequestExecutor because Go doesn't support inheritance

type ClusterTopology

type ClusterTopology struct {
	TopologyID string            `json:"TopologyId"`
	AllNodes   map[string]string `json:"AllNodes"`
	// Those map name like A to server url like http://localhost:9999
	Members     map[string]string `json:"Members"`
	Promotables map[string]string `json:"Promotables"`
	Watchers    map[string]string `json:"Watchers"`
	LastNodeId  string            `json:"LastNodeId"`
	Etag        int               `json:"Etag"`
}

ClusterTopology is a part of ClusterTopologyResponse

type ClusterTransactionOperations

type ClusterTransactionOperations struct {
	// contains filtered or unexported fields
}

func (*ClusterTransactionOperations) Clear

func (cto *ClusterTransactionOperations) Clear()

func (*ClusterTransactionOperations) CreateCompareExchangeValue

func (cto *ClusterTransactionOperations) CreateCompareExchangeValue(key string, item interface{}) (interface{}, error)

func (*ClusterTransactionOperations) DeleteCompareExchangeValue

func (cto *ClusterTransactionOperations) DeleteCompareExchangeValue(item *CompareExchangeValue) error

func (*ClusterTransactionOperations) DeleteCompareExchangeValueByKey

func (cto *ClusterTransactionOperations) DeleteCompareExchangeValueByKey(key string, index int64) error

func (*ClusterTransactionOperations) GetCompareExchangeValue

func (cto *ClusterTransactionOperations) GetCompareExchangeValue(clazz reflect.Type, key string) (*CompareExchangeValue, error)

func (*ClusterTransactionOperations) GetCompareExchangeValues

func (cto *ClusterTransactionOperations) GetCompareExchangeValues(clazz reflect.Type, startsWith string, start int, pageSize int) (map[string]*CompareExchangeValue, error)

func (*ClusterTransactionOperations) GetCompareExchangeValuesWithKeys

func (cto *ClusterTransactionOperations) GetCompareExchangeValuesWithKeys(clazz reflect.Type, keys []string) (map[string]*CompareExchangeValue, error)

func (*ClusterTransactionOperations) GetNumberOfTrackedCompareExchangeValues

func (cto *ClusterTransactionOperations) GetNumberOfTrackedCompareExchangeValues() int

func (*ClusterTransactionOperations) IsTracked

func (cto *ClusterTransactionOperations) IsTracked(key string) bool

type CmpXchg

type CmpXchg struct {
	MethodCallData
}

CmpXchg represents data for cmp xchg method

func CmpXchgValue

func CmpXchgValue(key string) *CmpXchg

CmpXchgValue returns CmpXchg for a given key

type CollectionStatistics

type CollectionStatistics struct {
	CountOfDocuments int            `json:"CountOfDocuments"`
	CountOfConflicts int            `json:"CountOfConflicts"`
	Collections      map[string]int `json:"Collections"`
}

CollectionStatistics describes collection statistics

type CollectionStats

type CollectionStats struct {
	LastProcessedDocumentEtag  int64 `json:"LastProcessedDocumentEtag"`
	LastProcessedTombstoneEtag int64 `json:"LastProcessedTombstoneEtag"`
	DocumentLag                int64 `json:"DocumentLag"`
	TombstoneLag               int64 `json:"TombstoneLag"`
}

func NewCollectionStats

func NewCollectionStats() *CollectionStats

type CommandData

type CommandData struct {
	ID           string
	Name         string
	ChangeVector *string
	Type         CommandType
}

CommandData describes common data for commands

type CommandExecutionError

type CommandExecutionError struct {
	RavenError
}

func (*CommandExecutionError) Error

func (e *CommandExecutionError) Error() string

Error makes it conform to error interface

func (*CommandExecutionError) WrappedError

func (e *CommandExecutionError) WrappedError() error

hackish way to get a wrapped error

type CommandType

type CommandType = string

using type alias for easy json serialization

type CompactDatabaseCommand

type CompactDatabaseCommand struct {
	RavenCommandBase

	Result *OperationIDResult
	// contains filtered or unexported fields
}

CompactDatabaseCommand describes "compact database" command

func NewCompactDatabaseCommand

func NewCompactDatabaseCommand(conventions *DocumentConventions, compactSettings *CompactSettings) (*CompactDatabaseCommand, error)

NewCompactDatabaseCommand returns new CompactDatabaseCommand

func (*CompactDatabaseCommand) CreateRequest

func (c *CompactDatabaseCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*CompactDatabaseCommand) SetResponse

func (c *CompactDatabaseCommand) SetResponse(response []byte, fromCache bool) error

type CompactDatabaseOperation

type CompactDatabaseOperation struct {
	Command *CompactDatabaseCommand
	// contains filtered or unexported fields
}

CompactDatabaseOperation describes "compact database" operation

func NewCompactDatabaseOperation

func NewCompactDatabaseOperation(compactSettings *CompactSettings) *CompactDatabaseOperation

NewCompactDatabaseOperation returns new CompactDatabaseOperation

func (*CompactDatabaseOperation) GetCommand

func (o *CompactDatabaseOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

GetCommand returns a command

type CompactSettings

type CompactSettings struct {
	DatabaseName string   `json:"DatabaseName"`
	Documents    bool     `json:"Documents"`
	Indexes      []string `json:"Indexes,omitempty"`
}

CompactSettings is an argument to CompactDatabaseOperation

type CompareExchangeResult

type CompareExchangeResult struct {
	Value        interface{}
	Index        int64
	IsSuccessful bool
}

CompareExchangeResult describes result of compare exchange

type CompareExchangeSessionValue

type CompareExchangeSessionValue struct {
	// contains filtered or unexported fields
}

func NewCompareExchangeSessionValue

func NewCompareExchangeSessionValue(key string, index int64, state CompareExchangeValueState) (*CompareExchangeSessionValue, error)

func NewCompareExchangeSessionValueWithValue

func NewCompareExchangeSessionValueWithValue(value *CompareExchangeValue) (*CompareExchangeSessionValue, error)

func (*CompareExchangeSessionValue) Create

func (cesv *CompareExchangeSessionValue) Create(item interface{}) (interface{}, error)

func (*CompareExchangeSessionValue) Delete

func (cesv *CompareExchangeSessionValue) Delete(index int64)

func (*CompareExchangeSessionValue) GetCommand

func (*CompareExchangeSessionValue) GetValue

func (*CompareExchangeSessionValue) UpdateState

func (cesv *CompareExchangeSessionValue) UpdateState(index int64) error

func (*CompareExchangeSessionValue) UpdateValue

func (cesv *CompareExchangeSessionValue) UpdateValue(value *CompareExchangeValue) error

type CompareExchangeValue

type CompareExchangeValue struct {
	Key          string
	Index        int64
	Value        interface{}
	ChangeVector *string
	Metadata     *MetadataAsDictionary
}

CompareExchangeValue represents value for compare exchange

func NewCompareExchangeValue

func NewCompareExchangeValue(key string, index int64, value interface{}) *CompareExchangeValue

NewCompareExchangeValue returns new CompareExchangeValue

func NewCompareExchangeValueBase

func NewCompareExchangeValueBase(key string, index int64, value interface{}, changeVector *string, dictionary *MetadataAsDictionary) *CompareExchangeValue

func (*CompareExchangeValue) GetIndex

func (cev *CompareExchangeValue) GetIndex() int64

func (*CompareExchangeValue) GetKey

func (cev *CompareExchangeValue) GetKey() string

func (*CompareExchangeValue) GetMetadata

func (cev *CompareExchangeValue) GetMetadata() *MetadataAsDictionary

func (*CompareExchangeValue) GetValue

func (cev *CompareExchangeValue) GetValue() interface{}

func (*CompareExchangeValue) HasMetadata

func (cev *CompareExchangeValue) HasMetadata() bool

func (*CompareExchangeValue) SetIndex

func (cev *CompareExchangeValue) SetIndex(index int64)

type CompareExchangeValueState

type CompareExchangeValueState = int

type CompilationError

type CompilationError struct {
	RavenError
}

func (*CompilationError) Error

func (e *CompilationError) Error() string

Error makes it conform to error interface

func (*CompilationError) WrappedError

func (e *CompilationError) WrappedError() error

hackish way to get a wrapped error

type ConcurrencyCheckMode

type ConcurrencyCheckMode int

ConcurrencyCheckMode describes concurrency check

const (
	// ConcurrencyCheckAuto is automatic optimistic concurrency check depending on UseOptimisticConcurrency setting or provided Change Vector
	ConcurrencyCheckAuto ConcurrencyCheckMode = iota
	// ConcurrencyCheckForced forces optimistic concurrency check even if UseOptimisticConcurrency is not set
	ConcurrencyCheckForced
	// ConcurrencyCheckDisabled disables optimistic concurrency check even if UseOptimisticConcurrency is set
	ConcurrencyCheckDisabled
)

type ConcurrencyError

type ConcurrencyError struct {
	RavenError

	ExpectedETag         int64
	ActualETag           int64
	ExpectedChangeVector string
	ActualChangeVector   string
}

ConcurrencyError represents concurrency error

func (*ConcurrencyError) Error

func (e *ConcurrencyError) Error() string

Error makes it conform to error interface

func (*ConcurrencyError) WrappedError

func (e *ConcurrencyError) WrappedError() error

hackish way to get a wrapped error

type ConfigureRevisionsCommand

type ConfigureRevisionsCommand struct {
	RavenCommandBase

	Result *ConfigureRevisionsOperationResult
	// contains filtered or unexported fields
}

ConfigureRevisionsCommand represents configure revisions command

func NewConfigureRevisionsCommand

func NewConfigureRevisionsCommand(configuration *RevisionsConfiguration) *ConfigureRevisionsCommand

NewConfigureRevisionsCommand returns new ConfigureRevisionsCommand

func (*ConfigureRevisionsCommand) CreateRequest

func (c *ConfigureRevisionsCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*ConfigureRevisionsCommand) SetResponse

func (c *ConfigureRevisionsCommand) SetResponse(response []byte, fromCache bool) error

type ConfigureRevisionsOperation

type ConfigureRevisionsOperation struct {
	Command *ConfigureRevisionsCommand
	// contains filtered or unexported fields
}

ConfigureRevisionsOperation represents configure revisions operation

func NewConfigureRevisionsOperation

func NewConfigureRevisionsOperation(configuration *RevisionsConfiguration) *ConfigureRevisionsOperation

NewConfigureRevisionsOperation returns new ConfigureRevisionsOperation

func (*ConfigureRevisionsOperation) GetCommand

func (o *ConfigureRevisionsOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

GetCommand returns new RavenCommand for this operation

type ConfigureRevisionsOperationResult

type ConfigureRevisionsOperationResult struct {
	RaftCommandIndex int64 `json:"RaftCommandIndex"`
}

ConfigureRevisionsOperationResult represents result of configure revisions operation

type Conflict

type Conflict struct {
	LastModified Time                   `json:"LastModified"`
	ChangeVector string                 `json:"ChangeVector"`
	Doc          map[string]interface{} `json:"Doc"`
}

Conflict represents conflict

type ConflictError

type ConflictError struct {
	RavenError
}

ConflictError maps to server's 409 Conflict response

func (*ConflictError) Error

func (e *ConflictError) Error() string

Error makes it conform to error interface

func (*ConflictError) WrappedError

func (e *ConflictError) WrappedError() error

hackish way to get a wrapped error

type ConflictSolver

type ConflictSolver struct {
	ResolveByCollection map[string]*ScriptResolver `json:"ResolveByCollection"`
	ResolveToLatest     bool                       `json:"ResolveToLatest"`
}

ConflictSolver describes how to resolve conflicts

type ConnectionString

type ConnectionString struct {
	Name string `json:"Name"`
	// Note: Java has this as a virtual function getType()
	Type ConnectionStringType `json:"Type"`
}

ConnectionString represents connection string used as argument to PutConnectionStringCommand

type ConnectionStringType

type ConnectionStringType = string

TODO: only used in ConnectionString which is unused

type CreateDatabaseCommand

type CreateDatabaseCommand struct {
	RavenCommandBase

	Result *DatabasePutResult
	// contains filtered or unexported fields
}

CreateDatabaseCommand represents "create database" command

func NewCreateDatabaseCommand

func NewCreateDatabaseCommand(conventions *DocumentConventions, databaseRecord *DatabaseRecord, replicationFactor int) (*CreateDatabaseCommand, error)

NewCreateDatabaseCommand returns new CreateDatabaseCommand

func (*CreateDatabaseCommand) CreateRequest

func (c *CreateDatabaseCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*CreateDatabaseCommand) SetResponse

func (c *CreateDatabaseCommand) SetResponse(response []byte, fromCache bool) error

type CreateDatabaseOperation

type CreateDatabaseOperation struct {
	// contains filtered or unexported fields
}

CreateDatabaseOperation represents "create database" operation

func NewCreateDatabaseOperation

func NewCreateDatabaseOperation(databaseRecord *DatabaseRecord, replicationFactor int) *CreateDatabaseOperation

NewCreateDatabaseOperation returns CreateDatabaseOperation

func (*CreateDatabaseOperation) GetCommand

func (o *CreateDatabaseOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

GetCommand returns command for this operation

type CreateSampleDataCommand

type CreateSampleDataCommand struct {
	RavenCommandBase
}

CreateSampleDataCommand represents command for creating sample data

func NewCreateSampleDataCommand

func NewCreateSampleDataCommand(conventions *DocumentConventions) *CreateSampleDataCommand

NewCreateSampleDataCommand returns new CreateSampleDataCommand

func (*CreateSampleDataCommand) CreateRequest

func (c *CreateSampleDataCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type CreateSampleDataOperation

type CreateSampleDataOperation struct {
	Command *CreateSampleDataCommand
}

CreateSampleDataOperation represents operation to create sample data

func NewCreateSampleDataOperation

func NewCreateSampleDataOperation() *CreateSampleDataOperation

NewCreateSampleDataOperation

func (*CreateSampleDataOperation) GetCommand

func (o *CreateSampleDataOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

GetCommand returns a comman

type CreateSubscriptionCommand

type CreateSubscriptionCommand struct {
	RavenCommandBase

	Result *CreateSubscriptionResult
	// contains filtered or unexported fields
}

CreateSubscriptionCommand represents "create subscription" command

func (*CreateSubscriptionCommand) CreateRequest

func (c *CreateSubscriptionCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*CreateSubscriptionCommand) SetResponse

func (c *CreateSubscriptionCommand) SetResponse(response []byte, fromCache bool) error

type CreateSubscriptionResult

type CreateSubscriptionResult struct {
	Name string `json:"Name"`
}

CreateSubscriptionResult represents result for "create subscription" command

type CurrentIndexAndNode

type CurrentIndexAndNode struct {
	// contains filtered or unexported fields
}

func NewCurrentIndexAndNode

func NewCurrentIndexAndNode(currentIndex int, currentNode *ServerNode) *CurrentIndexAndNode

type DatabaseChanges

type DatabaseChanges struct {
	// contains filtered or unexported fields
}

DatabaseChanges notifies about changes to a database

func (*DatabaseChanges) AddConnectionStatusChanged

func (c *DatabaseChanges) AddConnectionStatusChanged(handler func()) int

func (*DatabaseChanges) AddOnError

func (c *DatabaseChanges) AddOnError(handler func(error)) int

func (*DatabaseChanges) Close

func (c *DatabaseChanges) Close()

Close closes DatabaseChanges and release its resources

func (*DatabaseChanges) EnsureConnectedNow

func (c *DatabaseChanges) EnsureConnectedNow() error

func (*DatabaseChanges) ForAllDocuments

func (c *DatabaseChanges) ForAllDocuments(cb func(*DocumentChange)) (CancelFunc, error)

ForAllDocuments registers a callback that will be called for changes on all documents. It returns a function to call to unregister the callback.

func (*DatabaseChanges) ForAllIndexes

func (c *DatabaseChanges) ForAllIndexes(cb func(*IndexChange)) (CancelFunc, error)

ForAllIndexes registers a callback that will be called when a change on any index happens. It returns a function to call to unregister the callback.

func (*DatabaseChanges) ForAllOperations

func (c *DatabaseChanges) ForAllOperations(cb func(change *OperationStatusChange)) (CancelFunc, error)

ForAllOperations registers a callback that will be called when any operation changes status. It returns a function to call to unregister the callback.

func (*DatabaseChanges) ForDocument

func (c *DatabaseChanges) ForDocument(docID string, cb func(*DocumentChange)) (CancelFunc, error)

ForDocument registers a callback that will be called for changes on a ocument with a given id It returns a function to call to unregister the callback.

func (*DatabaseChanges) ForDocumentsInCollection

func (c *DatabaseChanges) ForDocumentsInCollection(collectionName string, cb func(*DocumentChange)) (CancelFunc, error)

ForDocumentsInCollection registers a callback that will be called on changes for documents in a given collection. It returns a function to call to unregister the callback.

func (*DatabaseChanges) ForDocumentsInCollectionOfType

func (c *DatabaseChanges) ForDocumentsInCollectionOfType(clazz reflect.Type, cb func(*DocumentChange)) (CancelFunc, error)

ForDocumentsInCollectionOfType registers a callback that will be called on changes for documents of a given type. It returns a function to call to unregister the callback.

func (*DatabaseChanges) ForDocumentsStartingWith

func (c *DatabaseChanges) ForDocumentsStartingWith(docIDPrefix string, cb func(*DocumentChange)) (CancelFunc, error)

ForDocumentsStartingWith registers a callback that will be called for changes on documents whose id starts with a given prefix. It returns a function to call to unregister the callback.

func (*DatabaseChanges) ForIndex

func (c *DatabaseChanges) ForIndex(indexName string, cb func(*IndexChange)) (CancelFunc, error)

ForIndex registers a callback that will be called for changes in an index with a given name. It returns a function to call to unregister the callback.

func (*DatabaseChanges) ForOperationID

func (c *DatabaseChanges) ForOperationID(operationID int64, cb func(*OperationStatusChange)) (CancelFunc, error)

ForOperationID registers a callback that will be called when a change happens to operation with a given id. It returns a function to call to unregister the callback.

func (*DatabaseChanges) RemoveConnectionStatusChanged

func (c *DatabaseChanges) RemoveConnectionStatusChanged(handlerID int)

func (*DatabaseChanges) RemoveOnError

func (c *DatabaseChanges) RemoveOnError(handlerID int)

type DatabaseConcurrentLoadTimeoutError

type DatabaseConcurrentLoadTimeoutError struct {
	RavenError
}

func (*DatabaseConcurrentLoadTimeoutError) Error

func (e *DatabaseConcurrentLoadTimeoutError) Error() string

Error makes it conform to error interface

func (*DatabaseConcurrentLoadTimeoutError) WrappedError

func (e *DatabaseConcurrentLoadTimeoutError) WrappedError() error

hackish way to get a wrapped error

type DatabaseDisabledError

type DatabaseDisabledError struct {
	RavenError
}

func (*DatabaseDisabledError) Error

func (e *DatabaseDisabledError) Error() string

Error makes it conform to error interface

func (*DatabaseDisabledError) WrappedError

func (e *DatabaseDisabledError) WrappedError() error

hackish way to get a wrapped error

type DatabaseDoesNotExistError

type DatabaseDoesNotExistError struct {
	RavenError
}

DatabaseDoesNotExistError represents "database not not exist" error

func (*DatabaseDoesNotExistError) Error

func (e *DatabaseDoesNotExistError) Error() string

Error makes it conform to error interface

func (*DatabaseDoesNotExistError) WrappedError

func (e *DatabaseDoesNotExistError) WrappedError() error

hackish way to get a wrapped error

type DatabaseLoadFailureError

type DatabaseLoadFailureError struct {
	RavenError
}

func (*DatabaseLoadFailureError) Error

func (e *DatabaseLoadFailureError) Error() string

Error makes it conform to error interface

func (*DatabaseLoadFailureError) WrappedError

func (e *DatabaseLoadFailureError) WrappedError() error

hackish way to get a wrapped error

type DatabaseLoadTimeoutError

type DatabaseLoadTimeoutError struct {
	RavenError
}

func (*DatabaseLoadTimeoutError) Error

func (e *DatabaseLoadTimeoutError) Error() string

Error makes it conform to error interface

func (*DatabaseLoadTimeoutError) WrappedError

func (e *DatabaseLoadTimeoutError) WrappedError() error

hackish way to get a wrapped error

type DatabaseNotRelevantError

type DatabaseNotRelevantError struct {
	RavenError
}

func (*DatabaseNotRelevantError) Error

func (e *DatabaseNotRelevantError) Error() string

Error makes it conform to error interface

func (*DatabaseNotRelevantError) WrappedError

func (e *DatabaseNotRelevantError) WrappedError() error

hackish way to get a wrapped error

type DatabasePromotionStatus

type DatabasePromotionStatus = string

type DatabasePutResult

type DatabasePutResult struct {
	RaftCommandIndex int64    `json:"RaftCommandIndex"`
	Name             string   `json:"Name"`
	DatabaseTopology Topology `json:"Topology"`
	NodesAddedTo     []string `json:"NodesAddedTo"`
}

DatabasePutResult describes server response for e.g. CreateDatabaseCommand

type DatabaseRecord

type DatabaseRecord struct {
	DatabaseName         string            `json:"DatabaseName"`
	Disabled             bool              `json:"Disabled"`
	DataDirectory        string            `json:"DataDirectory,omitempty"`
	Settings             map[string]string `json:"Settings"`
	ConflictSolverConfig *ConflictSolver   `json:"ConflictSolverConfig"`
	Encrypted            bool              `json:"Encrypted"`
	DatabaseTopology     *DatabaseTopology `json:"DatabaseTopology"`
}

DatabaseRecord represents database record

func NewDatabaseRecord

func NewDatabaseRecord() *DatabaseRecord

NewDatabaseRecord returns new database record

type DatabaseRecordWithEtag

type DatabaseRecordWithEtag struct {
	DatabaseRecord
	Etag int64 `json:"Etag"`
}

DatabaseRecordWithEtag represents database record with etag

type DatabaseStatistics

type DatabaseStatistics struct {
	LastDocEtag               int64 `json:"LastDocEtag"`
	CountOfIndexes            int   `json:"CountOfIndexes"`
	CountOfDocuments          int64 `json:"CountOfDocuments"`
	CountOfRevisionDocuments  int64 `json:"CountOfRevisionDocuments"` // TODO: present in Java, not seen in JSON
	CountOfDocumentsConflicts int64 `json:"CountOfDocumentsConflicts"`
	CountOfTombstones         int64 `json:"CountOfTombstones"`
	CountOfConflicts          int64 `json:"CountOfConflicts"`
	CountOfAttachments        int64 `json:"CountOfAttachments"`
	CountOfUniqueAttachments  int64 `json:"CountOfUniqueAttachments"`

	Indexes []*IndexInformation `json:"Indexes"`

	DatabaseChangeVector                     string `json:"DatabaseChangeVector"`
	DatabaseID                               string `json:"DatabaseId"`
	Is64Bit                                  bool   `json:"Is64Bit"`
	Pager                                    string `json:"Pager"`
	LastIndexingTime                         *Time  `json:"LastIndexingTime"`
	SizeOnDisk                               *Size  `json:"SizeOnDisk"`
	TempBuffersSizeOnDisk                    *Size  `json:"TempBuffersSizeOnDisk"`
	NumberOfTransactionMergerQueueOperations int    `json:"NumberOfTransactionMergerQueueOperations"`
}

DatabaseStatistics describes a result of GetStatisticsCommand

func (*DatabaseStatistics) GetLastIndexingTime

func (s *DatabaseStatistics) GetLastIndexingTime() *time.Time

GetLastIndexingTime returns last indexing time

type DatabaseTopology

type DatabaseTopology struct {
	Members                  []string          `json:"Members"`
	Promotables              []string          `json:"Promotables"`
	Rehabs                   []string          `json:"Rehabs"`
	PredefinedMentors        map[string]string `json:"PredefinedMentors"`
	DemotionReasons          map[string]string `json:"DemotionReasons"`
	PromotablesStatus        map[string]string `json:"PromotablesStatus"`
	ReplicationFactor        int               `json:"ReplicationFactor"`
	DynamicNodesDistribution bool              `json:"DynamicNodesDistribution"`
	Stamp                    LeaderStamp       `json:"Stamp"`
}

DatabaseTopology describes a topology of the database

type DeleteAttachmentCommand

type DeleteAttachmentCommand struct {
	RavenCommandBase
	// contains filtered or unexported fields
}

func NewDeleteAttachmentCommand

func NewDeleteAttachmentCommand(documentID string, name string, changeVector *string) (*DeleteAttachmentCommand, error)

func (*DeleteAttachmentCommand) CreateRequest

func (c *DeleteAttachmentCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type DeleteAttachmentCommandData

type DeleteAttachmentCommandData struct {
	*CommandData
}

func NewDeleteAttachmentCommandData

func NewDeleteAttachmentCommandData(documentID string, name string, changeVector *string) (*DeleteAttachmentCommandData, error)

NewDeleteAttachmentCommandData creates CommandData for Delete Attachment command

type DeleteAttachmentOperation

type DeleteAttachmentOperation struct {
	Command *DeleteAttachmentCommand
	// contains filtered or unexported fields
}

func NewDeleteAttachmentOperation

func NewDeleteAttachmentOperation(documentID string, name string, changeVector *string) *DeleteAttachmentOperation

func (*DeleteAttachmentOperation) GetCommand

func (o *DeleteAttachmentOperation) GetCommand(store *DocumentStore, conventions *DocumentConventions, cache *httpCache) (RavenCommand, error)

type DeleteByIndexCommand

type DeleteByIndexCommand struct {
	RavenCommandBase

	Result *OperationIDResult
	// contains filtered or unexported fields
}

func NewDeleteByIndexCommand

func NewDeleteByIndexCommand(conventions *DocumentConventions, queryToDelete *IndexQuery, options *QueryOperationOptions) (*DeleteByIndexCommand, error)

func (*DeleteByIndexCommand) CreateRequest

func (c *DeleteByIndexCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*DeleteByIndexCommand) SetResponse

func (c *DeleteByIndexCommand) SetResponse(response []byte, fromCache bool) error

type DeleteByQueryOperation

type DeleteByQueryOperation struct {
	Command *DeleteByIndexCommand
	// contains filtered or unexported fields
}

func NewDeleteByQueryOperation

func NewDeleteByQueryOperation(queryToDelete *IndexQuery, options *QueryOperationOptions) (*DeleteByQueryOperation, error)

func (*DeleteByQueryOperation) GetCommand

func (o *DeleteByQueryOperation) GetCommand(store *DocumentStore, conventions *DocumentConventions, cache *httpCache) (RavenCommand, error)

type DeleteCommandData

type DeleteCommandData struct {
	CommandData
}

DeleteCommandData represents data for delete command

type DeleteCompareExchangeCommandData

type DeleteCompareExchangeCommandData struct {
	*CommandData
	Index int64
}

type DeleteCompareExchangeValueOperation

type DeleteCompareExchangeValueOperation struct {
	Command *RemoveCompareExchangeValueCommand
	// contains filtered or unexported fields
}

func NewDeleteCompareExchangeValueOperation

func NewDeleteCompareExchangeValueOperation(clazz reflect.Type, key string, index int64) (*DeleteCompareExchangeValueOperation, error)

func (*DeleteCompareExchangeValueOperation) GetCommand

func (o *DeleteCompareExchangeValueOperation) GetCommand(store *DocumentStore, conventions *DocumentConventions, cache *httpCache) (RavenCommand, error)

type DeleteDatabaseCommand

type DeleteDatabaseCommand struct {
	RavenCommandBase

	Result *DeleteDatabaseResult
	// contains filtered or unexported fields
}

func NewDeleteDatabaseCommand

func NewDeleteDatabaseCommand(conventions *DocumentConventions, parameters *DeleteDatabaseParameters) (*DeleteDatabaseCommand, error)

func (*DeleteDatabaseCommand) CreateRequest

func (c *DeleteDatabaseCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*DeleteDatabaseCommand) SetResponse

func (c *DeleteDatabaseCommand) SetResponse(response []byte, fromCache bool) error

type DeleteDatabaseParameters

type DeleteDatabaseParameters struct {
	DatabaseNames             []string       `json:"DatabaseNames"`
	HardDelete                bool           `json:"HardDelete"`
	FromNodes                 []string       `json:"FromNodes"`
	TimeToWaitForConfirmation *time.Duration `json:"TimeToWaitForConfirmation"`
}

type DeleteDatabaseResult

type DeleteDatabaseResult struct {
	RaftCommandIndex int64    `json:"RaftCommandIndex"`
	PendingDeletes   []string `json:"PendingDeletes"`
}

DeleteDatabaseResult represents result of Delete Database command

type DeleteDatabasesOperation

type DeleteDatabasesOperation struct {
	Command *DeleteDatabaseCommand
	// contains filtered or unexported fields
}

func NewDeleteDatabasesOperation

func NewDeleteDatabasesOperation(databaseName string, hardDelete bool) *DeleteDatabasesOperation

func NewDeleteDatabasesOperation2

func NewDeleteDatabasesOperation2(databaseName string, hardDelete bool, fromNode string, timeToWaitForConfirmation time.Duration) *DeleteDatabasesOperation

func NewDeleteDatabasesOperationWithParameters

func NewDeleteDatabasesOperationWithParameters(parameters *DeleteDatabaseParameters) *DeleteDatabasesOperation

func (*DeleteDatabasesOperation) GetCommand

func (o *DeleteDatabasesOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type DeleteDocumentCommand

type DeleteDocumentCommand struct {
	RavenCommandBase
	// contains filtered or unexported fields
}

func NewDeleteDocumentCommand

func NewDeleteDocumentCommand(id string, changeVector *string) *DeleteDocumentCommand

func (*DeleteDocumentCommand) CreateRequest

func (c *DeleteDocumentCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type DeleteIndexCommand

type DeleteIndexCommand struct {
	RavenCommandBase
	// contains filtered or unexported fields
}

func NewDeleteIndexCommand

func NewDeleteIndexCommand(indexName string) (*DeleteIndexCommand, error)

func (*DeleteIndexCommand) CreateRequest

func (c *DeleteIndexCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type DeleteIndexOperation

type DeleteIndexOperation struct {
	Command *DeleteIndexCommand
	// contains filtered or unexported fields
}

func NewDeleteIndexOperation

func NewDeleteIndexOperation(indexName string) *DeleteIndexOperation

func (*DeleteIndexOperation) GetCommand

func (o *DeleteIndexOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type DeleteSubscriptionCommand

type DeleteSubscriptionCommand struct {
	RavenCommandBase
	// contains filtered or unexported fields
}

DeleteSubscriptionCommand describes "delete subscription" command

func (*DeleteSubscriptionCommand) CreateRequest

func (c *DeleteSubscriptionCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type DisableIndexCommand

type DisableIndexCommand struct {
	RavenCommandBase
	// contains filtered or unexported fields
}

func NewDisableIndexCommand

func NewDisableIndexCommand(indexName string) (*DisableIndexCommand, error)

func (*DisableIndexCommand) CreateRequest

func (c *DisableIndexCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type DisableIndexOperation

type DisableIndexOperation struct {
	Command *DisableIndexCommand
	// contains filtered or unexported fields
}

func NewDisableIndexOperation

func NewDisableIndexOperation(indexName string) (*DisableIndexOperation, error)

func (*DisableIndexOperation) GetCommand

func (o *DisableIndexOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type DocumentChange

type DocumentChange struct {
	Type           DocumentChangeTypes
	ID             string
	CollectionName string
	ChangeVector   *string
}

DocumentChange describes a change to the document. Can be used as DatabaseChange.

func (*DocumentChange) String

func (c *DocumentChange) String() string

type DocumentChangeTypes

type DocumentChangeTypes = string

type DocumentConflictError

type DocumentConflictError struct {
	ConflictError
	DocID       string
	LargestEtag int64
}

DocumentConflictError represents document conflict error from the server

func (*DocumentConflictError) Error

func (e *DocumentConflictError) Error() string

Error makes it conform to error interface

func (*DocumentConflictError) WrappedError

func (e *DocumentConflictError) WrappedError() error

hackish way to get a wrapped error

type DocumentConventions

type DocumentConventions struct {
	MaxNumberOfRequestsPerSession int
	// timeout for wait to server
	Timeout                  time.Duration
	UseOptimisticConcurrency bool
	// JsonDefaultMethod = DocumentConventions.json_default
	MaxLengthOfQueryUsingGetURL int
	IdentityPartsSeparator      string

	// If set to 'true' then it will return an error when any query is performed (in session)
	// without explicit page size set
	RaiseIfQueryPageSizeIsNotSet bool // TODO: rename to ErrorIfQueryPageSizeIsNotSet

	// allows overriding entity -> collection name logic
	FindCollectionName func(interface{}) string

	ReadBalanceBehavior ReadBalanceBehavior

	// if true, will return error if page size is not set
	ErrorIfQueryPageSizeIsNotSet bool
	// contains filtered or unexported fields
}

DocumentConventions describes document conventions

func NewDocumentConventions

func NewDocumentConventions() *DocumentConventions

NewDocumentConventions creates DocumentConventions with default values

func (*DocumentConventions) Clone

func (*DocumentConventions) Freeze

func (c *DocumentConventions) Freeze()

func (*DocumentConventions) GenerateDocumentID

func (c *DocumentConventions) GenerateDocumentID(databaseName string, entity interface{}) (string, error)

Generates the document id.

func (*DocumentConventions) GetDocumentIDGenerator

func (c *DocumentConventions) GetDocumentIDGenerator() DocumentIDGeneratorFunc

func (*DocumentConventions) GetIdentityPartsSeparator

func (c *DocumentConventions) GetIdentityPartsSeparator() string

func (*DocumentConventions) GetIdentityProperty

func (c *DocumentConventions) GetIdentityProperty(clazz reflect.Type) string

returns "" if no identity property

func (*DocumentConventions) GetTransformClassCollectionNameToDocumentIdPrefix

func (c *DocumentConventions) GetTransformClassCollectionNameToDocumentIdPrefix() func(string) string

func (*DocumentConventions) IsDisableTopologyUpdates

func (c *DocumentConventions) IsDisableTopologyUpdates() bool

func (*DocumentConventions) SetDisableTopologyUpdates

func (c *DocumentConventions) SetDisableTopologyUpdates(disable bool)

func (*DocumentConventions) SetDocumentIDGenerator

func (c *DocumentConventions) SetDocumentIDGenerator(documentIDGenerator DocumentIDGeneratorFunc)

func (*DocumentConventions) TryConvertValueForQuery

func (c *DocumentConventions) TryConvertValueForQuery(fieldName string, value interface{}, forRange bool, stringValue *string) bool

func (*DocumentConventions) UpdateFrom

func (c *DocumentConventions) UpdateFrom(configuration *ClientConfiguration)

type DocumentDoesNotExistError

type DocumentDoesNotExistError struct {
	RavenError
}

func (*DocumentDoesNotExistError) Error

func (e *DocumentDoesNotExistError) Error() string

Error makes it conform to error interface

func (*DocumentDoesNotExistError) WrappedError

func (e *DocumentDoesNotExistError) WrappedError() error

hackish way to get a wrapped error

type DocumentIDGeneratorFunc

type DocumentIDGeneratorFunc func(dbName string, entity interface{}) (string, error)

type DocumentQuery

type DocumentQuery struct {
	// contains filtered or unexported fields
}

DocumentQuery describes a query

func (*DocumentQuery) AddBeforeQueryExecutedListener

func (q *DocumentQuery) AddBeforeQueryExecutedListener(action func(*IndexQuery)) int

AddBeforeQueryExecutedListener adds a listener that will be called before query is executed

func (*DocumentQuery) AddOrder

func (q *DocumentQuery) AddOrder(fieldName string, descending bool) *DocumentQuery

func (*DocumentQuery) AddOrderWithOrdering

func (q *DocumentQuery) AddOrderWithOrdering(fieldName string, descending bool, ordering OrderingType) *DocumentQuery

func (*DocumentQuery) AddParameter

func (q *DocumentQuery) AddParameter(name string, value interface{}) *DocumentQuery

func (*DocumentQuery) AggregateByFacet

func (q *DocumentQuery) AggregateByFacet(facet FacetBase) *AggregationDocumentQuery

AggregateByFacet aggregates the query by a facet

func (*DocumentQuery) AggregateByFacets

func (q *DocumentQuery) AggregateByFacets(facets ...*Facet) *AggregationDocumentQuery

AggregateByFacets aggregates the query by facets

func (*DocumentQuery) AggregateUsing

func (q *DocumentQuery) AggregateUsing(facetSetupDocumentID string) *AggregationDocumentQuery

AggregateUsing aggregates the query by facet setup

func (*DocumentQuery) AndAlso

func (q *DocumentQuery) AndAlso() *DocumentQuery

func (DocumentQuery) Any

func (q DocumentQuery) Any() (bool, error)

Any returns true if query returns at least one result

func (*DocumentQuery) Boost

func (q *DocumentQuery) Boost(boost float64) *DocumentQuery

func (*DocumentQuery) CloseSubclause

func (q *DocumentQuery) CloseSubclause() *DocumentQuery

CloseSubclause closes a query sub-clause

func (*DocumentQuery) ContainsAll

func (q *DocumentQuery) ContainsAll(fieldName string, values []interface{}) *DocumentQuery

func (*DocumentQuery) ContainsAny

func (q *DocumentQuery) ContainsAny(fieldName string, values []interface{}) *DocumentQuery

func (DocumentQuery) Count

func (q DocumentQuery) Count() (int, error)

func (DocumentQuery) CountLazily

func (q DocumentQuery) CountLazily() (*Lazy, error)

CountLazily returns a lazy operation that returns number of results in a query. It'll set *count to number of results after Lazy.GetResult() is called. results should be of type []<type> and is only provided so that we know this is a query for <type> TODO: figure out better API.

func (*DocumentQuery) Distinct

func (q *DocumentQuery) Distinct() *DocumentQuery

Distinct marks query as distinct

func (DocumentQuery) Err

func (q DocumentQuery) Err() error

func (*DocumentQuery) Exact

func (q *DocumentQuery) Exact() *DocumentQuery

Exact marks previous Where statement (e.g. WhereEquals or WhereLucene) as exact

func (DocumentQuery) First

func (q DocumentQuery) First(result interface{}) error

First runs a query and returns a first result.

func (*DocumentQuery) Fuzzy

func (q *DocumentQuery) Fuzzy(fuzzy float64) *DocumentQuery

func (DocumentQuery) GetIndexQuery

func (q DocumentQuery) GetIndexQuery() (*IndexQuery, error)

func (DocumentQuery) GetResults

func (q DocumentQuery) GetResults(results interface{}) error

GetResults executes the query and sets results to returned values. results should be of type *[]<type>

func (*DocumentQuery) GroupBy

func (q *DocumentQuery) GroupBy(fieldName string, fieldNames ...string) *GroupByDocumentQuery

GroupBy makes a query grouped by fields

func (*DocumentQuery) GroupByFieldWithMethod

func (q *DocumentQuery) GroupByFieldWithMethod(field *GroupBy, fields ...*GroupBy) *GroupByDocumentQuery

GroupByFieldWithMethod makes a query grouped by fields and also allows specifying method of grouping for each field

func (*DocumentQuery) Include

func (q *DocumentQuery) Include(path string) *DocumentQuery

func (*DocumentQuery) Intersect

func (q *DocumentQuery) Intersect() *DocumentQuery

func (DocumentQuery) Lazily

func (q DocumentQuery) Lazily() (*Lazy, error)

func (*DocumentQuery) MoreLikeThis

func (q *DocumentQuery) MoreLikeThis(moreLikeThis MoreLikeThisBase) *DocumentQuery

func (*DocumentQuery) MoreLikeThisWithBuilder

func (q *DocumentQuery) MoreLikeThisWithBuilder(builder func(IMoreLikeThisBuilderForDocumentQuery)) *DocumentQuery

func (*DocumentQuery) NoCaching

func (q *DocumentQuery) NoCaching() *DocumentQuery

func (*DocumentQuery) NoTracking

func (q *DocumentQuery) NoTracking() *DocumentQuery

func (*DocumentQuery) Not

func (q *DocumentQuery) Not() *DocumentQuery

func (*DocumentQuery) OpenSubclause

func (q *DocumentQuery) OpenSubclause() *DocumentQuery

OpenSubclause opens a query sub-clause

func (*DocumentQuery) OrElse

func (q *DocumentQuery) OrElse() *DocumentQuery

func (*DocumentQuery) OrderBy

func (q *DocumentQuery) OrderBy(field string) *DocumentQuery

OrderBy orders query results by a field

func (*DocumentQuery) OrderByDescending

func (q *DocumentQuery) OrderByDescending(field string) *DocumentQuery

OrderByDescending orders query by a field in descending order

func (*DocumentQuery) OrderByDescendingWithOrdering

func (q *DocumentQuery) OrderByDescendingWithOrdering(field string, ordering OrderingType) *DocumentQuery

OrderByDescendingWithOrdering orders query by ordering in descending order

func (*DocumentQuery) OrderByDistanceDescendingLatLong

func (q *DocumentQuery) OrderByDistanceDescendingLatLong(fieldName string, latitude float64, longitude float64) *DocumentQuery

func (*DocumentQuery) OrderByDistanceDescendingLatLongDynamic

func (q *DocumentQuery) OrderByDistanceDescendingLatLongDynamic(field DynamicSpatialField, latitude float64, longitude float64) *DocumentQuery

func (*DocumentQuery) OrderByDistanceDescendingWkt

func (q *DocumentQuery) OrderByDistanceDescendingWkt(fieldName string, shapeWkt string) *DocumentQuery

func (*DocumentQuery) OrderByDistanceDescendingWktDynamic

func (q *DocumentQuery) OrderByDistanceDescendingWktDynamic(field DynamicSpatialField, shapeWkt string) *DocumentQuery

func (*DocumentQuery) OrderByDistanceLatLong

func (q *DocumentQuery) OrderByDistanceLatLong(fieldName string, latitude float64, longitude float64) *DocumentQuery

func (*DocumentQuery) OrderByDistanceLatLongDynamic

func (q *DocumentQuery) OrderByDistanceLatLongDynamic(field DynamicSpatialField, latitude float64, longitude float64) *DocumentQuery

OrderByDistanceLatLongDynamic orders a given field by lat / long

func (*DocumentQuery) OrderByDistanceWkt

func (q *DocumentQuery) OrderByDistanceWkt(fieldName string, shapeWkt string) *DocumentQuery

func (*DocumentQuery) OrderByDistanceWktDynamic

func (q *DocumentQuery) OrderByDistanceWktDynamic(field DynamicSpatialField, shapeWkt string) *DocumentQuery

func (*DocumentQuery) OrderByScore

func (q *DocumentQuery) OrderByScore() *DocumentQuery

OrderByScore orders results of the query by score

func (*DocumentQuery) OrderByScoreDescending

func (q *DocumentQuery) OrderByScoreDescending() *DocumentQuery

OrderByScoreDescending orders results of the query by score in descending order

func (*DocumentQuery) OrderByWithOrdering

func (q *DocumentQuery) OrderByWithOrdering(field string, ordering OrderingType) *DocumentQuery

OrderByWithOrdering orders query results by ordering

func (*DocumentQuery) Proximity

func (q *DocumentQuery) Proximity(proximity int) *DocumentQuery

func (*DocumentQuery) RandomOrdering

func (q *DocumentQuery) RandomOrdering() *DocumentQuery

func (*DocumentQuery) RandomOrderingWithSeed

func (q *DocumentQuery) RandomOrderingWithSeed(seed string) *DocumentQuery

func (*DocumentQuery) RelatesToShape

func (q *DocumentQuery) RelatesToShape(fieldName string, shapeWkt string, relation SpatialRelation) *DocumentQuery

func (*DocumentQuery) RelatesToShapeWithError

func (q *DocumentQuery) RelatesToShapeWithError(fieldName string, shapeWkt string, relation SpatialRelation, distanceErrorPct float64) *DocumentQuery

func (*DocumentQuery) RemoveBeforeQueryExecutedListener

func (q *DocumentQuery) RemoveBeforeQueryExecutedListener(idx int) *DocumentQuery

RemoveBeforeQueryExecutedListener removes a listener registered with AddBeforeQueryExecutedListener

func (*DocumentQuery) Search

func (q *DocumentQuery) Search(fieldName string, searchTerms string) *DocumentQuery

func (*DocumentQuery) SearchWithOperator

func (q *DocumentQuery) SearchWithOperator(fieldName string, searchTerms string, operator SearchOperator) *DocumentQuery

func (*DocumentQuery) SelectFields

func (q *DocumentQuery) SelectFields(projectionType reflect.Type, fieldsIn ...string) *DocumentQuery

SelectFields limits the returned values to one or more fields of the queried type.

func (*DocumentQuery) SelectFieldsWithQueryData

func (q *DocumentQuery) SelectFieldsWithQueryData(projectionType reflect.Type, queryData *QueryData) *DocumentQuery

SelectFieldsWithQueryData limits the returned values to one or more fields of the queried type.

func (DocumentQuery) Single

func (q DocumentQuery) Single(result interface{}) error

Single runs a query that expects only a single result. If there is more than one result, it returns IllegalStateError.

func (*DocumentQuery) Skip

func (q *DocumentQuery) Skip(count int) *DocumentQuery

func (*DocumentQuery) Spatial2

func (*DocumentQuery) Spatial3

func (q *DocumentQuery) Spatial3(fieldName string, clause func(*SpatialCriteriaFactory) SpatialCriteria) *DocumentQuery

func (*DocumentQuery) Statistics

func (q *DocumentQuery) Statistics(stats **QueryStatistics) *DocumentQuery

func (*DocumentQuery) SuggestUsing

func (q *DocumentQuery) SuggestUsing(suggestion SuggestionBase) *SuggestionDocumentQuery

func (*DocumentQuery) Take

func (q *DocumentQuery) Take(count int) *DocumentQuery

func (*DocumentQuery) UsingDefaultOperator

func (q *DocumentQuery) UsingDefaultOperator(queryOperator QueryOperator) *DocumentQuery

func (*DocumentQuery) WaitForNonStaleResults

func (q *DocumentQuery) WaitForNonStaleResults(waitTimeout time.Duration) *DocumentQuery

WaitForNonStaleResults waits for non-stale results for a given waitTimeout. Timeout of 0 means default timeout.

func (*DocumentQuery) Where

func (q *DocumentQuery) Where(fieldName string, op string, value interface{}) *DocumentQuery

func (*DocumentQuery) WhereBetween

func (q *DocumentQuery) WhereBetween(fieldName string, start interface{}, end interface{}) *DocumentQuery

func (*DocumentQuery) WhereEndsWith

func (q *DocumentQuery) WhereEndsWith(fieldName string, value interface{}) *DocumentQuery

func (*DocumentQuery) WhereEquals

func (q *DocumentQuery) WhereEquals(fieldName string, value interface{}) *DocumentQuery

func (*DocumentQuery) WhereEqualsWithMethodCall

func (q *DocumentQuery) WhereEqualsWithMethodCall(fieldName string, method MethodCall) *DocumentQuery

func (*DocumentQuery) WhereEqualsWithParams

func (q *DocumentQuery) WhereEqualsWithParams(whereParams *whereParams) *DocumentQuery

func (*DocumentQuery) WhereExists

func (q *DocumentQuery) WhereExists(fieldName string) *DocumentQuery

func (*DocumentQuery) WhereGreaterThan

func (q *DocumentQuery) WhereGreaterThan(fieldName string, value interface{}) *DocumentQuery

func (*DocumentQuery) WhereGreaterThanOrEqual

func (q *DocumentQuery) WhereGreaterThanOrEqual(fieldName string, value interface{}) *DocumentQuery

func (*DocumentQuery) WhereIn

func (q *DocumentQuery) WhereIn(fieldName string, values []interface{}) *DocumentQuery

func (*DocumentQuery) WhereLessThan

func (q *DocumentQuery) WhereLessThan(fieldName string, value interface{}) *DocumentQuery

func (*DocumentQuery) WhereLessThanOrEqual

func (q *DocumentQuery) WhereLessThanOrEqual(fieldName string, value interface{}) *DocumentQuery

func (*DocumentQuery) WhereLucene

func (q *DocumentQuery) WhereLucene(fieldName string, whereClause string) *DocumentQuery

func (*DocumentQuery) WhereNotEquals

func (q *DocumentQuery) WhereNotEquals(fieldName string, value interface{}) *DocumentQuery

func (*DocumentQuery) WhereNotEqualsWithMethod

func (q *DocumentQuery) WhereNotEqualsWithMethod(fieldName string, method MethodCall) *DocumentQuery

func (*DocumentQuery) WhereNotEqualsWithParams

func (q *DocumentQuery) WhereNotEqualsWithParams(whereParams *whereParams) *DocumentQuery

func (*DocumentQuery) WhereRegex

func (q *DocumentQuery) WhereRegex(fieldName string, pattern string) *DocumentQuery

func (*DocumentQuery) WhereStartsWith

func (q *DocumentQuery) WhereStartsWith(fieldName string, value interface{}) *DocumentQuery

func (*DocumentQuery) WithinRadiusOf

func (q *DocumentQuery) WithinRadiusOf(fieldName string, radius float64, latitude float64, longitude float64) *DocumentQuery

func (*DocumentQuery) WithinRadiusOfWithUnits

func (q *DocumentQuery) WithinRadiusOfWithUnits(fieldName string, radius float64, latitude float64, longitude float64, radiusUnits SpatialUnits) *DocumentQuery

func (*DocumentQuery) WithinRadiusOfWithUnitsAndError

func (q *DocumentQuery) WithinRadiusOfWithUnitsAndError(fieldName string, radius float64, latitude float64, longitude float64, radiusUnits SpatialUnits, distanceErrorPct float64) *DocumentQuery

type DocumentQueryCustomization

type DocumentQueryCustomization struct {
	// contains filtered or unexported fields
}

DocumentQueryCustomization allows customizing query

func (*DocumentQueryCustomization) AddAfterQueryExecutedListener

func (d *DocumentQueryCustomization) AddAfterQueryExecutedListener(action func(*QueryResult)) int

AddAfterQueryExecutedListener adds a callback to get the results of the query

func (*DocumentQueryCustomization) AddAfterStreamExecutedCallback

func (d *DocumentQueryCustomization) AddAfterStreamExecutedCallback(action func(map[string]interface{})) int

AddAfterStreamExecutedCallback adds a callback to get stream result

func (*DocumentQueryCustomization) AddBeforeQueryExecutedListener

func (d *DocumentQueryCustomization) AddBeforeQueryExecutedListener(action func(*IndexQuery)) int

AddBeforeQueryExecutedListener allows you to modify index query before it's executed

func (*DocumentQueryCustomization) GetQueryOperation

func (d *DocumentQueryCustomization) GetQueryOperation() *queryOperation

GetQueryOperation returns raw query operation that will be sent to the server

func (*DocumentQueryCustomization) NoCaching

func (d *DocumentQueryCustomization) NoCaching()

NoCaching disables caching for query results

func (*DocumentQueryCustomization) NoTracking

func (d *DocumentQueryCustomization) NoTracking()

NoTracking disables tracking for quried entities by Raven's Unit of Work Using this option prevents hodling query results in memory

func (*DocumentQueryCustomization) RandomOrdering

func (d *DocumentQueryCustomization) RandomOrdering()

RandomOrdering orders search results randomly.

func (*DocumentQueryCustomization) RandomOrderingWithSeed

func (d *DocumentQueryCustomization) RandomOrderingWithSeed(seed string)

RandomOrdering orders search results randomly with a given seed. This is useful for repeatable random queries

func (*DocumentQueryCustomization) RemoveAfterQueryExecutedListener

func (d *DocumentQueryCustomization) RemoveAfterQueryExecutedListener(idx int)

RemoveAfterQueryExecutedListener removes callback added with AddAfterQueryExecutedListener

func (*DocumentQueryCustomization) RemoveAfterStreamExecutedCallback

func (d *DocumentQueryCustomization) RemoveAfterStreamExecutedCallback(idx int)

RemoveAfterStreamExecutedCallback remove callback added with AddAfterStreamExecutedCallback

func (*DocumentQueryCustomization) RemoveBeforeQueryExecutedListener

func (d *DocumentQueryCustomization) RemoveBeforeQueryExecutedListener(idx int)

RemoveBeforeQueryExecutedListener removes listener added with AddBeforeQueryExecutedListener

func (*DocumentQueryCustomization) WaitForNonStaleResults

func (d *DocumentQueryCustomization) WaitForNonStaleResults(waitTimeout time.Duration)

WaitForNonStaleResults instructs the query to wait for non results. waitTimeout of 0 means infinite timeout This shouldn't be used outside of unit tests unless you are well aware of the implications

type DocumentQueryOptions

type DocumentQueryOptions struct {
	// CollectionName and Type are mutually exclusive
	// if Collection is empty string we'll derive name of the collection
	// from Type
	CollectionName string
	Type           reflect.Type

	// name of the index used for search query
	// if set, CollectionName and Type should not be set
	IndexName string

	IsMapReduce bool
	// contains filtered or unexported fields
}

DocumentQueryOptions describes options for creating a query

type DocumentSession

type DocumentSession struct {
	*InMemoryDocumentSessionOperations
	// contains filtered or unexported fields
}

DocumentSession is a Unit of Work for accessing RavenDB server

func NewDocumentSession

func NewDocumentSession(dbName string, documentStore *DocumentStore, id string, re *RequestExecutor) *DocumentSession

NewDocumentSession creates a new DocumentSession

func (*DocumentSession) Advanced

func (*DocumentSession) Attachments

func (*DocumentSession) Eagerly

func (*DocumentSession) Exists

func (s *DocumentSession) Exists(id string) (bool, error)

Exists returns true if an entity with a given id exists in the database

func (*DocumentSession) Include

func (s *DocumentSession) Include(path string) *MultiLoaderWithInclude

func (*DocumentSession) Increment

func (s *DocumentSession) Increment(entity interface{}, path string, valueToAdd interface{}) error

Increment increments member identified by path in an entity by a given valueToAdd (can be negative, to subtract)

func (*DocumentSession) IncrementByID

func (s *DocumentSession) IncrementByID(id string, path string, valueToAdd interface{}) error

IncrementByID increments member identified by path in an entity identified by id by a given valueToAdd (can be negative, to subtract)

func (*DocumentSession) Lazily

func (*DocumentSession) Load

func (s *DocumentSession) Load(result interface{}, id string) error

Load loads an entity with a given id and sets result to it. result should be of type **<struct> or *map[string]interface{}

func (*DocumentSession) LoadIntoStream

func (s *DocumentSession) LoadIntoStream(ids []string, output io.Writer) error

LoadIntoStream loads entities identified by ids and writes them (in JSON form) to output

func (*DocumentSession) LoadMulti

func (s *DocumentSession) LoadMulti(results interface{}, ids []string) error

LoadMulti loads multiple values with given ids into results, which should be a map from string (id) to pointer to struct

func (*DocumentSession) LoadStartingWith

func (s *DocumentSession) LoadStartingWith(results interface{}, args *StartsWithArgs) error

func (*DocumentSession) LoadStartingWithIntoStream

func (s *DocumentSession) LoadStartingWithIntoStream(output io.Writer, args *StartsWithArgs) error

func (*DocumentSession) Patch

func (s *DocumentSession) Patch(entity interface{}, path string, value interface{}) error

Patch updates entity by changing part identified by path to a given value

func (*DocumentSession) PatchArray

func (s *DocumentSession) PatchArray(entity interface{}, pathToArray string, arrayAdder func(*JavaScriptArray)) error

PatchArray updates an array value of document under a given path. Modify the array inside arrayAdder function

func (*DocumentSession) PatchArrayByID

func (s *DocumentSession) PatchArrayByID(id string, pathToArray string, arrayAdder func(*JavaScriptArray)) error

func (*DocumentSession) PatchByID

func (s *DocumentSession) PatchByID(id string, path string, value interface{}) error

PatchByID updates entity identified by id by changing part identified by path to a given value

func (*DocumentSession) Query

Query return a new DocumentQuery

func (*DocumentSession) QueryCollection

func (s *DocumentSession) QueryCollection(collectionName string) *DocumentQuery

QueryCollection creates a new query over documents of a given collection

func (*DocumentSession) QueryCollectionForType

func (s *DocumentSession) QueryCollectionForType(typ reflect.Type) *DocumentQuery

QueryCollectionForType creates a new query over documents of a given type

func (*DocumentSession) QueryIndex

func (s *DocumentSession) QueryIndex(indexName string) *DocumentQuery

QueryIndex creates a new query in a index with a given name

func (*DocumentSession) RawQuery

func (s *DocumentSession) RawQuery(rawQuery string) *RawDocumentQuery

RawQuery returns new DocumentQuery representing a raw query

func (*DocumentSession) Refresh

func (s *DocumentSession) Refresh(entity interface{}) error

Refresh reloads information about a given entity in the session from the database

func (*DocumentSession) Revisions

func (*DocumentSession) SaveChanges

func (s *DocumentSession) SaveChanges() error

SaveChanges saves changes queued in memory to the database

func (*DocumentSession) Stream

func (s *DocumentSession) Stream(args *StartsWithArgs) (*StreamIterator, error)

Stream starts an iteration and returns StreamIterator

func (*DocumentSession) StreamQuery

func (s *DocumentSession) StreamQuery(query *DocumentQuery, streamQueryStats *StreamQueryStatistics) (*StreamIterator, error)

StreamQuery starts a streaming query and returns iterator for results. If streamQueryStats is provided, it'll be filled with information about query statistics.

func (*DocumentSession) StreamQueryInto

func (s *DocumentSession) StreamQueryInto(query *DocumentQuery, output io.Writer) error

StreamQueryInto starts a streaming query that will write the results (in JSON format) to output

func (*DocumentSession) StreamRawQuery

func (s *DocumentSession) StreamRawQuery(query *RawDocumentQuery, streamQueryStats *StreamQueryStatistics) (*StreamIterator, error)

StreamRawQuery starts a raw streaming query and returns iterator for results. If streamQueryStats is provided, it'll be filled with information about query statistics.

func (*DocumentSession) StreamRawQueryInto

func (s *DocumentSession) StreamRawQueryInto(query *RawDocumentQuery, output io.Writer) error

StreamRawQueryInto starts a raw streaming query that will write the results (in JSON format) to output

type DocumentSessionAttachments

type DocumentSessionAttachments struct {
	*DocumentSessionAttachmentsBase
}

func (*DocumentSessionAttachments) Exists

func (s *DocumentSessionAttachments) Exists(documentID string, name string) (bool, error)

func (*DocumentSessionAttachments) Get

func (s *DocumentSessionAttachments) Get(entity interface{}, name string) (*AttachmentResult, error)

func (*DocumentSessionAttachments) GetByID

func (s *DocumentSessionAttachments) GetByID(documentID string, name string) (*AttachmentResult, error)

func (*DocumentSessionAttachments) GetRevision

func (s *DocumentSessionAttachments) GetRevision(documentID string, name string, changeVector *string) (*AttachmentResult, error)

type DocumentSessionAttachmentsBase

type DocumentSessionAttachmentsBase struct {
	*AdvancedSessionExtensionBase
}

func (*DocumentSessionAttachmentsBase) Delete

func (s *DocumentSessionAttachmentsBase) Delete(entity interface{}, name string) error

Delete deletes a given entity TODO: support **struct or return good error message

func (*DocumentSessionAttachmentsBase) DeleteByID

func (s *DocumentSessionAttachmentsBase) DeleteByID(documentID string, name string) error

Delete deletes entity with a given i

func (*DocumentSessionAttachmentsBase) GetNames

func (s *DocumentSessionAttachmentsBase) GetNames(entity interface{}) ([]*AttachmentName, error)

func (*DocumentSessionAttachmentsBase) Store

func (s *DocumentSessionAttachmentsBase) Store(entity interface{}, name string, stream io.Reader, contentType string) error

Store stores an entity

func (*DocumentSessionAttachmentsBase) StoreByID

func (s *DocumentSessionAttachmentsBase) StoreByID(documentID string, name string, stream io.Reader, contentType string) error

contentType is optional

type DocumentSessionRevisions

type DocumentSessionRevisions struct {
	*AdvancedSessionExtensionBase
}

DocumentSessionRevisions represents revisions operations

func (*DocumentSessionRevisions) Get

func (r *DocumentSessionRevisions) Get(result interface{}, changeVector string) error

func (*DocumentSessionRevisions) GetFor

func (r *DocumentSessionRevisions) GetFor(results interface{}, id string) error

func (*DocumentSessionRevisions) GetForPaged

func (r *DocumentSessionRevisions) GetForPaged(results interface{}, id string, start int, pageSize int) error

func (*DocumentSessionRevisions) GetForStartAt

func (r *DocumentSessionRevisions) GetForStartAt(results interface{}, id string, start int) error

func (*DocumentSessionRevisions) GetMetadataFor

func (r *DocumentSessionRevisions) GetMetadataFor(id string) ([]*MetadataAsDictionary, error)

func (*DocumentSessionRevisions) GetMetadataForPaged

func (r *DocumentSessionRevisions) GetMetadataForPaged(id string, start int, pageSize int) ([]*MetadataAsDictionary, error)

func (*DocumentSessionRevisions) GetMetadataForStartAt

func (r *DocumentSessionRevisions) GetMetadataForStartAt(id string, start int) ([]*MetadataAsDictionary, error)

func (*DocumentSessionRevisions) GetRevisions

func (r *DocumentSessionRevisions) GetRevisions(results interface{}, changeVectors []string) error

type DocumentStore

type DocumentStore struct {
	Certificate *tls.Certificate
	TrustStore  *x509.Certificate
	// contains filtered or unexported fields
}

DocumentStore represents a database

func NewDocumentStore

func NewDocumentStore(urls []string, database string) *DocumentStore

func (*DocumentStore) AddAfterCloseListener

func (s *DocumentStore) AddAfterCloseListener(fn func(*DocumentStore)) int

func (*DocumentStore) AddAfterSaveChangesListener

func (s *DocumentStore) AddAfterSaveChangesListener(handler func(*AfterSaveChangesEventArgs)) int

AddAfterSaveChangesListener registers a function that will be called before saving changes. It'll be registered with every new session. Returns listener id that can be passed to RemoveAfterSaveChangesListener to unregister the listener.

func (*DocumentStore) AddBeforeCloseListener

func (s *DocumentStore) AddBeforeCloseListener(fn func(*DocumentStore)) int

func (*DocumentStore) AddBeforeDeleteListener

func (s *DocumentStore) AddBeforeDeleteListener(handler func(*BeforeDeleteEventArgs)) int

AddBeforeDeleteListener registers a function that will be called before deleting an entity. It'll be registered with every new session. Returns listener id that can be passed to RemoveBeforeDeleteListener to unregister the listener.

func (*DocumentStore) AddBeforeQueryListener

func (s *DocumentStore) AddBeforeQueryListener(handler func(*BeforeQueryEventArgs)) int

AddBeforeQueryListener registers a function that will be called before running a query. It allows customizing query via DocumentQueryCustomization. It'll be registered with every new session. Returns listener id that can be passed to RemoveBeforeQueryListener to unregister the listener.

func (*DocumentStore) AddBeforeStoreListener

func (s *DocumentStore) AddBeforeStoreListener(handler func(*BeforeStoreEventArgs)) int

AddBeforeStoreStoreListener registers a function that will be called before storing ab entity. It'll be registered with every new session. Returns listener id that can be passed to RemoveBeforeStoreListener to unregister the listener.

func (*DocumentStore) AggressivelyCache

func (s *DocumentStore) AggressivelyCache(database string) (CancelFunc, error)

func (*DocumentStore) AggressivelyCacheFor

func (s *DocumentStore) AggressivelyCacheFor(cacheDuration time.Duration) (CancelFunc, error)

func (*DocumentStore) AggressivelyCacheForDatabase

func (s *DocumentStore) AggressivelyCacheForDatabase(cacheDuration time.Duration, database string) (CancelFunc, error)

func (*DocumentStore) BulkInsert

func (s *DocumentStore) BulkInsert(database string) *BulkInsertOperation

func (*DocumentStore) Changes

func (s *DocumentStore) Changes(database string) *DatabaseChanges

func (*DocumentStore) Close

func (s *DocumentStore) Close()

Close closes the Store

func (*DocumentStore) DisableAggressiveCaching

func (s *DocumentStore) DisableAggressiveCaching(databaseName string) *RestoreCaching

func (*DocumentStore) ExecuteIndex

func (s *DocumentStore) ExecuteIndex(task *IndexCreationTask, database string) error

func (*DocumentStore) ExecuteIndexes

func (s *DocumentStore) ExecuteIndexes(tasks []*IndexCreationTask, database string) error

func (*DocumentStore) GetConventions

func (s *DocumentStore) GetConventions() *DocumentConventions

GetConventions returns DocumentConventions

func (*DocumentStore) GetDatabase

func (s *DocumentStore) GetDatabase() string

func (*DocumentStore) GetIdentifier

func (s *DocumentStore) GetIdentifier() string

Get an identifier of the store. For debugging / testing.

func (*DocumentStore) GetLastDatabaseChangesStateError

func (s *DocumentStore) GetLastDatabaseChangesStateError(database string) error

func (*DocumentStore) GetRequestExecutor

func (s *DocumentStore) GetRequestExecutor(database string) *RequestExecutor

GetRequestExecutor gets a request executor. database is optional

func (*DocumentStore) GetUrls

func (s *DocumentStore) GetUrls() []string

GetUrls returns urls of all RavenDB nodes

func (*DocumentStore) Initialize

func (s *DocumentStore) Initialize() error

Initialize initializes document Store, Must be called before executing any operation.

func (*DocumentStore) Maintenance

func (s *DocumentStore) Maintenance() *MaintenanceOperationExecutor

func (*DocumentStore) OpenSession

func (s *DocumentStore) OpenSession(database string) (*DocumentSession, error)

OpenSession opens a new session to document Store. If database is not given, we'll use store's database name

func (*DocumentStore) OpenSessionWithOptions

func (s *DocumentStore) OpenSessionWithOptions(options *SessionOptions) (*DocumentSession, error)

func (*DocumentStore) Operations

func (s *DocumentStore) Operations() *OperationExecutor

func (*DocumentStore) RemoveAfterCloseListener

func (s *DocumentStore) RemoveAfterCloseListener(idx int)

func (*DocumentStore) RemoveAfterSaveChangesListener

func (s *DocumentStore) RemoveAfterSaveChangesListener(handlerID int)

RemoveAfterSaveChangesListener removes a listener given id returned by AddAfterSaveChangesListener

func (*DocumentStore) RemoveBeforeCloseListener

func (s *DocumentStore) RemoveBeforeCloseListener(idx int)

func (*DocumentStore) RemoveBeforeDeleteListener

func (s *DocumentStore) RemoveBeforeDeleteListener(handlerID int)

RemoveBeforeDeleteListener removes a listener given id returned by AddBeforeDeleteListener

func (*DocumentStore) RemoveBeforeQueryListener

func (s *DocumentStore) RemoveBeforeQueryListener(handlerID int)

RemoveBeforeQueryListener removes a listener given id returned by AddBeforeQueryListener

func (*DocumentStore) RemoveBeforeStoreListener

func (s *DocumentStore) RemoveBeforeStoreListener(handlerID int)

RemoveBeforeStoreListener removes a listener given id returned by AddBeforeStoreListener

func (*DocumentStore) SetConventions

func (s *DocumentStore) SetConventions(conventions *DocumentConventions)

SetConventions sets DocumentConventions

func (*DocumentStore) SetDatabase

func (s *DocumentStore) SetDatabase(database string)

func (*DocumentStore) SetIdentifier

func (s *DocumentStore) SetIdentifier(identifier string)

func (*DocumentStore) SetUrls

func (s *DocumentStore) SetUrls(urls []string)

SetUrls sets initial urls of RavenDB nodes

func (*DocumentStore) Subscriptions

func (s *DocumentStore) Subscriptions() *DocumentSubscriptions

Subscriptions returns DocumentSubscriptions which allows subscribing to changes in store

type DocumentSubscriptions

type DocumentSubscriptions struct {
	// contains filtered or unexported fields
}

DocumentSubscriptions allows subscribing to changes in the store

func (*DocumentSubscriptions) Close

func (s *DocumentSubscriptions) Close() error

Close closes subscriptions

func (*DocumentSubscriptions) Create

func (s *DocumentSubscriptions) Create(options *SubscriptionCreationOptions, database string) (string, error)

Create creates a data subscription in a database. The subscription will expose all documents that match the specified subscription options for a given type.

func (*DocumentSubscriptions) CreateForRevisions

func (s *DocumentSubscriptions) CreateForRevisions(clazz reflect.Type, options *SubscriptionCreationOptions, database string) (string, error)

CreateForRevisions creates a data subscription in a database. The subscription will expose all documents that match the specified subscription options for a given type.

func (*DocumentSubscriptions) CreateForType

func (s *DocumentSubscriptions) CreateForType(clazz reflect.Type, options *SubscriptionCreationOptions, database string) (string, error)

CreateForType creates a data subscription in a database. The subscription will expose all documents that match the specified subscription options for a given type.

func (*DocumentSubscriptions) Delete

func (s *DocumentSubscriptions) Delete(name string, database string) error

Delete deletes a subscription.

func (*DocumentSubscriptions) DropConnection

func (s *DocumentSubscriptions) DropConnection(name string, database string) error

DropConnection forces server to close current client subscription connection to the server

func (*DocumentSubscriptions) GetSubscriptionState

func (s *DocumentSubscriptions) GetSubscriptionState(subscriptionName string, database string) (*SubscriptionState, error)

GetSubscriptionState returns subscription definition and it's current state

func (*DocumentSubscriptions) GetSubscriptionWorker

func (s *DocumentSubscriptions) GetSubscriptionWorker(clazz reflect.Type, options *SubscriptionWorkerOptions, database string) (*SubscriptionWorker, error)

GetSubscriptionWorker opens a subscription and starts pulling documents since a last processed document for that subscription. The connection options determine client and server cooperation rules like document batch sizes or a timeout in a matter of which a client needs to acknowledge that batch has been processed. The acknowledgment is sent after all documents are processed by subscription's handlers.

func (*DocumentSubscriptions) GetSubscriptionWorkerForRevisions

func (s *DocumentSubscriptions) GetSubscriptionWorkerForRevisions(clazz reflect.Type, options *SubscriptionWorkerOptions, database string) (*SubscriptionWorker, error)

GetSubscriptionWorkerForRevisions opens a subscription and starts pulling documents since a last processed document for that subscription. The connection options determine client and server cooperation rules like document batch sizes or a timeout in a matter of which a client needs to acknowledge that batch has been processed. The acknowledgment is sent after all documents are processed by subscription's handlers.

func (*DocumentSubscriptions) GetSubscriptions

func (s *DocumentSubscriptions) GetSubscriptions(start int, take int, database string) ([]*SubscriptionState, error)

GetSubscriptions downloads a list of all existing subscriptions in a database.

type DocumentsChanges

type DocumentsChanges struct {
	FieldOldValue interface{}
	FieldNewValue interface{}
	FieldOldType  interface{}
	FieldNewType  interface{}
	Change        ChangeType
	FieldName     string
}

DocumentsChanges describes a change in a document

type DropSubscriptionConnectionCommand

type DropSubscriptionConnectionCommand struct {
	RavenCommandBase
	// contains filtered or unexported fields
}

DropSubscriptionConnectionCommand describes "drop subscription" command

func (*DropSubscriptionConnectionCommand) CreateRequest

func (c *DropSubscriptionConnectionCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type Duration

type Duration time.Duration

Duration is an alias for time.Duration that serializes to JSON in format compatible with ravendb server

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON converts to JSON format (as a string)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes from string

type DynamicSpatialField

type DynamicSpatialField interface {
	// ToField returns a name of the field used in queries
	ToField(ensureValidFieldName func(string, bool) (string, error)) (string, error)
}

DynamicSpatialField is an interface for implementing name of the field to be queried

type EagerSessionOperations

type EagerSessionOperations struct {
	// contains filtered or unexported fields
}

func (*EagerSessionOperations) ExecuteAllPendingLazyOperations

func (s *EagerSessionOperations) ExecuteAllPendingLazyOperations() (*ResponseTimeInformation, error)

type EnableIndexCommand

type EnableIndexCommand struct {
	RavenCommandBase
	// contains filtered or unexported fields
}

func NewEnableIndexCommand

func NewEnableIndexCommand(indexName string) (*EnableIndexCommand, error)

func (*EnableIndexCommand) CreateRequest

func (c *EnableIndexCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type EnableIndexOperation

type EnableIndexOperation struct {
	Command *EnableIndexCommand
	// contains filtered or unexported fields
}

func NewEnableIndexOperation

func NewEnableIndexOperation(indexName string) (*EnableIndexOperation, error)

func (*EnableIndexOperation) GetCommand

func (o *EnableIndexOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type EventHandler

type EventHandler interface {
	// contains filtered or unexported methods
}

type ExplainQueryCommand

type ExplainQueryCommand struct {
	RavenCommandBase

	Result []*ExplainQueryResult
	// contains filtered or unexported fields
}

func NewExplainQueryCommand

func NewExplainQueryCommand(conventions *DocumentConventions, indexQuery *IndexQuery) *ExplainQueryCommand

func (*ExplainQueryCommand) CreateRequest

func (c *ExplainQueryCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*ExplainQueryCommand) SetResponse

func (c *ExplainQueryCommand) SetResponse(response []byte, fromCache bool) error

type ExplainQueryResult

type ExplainQueryResult struct {
	Index  string `json:"Index"`
	Reason string `json:"Reason"`
}

type ExternalReplication

type ExternalReplication struct {
	ReplicationNode
	TaskID               int64  `json:"TaskId"`
	Name                 string `json:"Name"`
	ConnectionStringName string `json:"ConnectionStringName"`
	MentorName           string `json:"MentorName"`
}

ExternalReplication describes external replication

func NewExternalReplication

func NewExternalReplication(database string, connectionStringName string) *ExternalReplication

NewExternalReplication creates ExternalReplication

type Facet

type Facet struct {
	FacetBaseCommon

	FieldName string `json:"FieldName"`
}

Facet describes a search facet

func NewFacet

func NewFacet() *Facet

NewFacet returns a new Facet

func (*Facet) ToFacetToken

func (f *Facet) ToFacetToken(addQueryParameter func(interface{}) string) (*facetToken, error)

ToFacetToken returns token for this facet

type FacetAggregation

type FacetAggregation = string

type FacetBase

type FacetBase interface {
	// those are supplied by each type
	ToFacetToken(addQueryParameter func(interface{}) string) (*facetToken, error)

	// those are inherited from FacetBaseCommon
	SetDisplayFieldName(string)
	GetOptions() *FacetOptions
	SetOptions(*FacetOptions)
	GetAggregations() map[FacetAggregation]string
}

type FacetBaseCommon

type FacetBaseCommon struct {
	DisplayFieldName string                      `json:"DisplayFieldName,omitempty"`
	Options          *FacetOptions               `json:"Options"`
	Aggregations     map[FacetAggregation]string `json:"Aggregations"`
}

func NewFacetBaseCommon

func NewFacetBaseCommon() FacetBaseCommon

func (*FacetBaseCommon) GetAggregations

func (f *FacetBaseCommon) GetAggregations() map[FacetAggregation]string

func (*FacetBaseCommon) GetOptions

func (f *FacetBaseCommon) GetOptions() *FacetOptions

func (*FacetBaseCommon) SetDisplayFieldName

func (f *FacetBaseCommon) SetDisplayFieldName(displayFieldName string)

func (*FacetBaseCommon) SetOptions

func (f *FacetBaseCommon) SetOptions(options *FacetOptions)

type FacetBuilder

type FacetBuilder struct {
	// contains filtered or unexported fields
}

func NewFacetBuilder

func NewFacetBuilder() *FacetBuilder

func (*FacetBuilder) AllResults

func (b *FacetBuilder) AllResults() *FacetBuilder

func (*FacetBuilder) AverageOn

func (b *FacetBuilder) AverageOn(path string) *FacetBuilder

func (*FacetBuilder) ByField

func (b *FacetBuilder) ByField(fieldName string) *FacetBuilder

func (*FacetBuilder) ByRanges

func (b *FacetBuilder) ByRanges(rng *RangeBuilder, ranges ...*RangeBuilder) *FacetBuilder

func (*FacetBuilder) GetFacet

func (b *FacetBuilder) GetFacet() FacetBase

func (*FacetBuilder) MaxOn

func (b *FacetBuilder) MaxOn(path string) *FacetBuilder

func (*FacetBuilder) MinOn

func (b *FacetBuilder) MinOn(path string) *FacetBuilder

func (*FacetBuilder) SumOn

func (b *FacetBuilder) SumOn(path string) *FacetBuilder

func (*FacetBuilder) WithDisplayName

func (b *FacetBuilder) WithDisplayName(displayName string) *FacetBuilder

func (*FacetBuilder) WithOptions

func (b *FacetBuilder) WithOptions(options *FacetOptions) *FacetBuilder

type FacetOptions

type FacetOptions struct {
	TermSortMode          FacetTermSortMode `json:"TermSortMode"`
	IncludeRemainingTerms bool              `json:"IncludeRemainingTerms"`
	Start                 int               `json:"Start"`
	PageSize              int               `json:"PageSize"`
}

FacetOptions describes options for facet

func NewFacetOptions

func NewFacetOptions() *FacetOptions

NewFacetOptions returns new FacetOptions

type FacetResult

type FacetResult struct {
	Name                string
	Values              []*FacetValue
	RemainingTerms      []string
	RemainingTermsCount int
	RemainingHits       int
}

FacetResults represents results of faceted search

type FacetSetup

type FacetSetup struct {
	ID     string
	Facets []*Facet `json:"Facets,omitempty"`
	// Note: omitempty here is important. If we Send 'null',
	// (as opposed to Java's '[]') the server will error out
	// when parsing query referencing this setup
	RangeFacets []*RangeFacet `json:"RangeFacets,omitempty"`
}

FacetSetup describes new facet setup

type FacetTermSortMode

type FacetTermSortMode = string

FacetTermSortMode describes sort mode for a facet

type FacetValue

type FacetValue struct {
	Range   string
	Count   int
	Sum     *float64
	Max     *float64
	Min     *float64
	Average *float64
}

func (*FacetValue) SetAverage

func (v *FacetValue) SetAverage(average float64)

func (*FacetValue) SetMax

func (v *FacetValue) SetMax(max float64)

func (*FacetValue) SetMin

func (v *FacetValue) SetMin(min float64)

func (*FacetValue) SetSum

func (v *FacetValue) SetSum(sum float64)

func (*FacetValue) String

func (v *FacetValue) String() string

type FieldIndexing

type FieldIndexing string

type FieldStorage

type FieldStorage = string

type FieldTermVector

type FieldTermVector = string

type GenericQueryResult

type GenericQueryResult struct {
	TotalResults   int `json:"TotalResults"`
	SkippedResults int `json:"SkippedResults"`
	//TBD 4.1  map[string]map[string]List<String>>> highlightings
	DurationInMs      int64              `json:"DurationInMs"`
	ScoreExplanations map[string]string  `json:"ScoreExplanation"`
	TimingsInMs       map[string]float64 `json:"TimingsInMs"`
	ResultSize        int64              `json:"ResultSize"`
	// contains filtered or unexported fields
}

GenericQueryResult represents query results

type GenericRangeFacet

type GenericRangeFacet struct {
	FacetBaseCommon

	Ranges []*RangeBuilder
	// contains filtered or unexported fields
}

GenericRangeFacet represents generic range facet

func NewGenericRangeFacet

func NewGenericRangeFacet(parent FacetBase) *GenericRangeFacet

NewGenericRangeFacet returns new GenericRangeFacet parent is optional, can be nil

func (*GenericRangeFacet) ToFacetToken

func (f *GenericRangeFacet) ToFacetToken(addQueryParameter func(interface{}) string) (*facetToken, error)

ToFacetToken returns facetToken from GenericRangeFacet

type GetAttachmentCommand

type GetAttachmentCommand struct {
	RavenCommandBase

	Result *AttachmentResult
	// contains filtered or unexported fields
}

func NewGetAttachmentCommand

func NewGetAttachmentCommand(documentID string, name string, typ AttachmentType, changeVector *string) (*GetAttachmentCommand, error)

TODO: should stream be io.ReadCloser? Who owns closing the attachment

func (*GetAttachmentCommand) CreateRequest

func (c *GetAttachmentCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type GetAttachmentOperation

type GetAttachmentOperation struct {
	Command *GetAttachmentCommand
	// contains filtered or unexported fields
}

func NewGetAttachmentOperation

func NewGetAttachmentOperation(documentID string, name string, typ AttachmentType, contentType string, changeVector *string) *GetAttachmentOperation

func (*GetAttachmentOperation) GetCommand

func (o *GetAttachmentOperation) GetCommand(store *DocumentStore, conventions *DocumentConventions, cache *httpCache) (RavenCommand, error)

type GetClientConfigurationCommand

type GetClientConfigurationCommand struct {
	RavenCommandBase

	Result *GetClientConfigurationCommandResult
}

func NewGetClientConfigurationCommand

func NewGetClientConfigurationCommand() *GetClientConfigurationCommand

func (*GetClientConfigurationCommand) CreateRequest

func (c *GetClientConfigurationCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetClientConfigurationCommand) SetResponse

func (c *GetClientConfigurationCommand) SetResponse(response []byte, fromCache bool) error

type GetClientConfigurationCommandResult

type GetClientConfigurationCommandResult struct {
	Etag          int64                `json:"Etag"`
	Configuration *ClientConfiguration `json:"Configuration"`
}

type GetClientConfigurationOperation

type GetClientConfigurationOperation struct {
	Command *GetClientConfigurationCommand
}

func NewGetClientConfigurationOperation

func NewGetClientConfigurationOperation() *GetClientConfigurationOperation

func (*GetClientConfigurationOperation) GetCommand

type GetCollectionStatisticsCommand

type GetCollectionStatisticsCommand struct {
	RavenCommandBase

	Result *CollectionStatistics
}

func NewGetCollectionStatisticsCommand

func NewGetCollectionStatisticsCommand() *GetCollectionStatisticsCommand

func (*GetCollectionStatisticsCommand) CreateRequest

func (c *GetCollectionStatisticsCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetCollectionStatisticsCommand) SetResponse

func (c *GetCollectionStatisticsCommand) SetResponse(response []byte, fromCache bool) error

type GetCollectionStatisticsOperation

type GetCollectionStatisticsOperation struct {
	Command *GetCollectionStatisticsCommand
}

func NewGetCollectionStatisticsOperation

func NewGetCollectionStatisticsOperation() *GetCollectionStatisticsOperation

func (*GetCollectionStatisticsOperation) GetCommand

type GetCompareExchangeValueCommand

type GetCompareExchangeValueCommand struct {
	RavenCommandBase

	Result *CompareExchangeValue
	// contains filtered or unexported fields
}

func NewGetCompareExchangeValueCommand

func NewGetCompareExchangeValueCommand(clazz reflect.Type, key string, conventions *DocumentConventions) (*GetCompareExchangeValueCommand, error)

func (*GetCompareExchangeValueCommand) CreateRequest

func (c *GetCompareExchangeValueCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetCompareExchangeValueCommand) SetResponse

func (c *GetCompareExchangeValueCommand) SetResponse(response []byte, fromCache bool) error

type GetCompareExchangeValueOperation

type GetCompareExchangeValueOperation struct {
	Command *GetCompareExchangeValueCommand
	// contains filtered or unexported fields
}

func NewGetCompareExchangeValueOperation

func NewGetCompareExchangeValueOperation(clazz reflect.Type, key string) (*GetCompareExchangeValueOperation, error)

func (*GetCompareExchangeValueOperation) GetCommand

func (o *GetCompareExchangeValueOperation) GetCommand(store *DocumentStore, conventions *DocumentConventions, cache *httpCache) (RavenCommand, error)

type GetCompareExchangeValuesCommand

type GetCompareExchangeValuesCommand struct {
	RavenCommandBase

	Result map[string]*CompareExchangeValue
	// contains filtered or unexported fields
}

func (*GetCompareExchangeValuesCommand) CreateRequest

func (c *GetCompareExchangeValuesCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetCompareExchangeValuesCommand) SetResponse

func (c *GetCompareExchangeValuesCommand) SetResponse(response []byte, fromCache bool) error

type GetCompareExchangeValuesOperation

type GetCompareExchangeValuesOperation struct {
	Command *GetCompareExchangeValuesCommand
	// contains filtered or unexported fields
}

func NewGetCompareExchangeValuesOperation

func NewGetCompareExchangeValuesOperation(clazz reflect.Type, startWith string, start int, pageSize int) (*GetCompareExchangeValuesOperation, error)

func NewGetCompareExchangeValuesOperationWithKeys

func NewGetCompareExchangeValuesOperationWithKeys(clazz reflect.Type, keys []string) (*GetCompareExchangeValuesOperation, error)

func (*GetCompareExchangeValuesOperation) GetCommand

func (o *GetCompareExchangeValuesOperation) GetCommand(store *DocumentStore, conventions *DocumentConventions, cache *httpCache) (RavenCommand, error)

type GetConflictsCommand

type GetConflictsCommand struct {
	RavenCommandBase

	Result *GetConflictsResult
	// contains filtered or unexported fields
}

func NewGetConflictsCommand

func NewGetConflictsCommand(id string) *GetConflictsCommand

func (*GetConflictsCommand) CreateRequest

func (c *GetConflictsCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetConflictsCommand) SetResponse

func (c *GetConflictsCommand) SetResponse(response []byte, fromCache bool) error

type GetConflictsResult

type GetConflictsResult struct {
	ID          string      `json:"Id"`
	Results     []*Conflict `json:"Results"`
	LargestEtag int64       `json:"LargestEtag"`
}

GetConflictsResult represents result of "get conflict" command

type GetDatabaseNamesCommand

type GetDatabaseNamesCommand struct {
	RavenCommandBase

	Result []string
	// contains filtered or unexported fields
}

func NewGetDatabaseNamesCommand

func NewGetDatabaseNamesCommand(_start int, _pageSize int) *GetDatabaseNamesCommand

func (*GetDatabaseNamesCommand) CreateRequest

func (c *GetDatabaseNamesCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetDatabaseNamesCommand) SetResponse

func (c *GetDatabaseNamesCommand) SetResponse(response []byte, fromCache bool) error

type GetDatabaseNamesOperation

type GetDatabaseNamesOperation struct {
	// contains filtered or unexported fields
}

func NewGetDatabaseNamesOperation

func NewGetDatabaseNamesOperation(_start int, _pageSize int) *GetDatabaseNamesOperation

func (*GetDatabaseNamesOperation) GetCommand

type GetDatabaseNamesResult

type GetDatabaseNamesResult struct {
	Databases []string `json:"Databases"`
}

GetDatabaseNamesResult describes response of GetDatabaseNames command

type GetDatabaseRecordCommand

type GetDatabaseRecordCommand struct {
	RavenCommandBase

	Result *DatabaseRecordWithEtag
	// contains filtered or unexported fields
}

func NewGetDatabaseRecordCommand

func NewGetDatabaseRecordCommand(conventions *DocumentConventions, database string) *GetDatabaseRecordCommand

func (*GetDatabaseRecordCommand) CreateRequest

func (c *GetDatabaseRecordCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetDatabaseRecordCommand) SetResponse

func (c *GetDatabaseRecordCommand) SetResponse(response []byte, fromCache bool) error

type GetDatabaseRecordOperation

type GetDatabaseRecordOperation struct {
	Command *GetDatabaseRecordCommand
	// contains filtered or unexported fields
}

func NewGetDatabaseRecordOperation

func NewGetDatabaseRecordOperation(database string) *GetDatabaseRecordOperation

func (*GetDatabaseRecordOperation) GetCommand

func (o *GetDatabaseRecordOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type GetDatabaseTopologyCommand

type GetDatabaseTopologyCommand struct {
	RavenCommandBase

	Result *Topology
}

func NewGetDatabaseTopologyCommand

func NewGetDatabaseTopologyCommand() *GetDatabaseTopologyCommand

func (*GetDatabaseTopologyCommand) CreateRequest

func (c *GetDatabaseTopologyCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetDatabaseTopologyCommand) SetResponse

func (c *GetDatabaseTopologyCommand) SetResponse(response []byte, fromCache bool) error

type GetDocumentsCommand

type GetDocumentsCommand struct {
	RavenCommandBase

	Result *GetDocumentsResult
	// contains filtered or unexported fields
}

func NewGetDocumentsCommand

func NewGetDocumentsCommand(ids []string, includes []string, metadataOnly bool) (*GetDocumentsCommand, error)

func NewGetDocumentsCommandFull

func NewGetDocumentsCommandFull(startWith string, startAfter string, matches string, exclude string, start int, pageSize int, metadataOnly bool) (*GetDocumentsCommand, error)

func (*GetDocumentsCommand) CreateRequest

func (c *GetDocumentsCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetDocumentsCommand) SetResponse

func (c *GetDocumentsCommand) SetResponse(response []byte, fromCache bool) error

type GetDocumentsResult

type GetDocumentsResult struct {
	Includes      map[string]interface{}   `json:"Includes"`
	Results       []map[string]interface{} `json:"Results"`
	NextPageStart int                      `json:"NextPageStart"`
}

GetDocumentsResult is a result of GetDocument command

type GetIdentitiesCommand

type GetIdentitiesCommand struct {
	RavenCommandBase

	Result map[string]int
}

func NewGetIdentitiesCommand

func NewGetIdentitiesCommand() *GetIdentitiesCommand

func (*GetIdentitiesCommand) CreateRequest

func (c *GetIdentitiesCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetIdentitiesCommand) SetResponse

func (c *GetIdentitiesCommand) SetResponse(response []byte, fromCache bool) error

type GetIdentitiesOperation

type GetIdentitiesOperation struct {
	Command *GetIdentitiesCommand
}

func NewGetIdentitiesOperation

func NewGetIdentitiesOperation() *GetIdentitiesOperation

func (*GetIdentitiesOperation) GetCommand

func (o *GetIdentitiesOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type GetIndexCommand

type GetIndexCommand struct {
	RavenCommandBase

	Result *IndexDefinition
	// contains filtered or unexported fields
}

func NewGetIndexCommand

func NewGetIndexCommand(indexName string) (*GetIndexCommand, error)

func (*GetIndexCommand) CreateRequest

func (c *GetIndexCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetIndexCommand) SetResponse

func (c *GetIndexCommand) SetResponse(response []byte, fromCache bool) error

type GetIndexErrorsCommand

type GetIndexErrorsCommand struct {
	RavenCommandBase

	Result []*IndexErrors
	// contains filtered or unexported fields
}

func NewGetIndexErrorsCommand

func NewGetIndexErrorsCommand(indexNames []string) *GetIndexErrorsCommand

func (*GetIndexErrorsCommand) CreateRequest

func (c *GetIndexErrorsCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetIndexErrorsCommand) SetResponse

func (c *GetIndexErrorsCommand) SetResponse(response []byte, fromCache bool) error

type GetIndexErrorsOperation

type GetIndexErrorsOperation struct {
	Command *GetIndexErrorsCommand
	// contains filtered or unexported fields
}

func NewGetIndexErrorsOperation

func NewGetIndexErrorsOperation(indexNames []string) *GetIndexErrorsOperation

func (*GetIndexErrorsOperation) GetCommand

func (o *GetIndexErrorsOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type GetIndexNamesCommand

type GetIndexNamesCommand struct {
	RavenCommandBase

	Result []string
	// contains filtered or unexported fields
}

func NewGetIndexNamesCommand

func NewGetIndexNamesCommand(start int, pageSize int) *GetIndexNamesCommand

func (*GetIndexNamesCommand) CreateRequest

func (c *GetIndexNamesCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetIndexNamesCommand) SetResponse

func (c *GetIndexNamesCommand) SetResponse(response []byte, fromCache bool) error

type GetIndexNamesOperation

type GetIndexNamesOperation struct {
	Command *GetIndexNamesCommand
	// contains filtered or unexported fields
}

func NewGetIndexNamesOperation

func NewGetIndexNamesOperation(start int, pageSize int) *GetIndexNamesOperation

func (*GetIndexNamesOperation) GetCommand

func (o *GetIndexNamesOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type GetIndexOperation

type GetIndexOperation struct {
	Command *GetIndexCommand
	// contains filtered or unexported fields
}

func NewGetIndexOperation

func NewGetIndexOperation(indexName string) *GetIndexOperation

func (*GetIndexOperation) GetCommand

func (o *GetIndexOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type GetIndexStatisticsCommand

type GetIndexStatisticsCommand struct {
	RavenCommandBase

	Result *IndexStats
	// contains filtered or unexported fields
}

func NewGetIndexStatisticsCommand

func NewGetIndexStatisticsCommand(indexName string) (*GetIndexStatisticsCommand, error)

func (*GetIndexStatisticsCommand) CreateRequest

func (c *GetIndexStatisticsCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetIndexStatisticsCommand) SetResponse

func (c *GetIndexStatisticsCommand) SetResponse(response []byte, fromCache bool) error

type GetIndexStatisticsOperation

type GetIndexStatisticsOperation struct {
	Command *GetIndexStatisticsCommand
	// contains filtered or unexported fields
}

func NewGetIndexStatisticsOperation

func NewGetIndexStatisticsOperation(indexName string) *GetIndexStatisticsOperation

func (*GetIndexStatisticsOperation) GetCommand

func (o *GetIndexStatisticsOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type GetIndexesCommand

type GetIndexesCommand struct {
	RavenCommandBase

	Result []*IndexDefinition
	// contains filtered or unexported fields
}

func NewGetIndexesCommand

func NewGetIndexesCommand(_start int, _pageSize int) *GetIndexesCommand

func (*GetIndexesCommand) CreateRequest

func (c *GetIndexesCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetIndexesCommand) SetResponse

func (c *GetIndexesCommand) SetResponse(response []byte, fromCache bool) error

type GetIndexesOperation

type GetIndexesOperation struct {
	Command *GetIndexesCommand
	// contains filtered or unexported fields
}

func NewGetIndexesOperation

func NewGetIndexesOperation(_start int, _pageSize int) *GetIndexesOperation

func (*GetIndexesOperation) GetCommand

func (o *GetIndexesOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type GetIndexesStatisticsCommand

type GetIndexesStatisticsCommand struct {
	RavenCommandBase

	Result []*IndexStats
}

func NewGetIndexesStatisticsCommand

func NewGetIndexesStatisticsCommand() *GetIndexesStatisticsCommand

func (*GetIndexesStatisticsCommand) CreateRequest

func (c *GetIndexesStatisticsCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetIndexesStatisticsCommand) SetResponse

func (c *GetIndexesStatisticsCommand) SetResponse(response []byte, fromCache bool) error

type GetIndexesStatisticsOperation

type GetIndexesStatisticsOperation struct {
	Command *GetIndexesStatisticsCommand
}

func NewGetIndexesStatisticsOperation

func NewGetIndexesStatisticsOperation() *GetIndexesStatisticsOperation

func (*GetIndexesStatisticsOperation) GetCommand

type GetIndexingStatusCommand

type GetIndexingStatusCommand struct {
	RavenCommandBase

	Result *IndexingStatus
}

func NewGetIndexingStatusCommand

func NewGetIndexingStatusCommand() *GetIndexingStatusCommand

func (*GetIndexingStatusCommand) CreateRequest

func (c *GetIndexingStatusCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetIndexingStatusCommand) SetResponse

func (c *GetIndexingStatusCommand) SetResponse(response []byte, fromCache bool) error

type GetIndexingStatusOperation

type GetIndexingStatusOperation struct {
	Command *GetIndexingStatusCommand
}

func NewGetIndexingStatusOperation

func NewGetIndexingStatusOperation() *GetIndexingStatusOperation

func (*GetIndexingStatusOperation) GetCommand

func (o *GetIndexingStatusOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type GetNextOperationIDCommand

type GetNextOperationIDCommand struct {
	RavenCommandBase

	Result int64
}

GetNextOperationIDCommand represents command for getting next id from the server

func NewGetNextOperationIDCommand

func NewGetNextOperationIDCommand() *GetNextOperationIDCommand

NewGetNextOperationIDCommand returns GetNextOperationIDCommand

func (*GetNextOperationIDCommand) CreateRequest

func (c *GetNextOperationIDCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetNextOperationIDCommand) SetResponse

func (c *GetNextOperationIDCommand) SetResponse(response []byte, fromCache bool) error

type GetOperationStateCommand

type GetOperationStateCommand struct {
	RavenCommandBase

	Result map[string]interface{}
	// contains filtered or unexported fields
}

func NewGetOperationStateCommand

func NewGetOperationStateCommand(conventions *DocumentConventions, id int64) *GetOperationStateCommand

func (*GetOperationStateCommand) CreateRequest

func (c *GetOperationStateCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetOperationStateCommand) SetResponse

func (c *GetOperationStateCommand) SetResponse(response []byte, fromCache bool) error

type GetOperationStateOperation

type GetOperationStateOperation struct {
	// contains filtered or unexported fields
}

func (*GetOperationStateOperation) GetCommand

type GetResponse

type GetResponse struct {
	Result       []byte
	Headers      map[string]string
	StatusCode   int
	IsForceRetry bool
}

GetResponse represents result of get request

type GetRevisionOperation

type GetRevisionOperation struct {
	// contains filtered or unexported fields
}

GetRevisionOperation represents "get revisions" operation

func NewGetRevisionOperationRange

func NewGetRevisionOperationRange(session *InMemoryDocumentSessionOperations, id string, start int, pageSize int, metadataOnly bool) (*GetRevisionOperation, error)

func NewGetRevisionOperationWithChangeVectors

func NewGetRevisionOperationWithChangeVectors(session *InMemoryDocumentSessionOperations, changeVectors []string) *GetRevisionOperation

func (*GetRevisionOperation) GetRevision

func (o *GetRevisionOperation) GetRevision(result interface{}) error

func (*GetRevisionOperation) GetRevisionWithDocument

func (o *GetRevisionOperation) GetRevisionWithDocument(result interface{}, document map[string]interface{}) error

Note: in Java it's getRevision

func (*GetRevisionOperation) GetRevisions

func (o *GetRevisionOperation) GetRevisions(results interface{}) error

result should be map[string]<type>

func (*GetRevisionOperation) GetRevisionsFor

func (o *GetRevisionOperation) GetRevisionsFor(results interface{}) error

results should be *[]*<type>

func (*GetRevisionOperation) GetRevisionsMetadataFor

func (o *GetRevisionOperation) GetRevisionsMetadataFor() []*MetadataAsDictionary

type GetRevisionsBinEntryCommand

type GetRevisionsBinEntryCommand struct {
	RavenCommandBase

	Result *JSONArrayResult
	// contains filtered or unexported fields
}

func NewGetRevisionsBinEntryCommand

func NewGetRevisionsBinEntryCommand(etag int64, pageSize int) *GetRevisionsBinEntryCommand

func (*GetRevisionsBinEntryCommand) CreateRequest

func (c *GetRevisionsBinEntryCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetRevisionsBinEntryCommand) SetResponse

func (c *GetRevisionsBinEntryCommand) SetResponse(response []byte, fromCache bool) error

type GetRevisionsCommand

type GetRevisionsCommand struct {
	RavenCommandBase

	Result *JSONArrayResult
	// contains filtered or unexported fields
}

func NewGetRevisionsCommand

func NewGetRevisionsCommand(changeVectors []string, metadataOnly bool) *GetRevisionsCommand

func NewGetRevisionsCommandRange

func NewGetRevisionsCommandRange(id string, start int, pageSize int, metadataOnly bool) *GetRevisionsCommand

func (*GetRevisionsCommand) CreateRequest

func (c *GetRevisionsCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetRevisionsCommand) GetChangeVectors

func (c *GetRevisionsCommand) GetChangeVectors() []string

func (*GetRevisionsCommand) SetResponse

func (c *GetRevisionsCommand) SetResponse(response []byte, fromCache bool) error

type GetServerWideOperationStateCommand

type GetServerWideOperationStateCommand struct {
	RavenCommandBase

	Result map[string]interface{}
	// contains filtered or unexported fields
}

func NewGetServerWideOperationStateCommand

func NewGetServerWideOperationStateCommand(conventions *DocumentConventions, id int64) *GetServerWideOperationStateCommand

func (*GetServerWideOperationStateCommand) CreateRequest

func (c *GetServerWideOperationStateCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetServerWideOperationStateCommand) SetResponse

func (c *GetServerWideOperationStateCommand) SetResponse(response []byte, fromCache bool) error

type GetServerWideOperationStateOperation

type GetServerWideOperationStateOperation struct {
	// contains filtered or unexported fields
}

func (*GetServerWideOperationStateOperation) GetCommand

type GetStatisticsCommand

type GetStatisticsCommand struct {
	RavenCommandBase

	Result *DatabaseStatistics
	// contains filtered or unexported fields
}

func NewGetStatisticsCommand

func NewGetStatisticsCommand(debugTag string) *GetStatisticsCommand

func (*GetStatisticsCommand) CreateRequest

func (c *GetStatisticsCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetStatisticsCommand) SetResponse

func (c *GetStatisticsCommand) SetResponse(response []byte, fromCache bool) error

type GetStatisticsOperation

type GetStatisticsOperation struct {
	Command *GetStatisticsCommand
	// contains filtered or unexported fields
}

func NewGetStatisticsOperation

func NewGetStatisticsOperation(debugTag string) *GetStatisticsOperation

func (*GetStatisticsOperation) GetCommand

func (o *GetStatisticsOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type GetSubscriptionStateCommand

type GetSubscriptionStateCommand struct {
	RavenCommandBase

	Result *SubscriptionState
	// contains filtered or unexported fields
}

GetSubscriptionStateCommand describes "get subscription state" command

func (*GetSubscriptionStateCommand) CreateRequest

func (c *GetSubscriptionStateCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetSubscriptionStateCommand) SetResponse

func (c *GetSubscriptionStateCommand) SetResponse(response []byte, fromCache bool) error

type GetSubscriptionsCommand

type GetSubscriptionsCommand struct {
	RavenCommandBase

	Result []*SubscriptionState
	// contains filtered or unexported fields
}

GetSubscriptionsCommand describes "delete subscription" command

func (*GetSubscriptionsCommand) CreateRequest

func (c *GetSubscriptionsCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetSubscriptionsCommand) SetResponse

func (c *GetSubscriptionsCommand) SetResponse(response []byte, fromCache bool) error

type GetSubscriptionsResult

type GetSubscriptionsResult struct {
	Results []*SubscriptionState `json:"Results"`
}

GetSubscriptionsResult represents result of "get subscriptions"

type GetTcpInfoCommand

type GetTcpInfoCommand struct {
	RavenCommandBase

	Result *TcpConnectionInfo
	// contains filtered or unexported fields
}

GetTcpInfoCommand describes "get tcp info" command

func NewGetTcpInfoCommand

func NewGetTcpInfoCommand(tag, dbName string) *GetTcpInfoCommand

NewGetTcpInfoCommand returns new GetTcpInfoCommand dbName is optional

func (*GetTcpInfoCommand) CreateRequest

func (c *GetTcpInfoCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetTcpInfoCommand) SetResponse

func (c *GetTcpInfoCommand) SetResponse(response []byte, fromCache bool) error

type GetTermsCommand

type GetTermsCommand struct {
	RavenCommandBase

	Result []string
	// contains filtered or unexported fields
}

GetTermsCommand represents "get terms" command

func NewGetTermsCommand

func NewGetTermsCommand(indexName string, field string, fromValue string, pageSize int) (*GetTermsCommand, error)

NewGetTermsCommand returns new GetTermsCommand

func (*GetTermsCommand) CreateRequest

func (c *GetTermsCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*GetTermsCommand) SetResponse

func (c *GetTermsCommand) SetResponse(response []byte, fromCache bool) error

type GetTermsOperation

type GetTermsOperation struct {
	Command *GetTermsCommand
	// contains filtered or unexported fields
}

GetTermsOperation represents "get terms" operation

func NewGetTermsOperation

func NewGetTermsOperation(indexName string, field string, fromValue string, pageSize int) (*GetTermsOperation, error)

NewGetTermsOperation returns GetTermsOperation. pageSize 0 means default size

func (*GetTermsOperation) GetCommand

func (o *GetTermsOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

GetCommand returns command for this operation

type GroupBy

type GroupBy struct {
	Field  string
	Method GroupByMethod
}

GroupBy represents arguments to "group by" query

func NewGroupByArray

func NewGroupByArray(fieldName string) *GroupBy

NewGroupByField returns new GroupBy for an array

func NewGroupByField

func NewGroupByField(fieldName string) *GroupBy

NewGroupByField returns new GroupBy for a field

type GroupByDocumentQuery

type GroupByDocumentQuery struct {
	// contains filtered or unexported fields
}

GroupByDocumentQuery represents a "group by" query

func (*GroupByDocumentQuery) SelectCount

func (q *GroupByDocumentQuery) SelectCount() *DocumentQuery

func (*GroupByDocumentQuery) SelectCountWithName

func (q *GroupByDocumentQuery) SelectCountWithName(projectedName string) *DocumentQuery

func (*GroupByDocumentQuery) SelectKey

func (*GroupByDocumentQuery) SelectKeyWithName

func (q *GroupByDocumentQuery) SelectKeyWithName(fieldName string) *GroupByDocumentQuery

func (*GroupByDocumentQuery) SelectKeyWithNameAndProjectedName

func (q *GroupByDocumentQuery) SelectKeyWithNameAndProjectedName(fieldName string, projectedName string) *GroupByDocumentQuery

func (*GroupByDocumentQuery) SelectSum

func (q *GroupByDocumentQuery) SelectSum(field *GroupByField, fields ...*GroupByField) *DocumentQuery

type GroupByField

type GroupByField struct {
	FieldName     string
	ProjectedName string
}

GroupByField represents a field by which to group in a query

type GroupByMethod

type GroupByMethod = string

type HashCalculator

type HashCalculator struct {
	// contains filtered or unexported fields
}

type HeadAttachmentCommand

type HeadAttachmentCommand struct {
	RavenCommandBase

	Result string // TODO: should this be *string?
	// contains filtered or unexported fields
}

func NewHeadAttachmentCommand

func NewHeadAttachmentCommand(documentID string, name string, changeVector *string) (*HeadAttachmentCommand, error)

func (*HeadAttachmentCommand) CreateRequest

func (c *HeadAttachmentCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*HeadAttachmentCommand) SetResponse

func (c *HeadAttachmentCommand) SetResponse(response []byte, fromCache bool) error

type HeadDocumentCommand

type HeadDocumentCommand struct {
	RavenCommandBase

	Result *string // change vector
	// contains filtered or unexported fields
}

HeadDocumentCommand describes "head document" command

func NewHeadDocumentCommand

func NewHeadDocumentCommand(id string, changeVector *string) *HeadDocumentCommand

NewHeadDocumentCommand returns new HeadDocumentCommand

func (*HeadDocumentCommand) CreateRequest

func (c *HeadDocumentCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*HeadDocumentCommand) Exists

func (c *HeadDocumentCommand) Exists() bool

Exists returns true if the command has a result

func (*HeadDocumentCommand) ProcessResponse

func (c *HeadDocumentCommand) ProcessResponse(cache *httpCache, response *http.Response, url string) (responseDisposeHandling, error)

ProcessResponse processes HTTP response

func (*HeadDocumentCommand) SetResponse

func (c *HeadDocumentCommand) SetResponse(response []byte, fromCache bool) error

type HiLoIDGenerator

type HiLoIDGenerator struct {
	// contains filtered or unexported fields
}

HiLoIDGenerator generates document ids server side

func NewHiLoIDGenerator

func NewHiLoIDGenerator(tag string, store *DocumentStore, dbName string, identityPartsSeparator string) *HiLoIDGenerator

NewHiLoIDGenerator creates a HiLoIDGenerator

func (*HiLoIDGenerator) GenerateDocumentID

func (g *HiLoIDGenerator) GenerateDocumentID(entity interface{}) (string, error)

GenerateDocumentID returns next key

func (*HiLoIDGenerator) GetDocumentIDFromID

func (g *HiLoIDGenerator) GetDocumentIDFromID(nextID int64) string

func (*HiLoIDGenerator) GetNextRange

func (g *HiLoIDGenerator) GetNextRange() error

func (*HiLoIDGenerator) NextID

func (g *HiLoIDGenerator) NextID() (int64, error)

func (*HiLoIDGenerator) ReturnUnusedRange

func (g *HiLoIDGenerator) ReturnUnusedRange() error

ReturnUnusedRange returns unused range to the server

type HiLoResult

type HiLoResult struct {
	Prefix      string `json:"Prefix"`
	Low         int64  `json:"Low"`
	High        int64  `json:"High"`
	LastSize    int64  `json:"LastSize"`
	ServerTag   string `json:"ServerTag"`
	LastRangeAt *Time  `json:"LastRangeAt"`
}

HiLoResult is a result of HiLoResult command

type HiLoReturnCommand

type HiLoReturnCommand struct {
	RavenCommandBase
	// contains filtered or unexported fields
}

HiLoReturnCommand represents "hi lo return" command

func NewHiLoReturnCommand

func NewHiLoReturnCommand(tag string, last int64, end int64) (*HiLoReturnCommand, error)

NewHiLoReturnCommand returns a new HiLoReturnCommand

func (*HiLoReturnCommand) CreateRequest

func (c *HiLoReturnCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type ICommandData

type ICommandData interface {
	// contains filtered or unexported methods
}

ICommandData represents command data

func NewDeleteCommandData

func NewDeleteCommandData(id string, changeVector string) ICommandData

NewDeleteCommandData creates ICommandData for Delete command

func NewPatchCommandData

func NewPatchCommandData(id string, changeVector *string, patch *PatchRequest, patchIfMissing *PatchRequest) ICommandData

NewPatchCommandData creates CommandData for Delete Attachment command TODO: return a concrete type?

type ICompareExchangeValue

type ICompareExchangeValue interface {
	GetKey() string
	GetIndex() int64
	SetIndex(int64)
	GetValue() interface{}
	GetMetadata() *MetadataAsDictionary
	HasMetadata() bool
}

type IContent

type IContent interface {
	// contains filtered or unexported methods
}

type ILazyOperation

type ILazyOperation interface {
	// contains filtered or unexported methods
}

ILazyOperation defines methods required to implement lazy operation

type IMaintenanceOperation

type IMaintenanceOperation interface {
	GetCommand(*DocumentConventions) (RavenCommand, error)
}

type IMoreLikeThisBuilderBase

type IMoreLikeThisBuilderBase interface {
	UsingAnyDocument() IMoreLikeThisOperations
	UsingDocument(documentJson string) IMoreLikeThisOperations
}

type IMoreLikeThisBuilderForDocumentQuery

type IMoreLikeThisBuilderForDocumentQuery interface {
	// Note: it's usingDocument() in Java but conflicts with IMoreLikeThisBuilderBase
	UsingDocumentWithBuilder(builder func(*DocumentQuery)) IMoreLikeThisOperations

	UsingAnyDocument() IMoreLikeThisOperations
	UsingDocument(string) IMoreLikeThisOperations
}

type IMoreLikeThisOperations

type IMoreLikeThisOperations interface {
	WithOptions(options *MoreLikeThisOptions) IMoreLikeThisOperations
}

type IOperation

type IOperation interface {
	GetCommand(store *DocumentStore, conventions *DocumentConventions, cache *httpCache) (RavenCommand, error)
}

type IRaftCommand

type IRaftCommand interface {
	RaftUniqueRequestId() string
}

type IServerOperation

type IServerOperation interface {
	GetCommand(*DocumentConventions) (RavenCommand, error)
}

type IVoidMaintenanceOperation

type IVoidMaintenanceOperation = IMaintenanceOperation

For documentation/porting only. Go has no generics so it's the same as IMaintenanceOperation

type IllegalArgumentError

type IllegalArgumentError struct {
	// contains filtered or unexported fields
}

IllegalArgumentError represents illegal argument error

func (*IllegalArgumentError) Error

func (e *IllegalArgumentError) Error() string

Error makes it conform to error interface

func (*IllegalArgumentError) WrappedError

func (e *IllegalArgumentError) WrappedError() error

hackish way to get a wrapped error

type IllegalStateError

type IllegalStateError struct {
	// contains filtered or unexported fields
}

IllegalStateError represents illegal state error

func (*IllegalStateError) Error

func (e *IllegalStateError) Error() string

Error makes it conform to error interface

func (*IllegalStateError) WrappedError

func (e *IllegalStateError) WrappedError() error

hackish way to get a wrapped error

type InMemoryDocumentSessionOperations

type InMemoryDocumentSessionOperations struct {
	DatabaseName string

	Conventions *DocumentConventions
	// contains filtered or unexported fields
}

InMemoryDocumentSessionOperations represents database operations queued in memory

func (*InMemoryDocumentSessionOperations) AddAfterSaveChangesListener

func (s *InMemoryDocumentSessionOperations) AddAfterSaveChangesListener(handler func(*AfterSaveChangesEventArgs)) int

AddAfterSaveChangesListener registers a function that will be called before saving changes. Returns listener id that can be passed to RemoveAfterSaveChangesListener to unregister the listener.

func (*InMemoryDocumentSessionOperations) AddBeforeDeleteListener

func (s *InMemoryDocumentSessionOperations) AddBeforeDeleteListener(handler func(*BeforeDeleteEventArgs)) int

AddBeforeDeleteListener registers a function that will be called before deleting an entity. Returns listener id that can be passed to RemoveBeforeDeleteListener to unregister the listener.

func (*InMemoryDocumentSessionOperations) AddBeforeQueryListener

func (s *InMemoryDocumentSessionOperations) AddBeforeQueryListener(handler func(*BeforeQueryEventArgs)) int

AddBeforeQueryListener registers a function that will be called before running a query. It allows customizing query via DocumentQueryCustomization. Returns listener id that can be passed to RemoveBeforeQueryListener to unregister the listener.

func (*InMemoryDocumentSessionOperations) AddBeforeStoreListener

func (s *InMemoryDocumentSessionOperations) AddBeforeStoreListener(handler func(*BeforeStoreEventArgs)) int

AddBeforeStoreStoreListener registers a function that will be called before storing an entity. Returns listener id that can be passed to RemoveBeforeStoreListener to unregister the listener.

func (*InMemoryDocumentSessionOperations) Clear

Clear clears the session

func (*InMemoryDocumentSessionOperations) Close

Close performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

func (*InMemoryDocumentSessionOperations) Defer

func (s *InMemoryDocumentSessionOperations) Defer(commands ...ICommandData)

Defer defers commands to be executed on SaveChanges()

func (*InMemoryDocumentSessionOperations) Delete

func (s *InMemoryDocumentSessionOperations) Delete(entity interface{}) error

Delete marks the specified entity for deletion. The entity will be deleted when SaveChanges is called.

func (*InMemoryDocumentSessionOperations) DeleteByID

func (s *InMemoryDocumentSessionOperations) DeleteByID(id string, expectedChangeVector string) error

DeleteByID marks the specified entity for deletion. The entity will be deleted when SaveChanges is called. WARNING: This method will not call beforeDelete listener!

func (*InMemoryDocumentSessionOperations) Evict

func (s *InMemoryDocumentSessionOperations) Evict(entity interface{}) error

Evict evicts the specified entity from the session. Remove the entity from the delete queue and stops tracking changes for this entity.

func (*InMemoryDocumentSessionOperations) GenerateID

func (s *InMemoryDocumentSessionOperations) GenerateID(entity interface{}) (string, error)

func (*InMemoryDocumentSessionOperations) GetChangeVectorFor

func (s *InMemoryDocumentSessionOperations) GetChangeVectorFor(instance interface{}) (*string, error)

GetChangeVectorFor returns metadata for a given instance empty string means there is not change vector

func (*InMemoryDocumentSessionOperations) GetClusterSession

func (*InMemoryDocumentSessionOperations) GetConventions

GetConventions returns DocumentConventions

func (*InMemoryDocumentSessionOperations) GetCurrentSessionNode

func (s *InMemoryDocumentSessionOperations) GetCurrentSessionNode() (*ServerNode, error)

func (*InMemoryDocumentSessionOperations) GetDeferredCommandsCount

func (s *InMemoryDocumentSessionOperations) GetDeferredCommandsCount() int

GetDeferredCommandsCount returns number of deferred commands

func (*InMemoryDocumentSessionOperations) GetDocumentID

func (s *InMemoryDocumentSessionOperations) GetDocumentID(instance interface{}) string

GetDocumentID returns id of a given instance

func (*InMemoryDocumentSessionOperations) GetDocumentStore

func (s *InMemoryDocumentSessionOperations) GetDocumentStore() *DocumentStore

func (*InMemoryDocumentSessionOperations) GetLastModifiedFor

func (s *InMemoryDocumentSessionOperations) GetLastModifiedFor(instance interface{}) (*time.Time, error)

GetLastModifiedFor returns last modified time for a given instance

func (*InMemoryDocumentSessionOperations) GetMetadataFor

func (s *InMemoryDocumentSessionOperations) GetMetadataFor(instance interface{}) (*MetadataAsDictionary, error)

GetMetadataFor gets the metadata for the specified entity. TODO: should we make the API more robust by accepting **struct as well as *struct and doing the necessary tweaking automatically? It looks like GetMetadataFor(&foo) might be used reflexively and it might not be easy to figure out why it fails. Alternatively, error out early with informative error message

func (*InMemoryDocumentSessionOperations) GetNumberOfEntitiesInUnitOfWork

func (s *InMemoryDocumentSessionOperations) GetNumberOfEntitiesInUnitOfWork() int

GetNumberOfEntitiesInUnitOfWork returns number of entities

func (*InMemoryDocumentSessionOperations) GetNumberOfRequests

func (s *InMemoryDocumentSessionOperations) GetNumberOfRequests() int

GetNumberOfRequests returns number of requests sent to the server

func (*InMemoryDocumentSessionOperations) GetOperations

func (*InMemoryDocumentSessionOperations) GetRequestExecutor

func (s *InMemoryDocumentSessionOperations) GetRequestExecutor() *RequestExecutor

func (*InMemoryDocumentSessionOperations) HasChanged

func (s *InMemoryDocumentSessionOperations) HasChanged(entity interface{}) (bool, error)

HasChanged returns true if an entity has changed.

func (*InMemoryDocumentSessionOperations) HasChanges

func (s *InMemoryDocumentSessionOperations) HasChanges() bool

Gets a value indicating whether any of the entities tracked by the session has changes.

func (*InMemoryDocumentSessionOperations) IgnoreChangesFor

func (s *InMemoryDocumentSessionOperations) IgnoreChangesFor(entity interface{}) error

IgnoreChangesFor marks the entity as one that should be ignore for change tracking purposes, it still takes part in the session, but is ignored for SaveChanges.

func (*InMemoryDocumentSessionOperations) IsDeleted

IsDeleted returns true if document with this id is deleted in this session

func (*InMemoryDocumentSessionOperations) IsLoaded

IsLoaded returns true if document with this id is loaded

func (*InMemoryDocumentSessionOperations) IsLoadedOrDeleted

func (s *InMemoryDocumentSessionOperations) IsLoadedOrDeleted(id string) bool

IsLoadedOrDeleted returns true if document with this id is loaded

func (*InMemoryDocumentSessionOperations) NoTracking

func (s *InMemoryDocumentSessionOperations) NoTracking(mode bool)

Track entities in session. Default: false

func (*InMemoryDocumentSessionOperations) RemoveAfterSaveChangesListener

func (s *InMemoryDocumentSessionOperations) RemoveAfterSaveChangesListener(handlerID int)

RemoveAfterSaveChangesListener removes a listener given id returned by AddAfterSaveChangesListener

func (*InMemoryDocumentSessionOperations) RemoveBeforeDeleteListener

func (s *InMemoryDocumentSessionOperations) RemoveBeforeDeleteListener(handlerID int)

RemoveBeforeDeleteListener removes a listener given id returned by AddBeforeDeleteListener

func (*InMemoryDocumentSessionOperations) RemoveBeforeQueryListener

func (s *InMemoryDocumentSessionOperations) RemoveBeforeQueryListener(handlerID int)

RemoveBeforeQueryListener removes a listener given id returned by AddBeforeQueryListener

func (*InMemoryDocumentSessionOperations) RemoveBeforeStoreListener

func (s *InMemoryDocumentSessionOperations) RemoveBeforeStoreListener(handlerID int)

RemoveBeforeStoreListener removes a listener given id returned by AddBeforeStoreListener

func (*InMemoryDocumentSessionOperations) Store

func (s *InMemoryDocumentSessionOperations) Store(entity interface{}) error

Store stores entity in the session. The entity will be saved when SaveChanges is called.

func (*InMemoryDocumentSessionOperations) StoreWithChangeVectorAndID

func (s *InMemoryDocumentSessionOperations) StoreWithChangeVectorAndID(entity interface{}, changeVector string, id string) error

StoreWithChangeVectorAndID stores entity in the session, explicitly specifying its id and change vector. The entity will be saved when SaveChanges is called.

func (*InMemoryDocumentSessionOperations) StoreWithID

func (s *InMemoryDocumentSessionOperations) StoreWithID(entity interface{}, id string) error

StoreWithID stores entity in the session, explicitly specifying its Id. The entity will be saved when SaveChanges is called.

func (*InMemoryDocumentSessionOperations) TrackEntity

func (s *InMemoryDocumentSessionOperations) TrackEntity(result interface{}, id string, document map[string]interface{}, metadata map[string]interface{}, noTracking bool) error

TrackEntity tracks a given object result is a pointer to a decoded value (e.g. **Foo) and will be set with value decoded from JSON (e.g. *result = &Foo{})

func (*InMemoryDocumentSessionOperations) TrackEntityInDocumentInfo

func (s *InMemoryDocumentSessionOperations) TrackEntityInDocumentInfo(result interface{}, documentFound *documentInfo) error

result is a pointer to expected value

func (*InMemoryDocumentSessionOperations) UpdateMetadataModifications

func (s *InMemoryDocumentSessionOperations) UpdateMetadataModifications(documentInfo *documentInfo) bool

func (*InMemoryDocumentSessionOperations) UpdateMetadataModificationsTemp

func (s *InMemoryDocumentSessionOperations) UpdateMetadataModificationsTemp(metadataInstance *MetadataAsDictionary, metadata map[string]interface{}) bool

func (*InMemoryDocumentSessionOperations) WaitForIndexesAfterSaveChanges

func (s *InMemoryDocumentSessionOperations) WaitForIndexesAfterSaveChanges(options func(*IndexesWaitOptsBuilder))

func (*InMemoryDocumentSessionOperations) WaitForReplicationAfterSaveChanges

func (s *InMemoryDocumentSessionOperations) WaitForReplicationAfterSaveChanges(options func(*ReplicationWaitOptsBuilder))

func (*InMemoryDocumentSessionOperations) WhatChanged

type IndexAlreadyExistError

type IndexAlreadyExistError struct {
	RavenError
}

func (*IndexAlreadyExistError) Error

func (e *IndexAlreadyExistError) Error() string

Error makes it conform to error interface

func (*IndexAlreadyExistError) WrappedError

func (e *IndexAlreadyExistError) WrappedError() error

hackish way to get a wrapped error

type IndexChange

type IndexChange struct {
	Type IndexChangeTypes
	Name string
}

IndexChange describes a change to the index. Can be used as DatabaseChange.

type IndexChangeTypes

type IndexChangeTypes = string

type IndexCompilationError

type IndexCompilationError struct {
	RavenError
}

func (*IndexCompilationError) Error

func (e *IndexCompilationError) Error() string

Error makes it conform to error interface

func (*IndexCompilationError) WrappedError

func (e *IndexCompilationError) WrappedError() error

hackish way to get a wrapped error

type IndexConfiguration

type IndexConfiguration = map[string]string

TODO: desugar

func NewIndexConfiguration

func NewIndexConfiguration() IndexConfiguration

type IndexCreationError

type IndexCreationError struct {
	RavenError
}

func (*IndexCreationError) Error

func (e *IndexCreationError) Error() string

Error makes it conform to error interface

func (*IndexCreationError) WrappedError

func (e *IndexCreationError) WrappedError() error

hackish way to get a wrapped error

type IndexCreationTask

type IndexCreationTask struct {
	// for a single map index, set Map
	// for multiple map index, set Maps
	Map  string
	Maps []string

	Reduce string

	Conventions       *DocumentConventions
	AdditionalSources map[string]string
	Priority          IndexPriority
	LockMode          IndexLockMode

	StoresStrings         map[string]FieldStorage
	IndexesStrings        map[string]FieldIndexing
	AnalyzersStrings      map[string]string
	IndexSuggestions      []string
	TermVectorsStrings    map[string]FieldTermVector
	SpatialOptionsStrings map[string]*SpatialOptions

	OutputReduceToCollection string

	// Note: in Go IndexName must provided explicitly
	// In Java it's dynamically calculated as getClass().getSimpleName()
	IndexName string
}

IndexCreationTask is for creating IndexDefinition

func NewIndexCreationTask

func NewIndexCreationTask(indexName string) *IndexCreationTask

NewAbstractIndexCreationTask returns new IndexCreationTask

func (*IndexCreationTask) Analyze

func (t *IndexCreationTask) Analyze(field string, analyzer string)

Analyze registers field to be analyzed

func (*IndexCreationTask) CreateIndexDefinition

func (t *IndexCreationTask) CreateIndexDefinition() *IndexDefinition

CreateIndexDefinition creates IndexDefinition

func (*IndexCreationTask) Execute

func (t *IndexCreationTask) Execute(store *DocumentStore, conventions *DocumentConventions, database string) error

Execute executes index in specified document store

func (*IndexCreationTask) Index

func (t *IndexCreationTask) Index(field string, indexing FieldIndexing)

Index registers field to be indexed

func (*IndexCreationTask) IsMapReduce

func (t *IndexCreationTask) IsMapReduce() bool

IsMapReduce returns true if this is map-reduce index

func (*IndexCreationTask) Spatial

func (t *IndexCreationTask) Spatial(field string, indexing func() *SpatialOptions)

Spatial registers field to be spatially indexed

func (*IndexCreationTask) Store

func (t *IndexCreationTask) Store(field string, storage FieldStorage)

Store registers field to be stored

func (*IndexCreationTask) StoreAllFields

func (t *IndexCreationTask) StoreAllFields(storage FieldStorage)

StoreAllFields selects if we're storing all fields or not

func (*IndexCreationTask) Suggestion

func (t *IndexCreationTask) Suggestion(field string)

Suggestion registers field to be indexed as suggestions

func (*IndexCreationTask) TermVector

func (t *IndexCreationTask) TermVector(field string, termVector FieldTermVector)

TermVector registers field to have term vectors

type IndexDefinition

type IndexDefinition struct {
	Name              string                        `json:"Name"`
	Priority          IndexPriority                 `json:"Priority,omitempty"`
	LockMode          IndexLockMode                 `json:"LockMode,omitempty"`
	AdditionalSources map[string]string             `json:"AdditionalSources"`
	Maps              []string                      `json:"Maps"`
	Reduce            *string                       `json:"Reduce"`
	Fields            map[string]*IndexFieldOptions `json:"Fields"`
	Configuration     IndexConfiguration            `json:"Configuration"`
	IndexType         IndexType                     `json:"Type"`
	//TBD 4.1  bool testIndex;
	OutputReduceToCollection                     *string `json:"OutputReduceToCollection"`
	PatternReferencesCollectionName              *string `json:"PatternReferencesCollectionName"`
	PatternForOutputReduceToCollectionReferences *string `json:"PatternForOutputReduceToCollectionReferences"`
}

func NewIndexDefinition

func NewIndexDefinition() *IndexDefinition

func (*IndexDefinition) GetAdditionalSources

func (d *IndexDefinition) GetAdditionalSources() map[string]string

func (*IndexDefinition) GetConfiguration

func (d *IndexDefinition) GetConfiguration() IndexConfiguration

func (*IndexDefinition) GetFields

func (d *IndexDefinition) GetFields() map[string]*IndexFieldOptions

func (*IndexDefinition) GetOutputReduceToCollection

func (d *IndexDefinition) GetOutputReduceToCollection() *string

func (*IndexDefinition) GetType

func (d *IndexDefinition) GetType() IndexType

func (*IndexDefinition) SetAdditionalSources

func (d *IndexDefinition) SetAdditionalSources(additionalSources map[string]string)

func (*IndexDefinition) SetConfiguration

func (d *IndexDefinition) SetConfiguration(configuration IndexConfiguration)

func (*IndexDefinition) SetOutputReduceToCollection

func (d *IndexDefinition) SetOutputReduceToCollection(outputReduceToCollection string)

func (*IndexDefinition) SetType

func (d *IndexDefinition) SetType(indexType IndexType)

func (*IndexDefinition) String

func (d *IndexDefinition) String() string

type IndexDefinitionBuilder

type IndexDefinitionBuilder struct {
	// contains filtered or unexported fields
}

func NewIndexDefinitionBuilder

func NewIndexDefinitionBuilder(indexName string) *IndexDefinitionBuilder

type IndexDeletionError

type IndexDeletionError struct {
	RavenError
}

func (*IndexDeletionError) Error

func (e *IndexDeletionError) Error() string

Error makes it conform to error interface

func (*IndexDeletionError) WrappedError

func (e *IndexDeletionError) WrappedError() error

hackish way to get a wrapped error

type IndexDoesNotExistError

type IndexDoesNotExistError struct {
	RavenError
}

IndexDoesNotExistError represents "index doesn't exist" error

func (*IndexDoesNotExistError) Error

func (e *IndexDoesNotExistError) Error() string

Error makes it conform to error interface

func (*IndexDoesNotExistError) WrappedError

func (e *IndexDoesNotExistError) WrappedError() error

hackish way to get a wrapped error

type IndexErrors

type IndexErrors struct {
	Name   string           `json:"Name"`
	Errors []*IndexingError `json:"Errors"`
}

IndexErrors describes index errors

type IndexFieldOptions

type IndexFieldOptions struct {
	Storage     FieldStorage    `json:"Storage,omitempty"`
	Indexing    FieldIndexing   `json:"Indexing,omitempty"`
	TermVector  FieldTermVector `json:"TermVector,omitempty"`
	Spatial     *SpatialOptions `json:"Spatial"`
	Analyzer    string          `json:"Analyzer,omitempty"`
	Suggestions bool            `json:"Suggestions"`
}

func NewIndexFieldOptions

func NewIndexFieldOptions() *IndexFieldOptions

type IndexHasChangedCommand

type IndexHasChangedCommand struct {
	RavenCommandBase

	Result bool
	// contains filtered or unexported fields
}

func NewIndexHasChangedCommand

func NewIndexHasChangedCommand(conventions *DocumentConventions, definition *IndexDefinition) (*IndexHasChangedCommand, error)

func (*IndexHasChangedCommand) CreateRequest

func (c *IndexHasChangedCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*IndexHasChangedCommand) SetResponse

func (c *IndexHasChangedCommand) SetResponse(response []byte, fromCache bool) error

type IndexHasChangedOperation

type IndexHasChangedOperation struct {
	Command *IndexHasChangedCommand
	// contains filtered or unexported fields
}

func NewIndexHasChangedOperation

func NewIndexHasChangedOperation(definition *IndexDefinition) *IndexHasChangedOperation

func (*IndexHasChangedOperation) GetCommand

func (o *IndexHasChangedOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type IndexInformation

type IndexInformation struct {
	Name             string        `json:"Name"`
	IsStale          bool          `json:"IsStale"`
	State            IndexState    `json:"State"`
	LockMode         IndexLockMode `json:"LockMode"`
	Priority         IndexPriority `json:"Priority"`
	Type             IndexType     `json:"Type"`
	LastIndexingTime Time          `json:"LastIndexingTime"`
}

func (*IndexInformation) GetLastIndexingTime

func (i *IndexInformation) GetLastIndexingTime() time.Time

type IndexInvalidError

type IndexInvalidError struct {
	RavenError
}

func (*IndexInvalidError) Error

func (e *IndexInvalidError) Error() string

Error makes it conform to error interface

func (*IndexInvalidError) WrappedError

func (e *IndexInvalidError) WrappedError() error

hackish way to get a wrapped error

type IndexLockMode

type IndexLockMode = string

type IndexPriority

type IndexPriority = string

type IndexQuery

type IndexQuery struct {
	// contains filtered or unexported fields
}

func NewIndexQuery

func NewIndexQuery(query string) *IndexQuery

from IndexQuery

func (*IndexQuery) GetQuery

func (q *IndexQuery) GetQuery() string

TODO: only for tests? Could expose with build-tags only for testing

func (*IndexQuery) GetQueryHash

func (q *IndexQuery) GetQueryHash() string

func (*IndexQuery) GetQueryParameters

func (q *IndexQuery) GetQueryParameters() Parameters

TODO: only for tests? Could expose with build-tags only for testing

func (*IndexQuery) String

func (q *IndexQuery) String() string

type IndexQueryContent

type IndexQueryContent struct {
	// contains filtered or unexported fields
}

func NewIndexQueryContent

func NewIndexQueryContent(conventions *DocumentConventions, query *IndexQuery) *IndexQueryContent

type IndexRunningStatus

type IndexRunningStatus = string

type IndexState

type IndexState = string

type IndexStats

type IndexStats struct {
	Name                          string  `json:"Name"`
	MapAttempts                   int     `json:"MapAttempts"`
	MapSuccesses                  int     `json:"MapSuccesses"`
	MapErrors                     int     `json:"MapErrors"`
	ReduceAttempts                *int    `json:"ReduceAttempts"`
	ReduceSuccesses               *int    `json:"ReduceSuccesses"`
	ReduceErrors                  *int    `json:"ReduceErrors"`
	MappedPerSecondRate           float64 `json:"MappedPerSecondRate"`
	ReducedPerSecondRate          float64 `json:"ReducedPerSecondRate"`
	MaxNumberOfOutputsPerDocument int     `json:"MaxNumberOfOutputsPerDocument"`

	Collections map[string]*CollectionStats `json:"Collections"`

	LastQueryingTime Time               `json:"LastQueryingTime"`
	State            IndexState         `json:"State"`
	Priority         IndexPriority      `json:"Priority"`
	CreatedTimestamp Time               `json:"CreatedTimestamp"`
	LastIndexingTime Time               `json:"LastIndexingTime"`
	IsStale          bool               `json:"Stale"`
	LockMode         IndexLockMode      `json:"LockMode"`
	Type             IndexType          `json:"Type"`
	Status           IndexRunningStatus `json:"Status"`
	EntriesCount     int                `json:"EntriesCount"`
	ErrorsCount      int                `json:"ErrorsCount"`
	TestIndex        bool               `json:"IsTestIndex"`
}

type IndexStatus

type IndexStatus struct {
	Name   string             `json:"Name"`
	Status IndexRunningStatus `json:"Status"`
}

type IndexType

type IndexType = string

type IndexesWaitOptsBuilder

type IndexesWaitOptsBuilder struct {
	// contains filtered or unexported fields
}

func (*IndexesWaitOptsBuilder) ThrowOnTimeout

func (b *IndexesWaitOptsBuilder) ThrowOnTimeout(shouldThrow bool) *IndexesWaitOptsBuilder

func (*IndexesWaitOptsBuilder) WaitForIndexes

func (b *IndexesWaitOptsBuilder) WaitForIndexes(indexes ...string) *IndexesWaitOptsBuilder

func (*IndexesWaitOptsBuilder) WithTimeout

type IndexingError

type IndexingError struct {
	Error     string `json:"Error"`
	Timestamp Time   `json:"Timestamp"`
	Document  string `json:"Document"`
	Action    string `json:"Action"`
}

IndexingError describes indexing error message from the server

func (*IndexingError) String

func (e *IndexingError) String() string

type IndexingStatus

type IndexingStatus struct {
	Status  IndexRunningStatus `json:"Status"`
	Indexes []*IndexStatus     `json:"Indexes"`
}

type InvalidQueryError

type InvalidQueryError struct {
	RavenError
}

func (*InvalidQueryError) Error

func (e *InvalidQueryError) Error() string

Error makes it conform to error interface

func (*InvalidQueryError) WrappedError

func (e *InvalidQueryError) WrappedError() error

hackish way to get a wrapped error

type JSONArrayResult

type JSONArrayResult struct {
	Results          []map[string]interface{} `json:"Results"`
	TransactionIndex int64                    `json:"TransactionIndex"`
}

JSONArrayResult describes server's JSON response to batch command

type JavaScriptArray

type JavaScriptArray struct {
	Parameters map[string]interface{}
	// contains filtered or unexported fields
}

JavaScriptArray builds arguments for patch operation on array fields

func NewJavaScriptArray

func NewJavaScriptArray(suffix int, pathToArray string) *JavaScriptArray

NewJavaScriptArray creates a new JavaScriptArray

func (*JavaScriptArray) Add

func (a *JavaScriptArray) Add(args ...interface{}) *JavaScriptArray

Add builds expression that adds an elements to array

func (*JavaScriptArray) GetScript

func (a *JavaScriptArray) GetScript() string

func (*JavaScriptArray) RemoveAt

func (a *JavaScriptArray) RemoveAt(index int) *JavaScriptArray

RemoveAt builds expression that removes an element at index from array

type JavaScriptError

type JavaScriptError struct {
	RavenError
}

func (*JavaScriptError) Error

func (e *JavaScriptError) Error() string

Error makes it conform to error interface

func (*JavaScriptError) WrappedError

func (e *JavaScriptError) WrappedError() error

hackish way to get a wrapped error

type KillOperationCommand

type KillOperationCommand struct {
	RavenCommandBase
	// contains filtered or unexported fields
}

KillOperationCommand represents "kill operation" command

func NewKillOperationCommand

func NewKillOperationCommand(id string) (*KillOperationCommand, error)

NewKillOperationCommand returns new KillOperationCommand

func (*KillOperationCommand) CreateRequest

func (c *KillOperationCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type Lazy

type Lazy struct {
	Value interface{}
	// contains filtered or unexported fields
}

Lazy represents a lazy operation

func (*Lazy) GetValue

func (l *Lazy) GetValue(result interface{}) error

GetValue executes lazy operation and ensures the Value is set in result variable provided in NewLazy()

func (*Lazy) IsValueCreated

func (l *Lazy) IsValueCreated() bool

IsValueCreated returns true if lazy value has been created

type LazyAggregationQueryOperation

type LazyAggregationQueryOperation struct {
	// contains filtered or unexported fields
}

LazyAggregationQueryOperation represents lazy aggregation query operation

type LazyLoadOperation

type LazyLoadOperation struct {
	// contains filtered or unexported fields
}

LazyLoadOperation represents lazy load operation

type LazyMultiLoaderWithInclude

type LazyMultiLoaderWithInclude struct {
	// contains filtered or unexported fields
}

LazyMultiLoaderWithInclude is for lazily loading one or more objects with includes

func NewLazyMultiLoaderWithInclude

func NewLazyMultiLoaderWithInclude(session *DocumentSession) *LazyMultiLoaderWithInclude

NewLazyMultiLoaderWithInclude creates a lazy multi loader with includes

func (*LazyMultiLoaderWithInclude) Include

Include adds ids of objects to add in a request

func (*LazyMultiLoaderWithInclude) Load

func (l *LazyMultiLoaderWithInclude) Load(id string) (*Lazy, error)

Load lazy loads a value with a given id into result

func (*LazyMultiLoaderWithInclude) LoadMulti

func (l *LazyMultiLoaderWithInclude) LoadMulti(ids []string) (*Lazy, error)

LoadMulti lazily loads multiple values of a given type with given ids

type LazyQueryOperation

type LazyQueryOperation struct {
	// contains filtered or unexported fields
}

LazyQueryOperation describes server operation for lazy queries

type LazySessionOperations

type LazySessionOperations struct {
	// contains filtered or unexported fields
}

LazySessionOperations describes API for lazy operations

func (*LazySessionOperations) Include

Include adds a given object path to be included in results

func (*LazySessionOperations) Load

func (o *LazySessionOperations) Load(id string) (*Lazy, error)

func (*LazySessionOperations) LoadMulti

func (o *LazySessionOperations) LoadMulti(ids []string) (*Lazy, error)

LoadMulti returns Lazy object for lazily loading multiple values of a given type and with given ids

func (*LazySessionOperations) LoadMultiWithEval

func (o *LazySessionOperations) LoadMultiWithEval(ids []string, onEval func(), onEvalResult interface{}) (*Lazy, error)

func (*LazySessionOperations) LoadStartingWith

func (o *LazySessionOperations) LoadStartingWith(args *StartsWithArgs) *Lazy

LoadStartingWith returns Lazy object for lazily loading multiple value of a given type and matching args results should be map[string]*Struct

func (*LazySessionOperations) LoadWithEval

func (o *LazySessionOperations) LoadWithEval(id string, onEval func(), onEvalResult interface{}) (*Lazy, error)

type LazyStartsWithOperation

type LazyStartsWithOperation struct {
	// contains filtered or unexported fields
}

LazyStartsWithOperation represents lazy starts with operation

func NewLazyStartsWithOperation

func NewLazyStartsWithOperation(idPrefix string, matches string, exclude string, start int, pageSize int, sessionOperations *InMemoryDocumentSessionOperations, startAfter string) *LazyStartsWithOperation

NewLazyStartsWithOperation returns new LazyStartsWithOperation TODO: convert to use StartsWithArgs

type LazySuggestionQueryOperation

type LazySuggestionQueryOperation struct {
	// contains filtered or unexported fields
}

type LeaderStamp

type LeaderStamp struct {
	Index        int64 `json:"Index"`
	Term         int64 `json:"Term"`
	LeadersTicks int64 `json:"LeadersTicks"`
}

LeaderStamp describes leader stamp

type LicenseActivationError

type LicenseActivationError struct {
	RavenError
}

func (*LicenseActivationError) Error

func (e *LicenseActivationError) Error() string

Error makes it conform to error interface

func (*LicenseActivationError) WrappedError

func (e *LicenseActivationError) WrappedError() error

hackish way to get a wrapped error

type LoadOperation

type LoadOperation struct {
	// contains filtered or unexported fields
}

LoadOperation represents a load operation

func NewLoadOperation

func NewLoadOperation(session *InMemoryDocumentSessionOperations) *LoadOperation

type LoadStartingWithOperation

type LoadStartingWithOperation struct {
	Command *GetDocumentsCommand
	// contains filtered or unexported fields
}

type MaintenanceOperationExecutor

type MaintenanceOperationExecutor struct {
	// contains filtered or unexported fields
}

func NewMaintenanceOperationExecutor

func NewMaintenanceOperationExecutor(store *DocumentStore, databaseName string) *MaintenanceOperationExecutor

func (*MaintenanceOperationExecutor) ForDatabase

func (*MaintenanceOperationExecutor) GetRequestExecutor

func (e *MaintenanceOperationExecutor) GetRequestExecutor() *RequestExecutor

func (*MaintenanceOperationExecutor) Send

func (*MaintenanceOperationExecutor) SendAsync

func (*MaintenanceOperationExecutor) Server

type MetadataAsDictionary

type MetadataAsDictionary struct {
	// contains filtered or unexported fields
}

MetadataAsDictionary describes metadata for a document

func NewMetadataAsDictionary

func NewMetadataAsDictionary(metadata map[string]interface{}, parent *MetadataAsDictionary, parentKey string) *MetadataAsDictionary

NewMetadataAsDictionary returns MetadataAsDictionary based on a given metadata and parent

func NewMetadataAsDictionaryWithMetadata

func NewMetadataAsDictionaryWithMetadata(metadata map[string]interface{}) *MetadataAsDictionary

NewMetadataAsDictionaryWithMetadata returns MetadataAsDictionary based on a given metadata

func NewMetadataAsDictionaryWithSource

func NewMetadataAsDictionaryWithSource(metadata map[string]interface{}) *MetadataAsDictionary

NewMetadataAsDictionaryWithSource returns MetadataAsDictionary based on a given source

func (*MetadataAsDictionary) Clear

func (d *MetadataAsDictionary) Clear()

Clear removes all metadata

func (*MetadataAsDictionary) ContainsKey

func (d *MetadataAsDictionary) ContainsKey(key string) bool

ContainsKey returns true if we have metadata value with a given key

func (*MetadataAsDictionary) ConvertValue

func (d *MetadataAsDictionary) ConvertValue(key string, value interface{}) interface{}

ConvertValue converts value with a given key to a desired type

func (*MetadataAsDictionary) EntrySet

func (d *MetadataAsDictionary) EntrySet() map[string]interface{}

EntrySet returns metadata as map[string]interface{}

func (*MetadataAsDictionary) Get

func (d *MetadataAsDictionary) Get(key string) (interface{}, bool)

Get returns metadata value with a given key

func (*MetadataAsDictionary) GetObjects

func (d *MetadataAsDictionary) GetObjects(key string) []*MetadataAsDictionary

GetObjects returns metadata info for a given key TODO: return an error instead of panicking on cast failures?

func (*MetadataAsDictionary) Init

func (d *MetadataAsDictionary) Init()

Init initializes metadata

func (*MetadataAsDictionary) IsDirty

func (d *MetadataAsDictionary) IsDirty() bool

IsDirty returns if we're dirty

func (*MetadataAsDictionary) IsEmpty

func (d *MetadataAsDictionary) IsEmpty() bool

func (*MetadataAsDictionary) KeySet

func (d *MetadataAsDictionary) KeySet() []string

KeySet returns all keys

func (*MetadataAsDictionary) MarkDirty

func (d *MetadataAsDictionary) MarkDirty()

MarkDirty marks us as dirty

func (*MetadataAsDictionary) Put

func (d *MetadataAsDictionary) Put(key string, value interface{}) interface{}

Put inserts a given value with a given key

func (*MetadataAsDictionary) Remove

func (d *MetadataAsDictionary) Remove(key string)

func (*MetadataAsDictionary) Size

func (d *MetadataAsDictionary) Size() int

Size returns number of metadata items

type MethodCall

type MethodCall interface {
}

type MethodCallData

type MethodCallData struct {
	// contains filtered or unexported fields
}

type MethodsType

type MethodsType = string

type ModifyOngoingTaskResult

type ModifyOngoingTaskResult struct {
	TaskID           int64  `json:"TaskId"`
	RaftCommandIndex int64  `json:"RaftCommandIndex"`
	ResponsibleNode  string `json:"ResponsibleNode"`
}

ModifyOngoingTaskResult represents a raven server command for modyfing task result

type MoreLikeThisBase

type MoreLikeThisBase interface {
	GetOptions() *MoreLikeThisOptions
	SetOptions(options *MoreLikeThisOptions)
}

type MoreLikeThisBuilder

type MoreLikeThisBuilder struct {
	// contains filtered or unexported fields
}

func NewMoreLikeThisBuilder

func NewMoreLikeThisBuilder() *MoreLikeThisBuilder

func (*MoreLikeThisBuilder) GetMoreLikeThis

func (b *MoreLikeThisBuilder) GetMoreLikeThis() MoreLikeThisBase

func (*MoreLikeThisBuilder) UsingAnyDocument

func (b *MoreLikeThisBuilder) UsingAnyDocument() IMoreLikeThisOperations

func (*MoreLikeThisBuilder) UsingDocument

func (b *MoreLikeThisBuilder) UsingDocument(documentJSON string) IMoreLikeThisOperations

func (*MoreLikeThisBuilder) UsingDocumentWithBuilder

func (b *MoreLikeThisBuilder) UsingDocumentWithBuilder(builder func(*DocumentQuery)) IMoreLikeThisOperations

func (*MoreLikeThisBuilder) WithOptions

type MoreLikeThisCommon

type MoreLikeThisCommon struct {
	// contains filtered or unexported fields
}

func (*MoreLikeThisCommon) GetOptions

func (c *MoreLikeThisCommon) GetOptions() *MoreLikeThisOptions

func (*MoreLikeThisCommon) SetOptions

func (c *MoreLikeThisCommon) SetOptions(options *MoreLikeThisOptions)

type MoreLikeThisOptions

type MoreLikeThisOptions struct {
	MinimumTermFrequency               *int     `json:"MinimumTermFrequency"`
	MaximumQueryTerms                  *int     `json:"MaximumQueryTerms"`
	MaximumNumberOfTokensParsed        *int     `json:"MaximumNumberOfTokensParsed"`
	MinimumWordLength                  *int     `json:"MinimumWordLength"`
	MaximumWordLength                  *int     `json:"MaximumWordLength"`
	MinimumDocumentFrequency           *int     `json:"MinimumDocumentFrequency"`
	MaximumDocumentFrequency           *int     `json:"MaximumDocumentFrequency"`
	MaximumDocumentFrequencyPercentage *int     `json:"MaximumDocumentFrequencyPercentage"`
	Boost                              *bool    `json:"Boost"`
	BoostFactor                        *float32 `json:"BoostFactor"`
	StopWordsDocumentID                *string  `json:"StopWordsDocumentId"`
	Fields                             []string `json:"Fields"`
}

func NewMoreLikeThisOptions

func NewMoreLikeThisOptions() *MoreLikeThisOptions

func (*MoreLikeThisOptions) SetBoost

func (o *MoreLikeThisOptions) SetBoost(boost bool)

func (*MoreLikeThisOptions) SetBoostFactor

func (o *MoreLikeThisOptions) SetBoostFactor(boostFactor float32)

func (*MoreLikeThisOptions) SetMaximumDocumentFrequency

func (o *MoreLikeThisOptions) SetMaximumDocumentFrequency(maximumDocumentFrequency int)

func (*MoreLikeThisOptions) SetMaximumDocumentFrequencyPercentage

func (o *MoreLikeThisOptions) SetMaximumDocumentFrequencyPercentage(maximumDocumentFrequencyPercentage int)

func (*MoreLikeThisOptions) SetMaximumNumberOfTokensParsed

func (o *MoreLikeThisOptions) SetMaximumNumberOfTokensParsed(maximumNumberOfTokensParsed int)

func (*MoreLikeThisOptions) SetMaximumQueryTerms

func (o *MoreLikeThisOptions) SetMaximumQueryTerms(maximumQueryTerms int)

func (*MoreLikeThisOptions) SetMaximumWordLength

func (o *MoreLikeThisOptions) SetMaximumWordLength(maximumWordLength int)

func (*MoreLikeThisOptions) SetMinimumDocumentFrequency

func (o *MoreLikeThisOptions) SetMinimumDocumentFrequency(minimumDocumentFrequency int)

func (*MoreLikeThisOptions) SetMinimumTermFrequency

func (o *MoreLikeThisOptions) SetMinimumTermFrequency(minimumTermFrequency int)

func (*MoreLikeThisOptions) SetMinimumWordLength

func (o *MoreLikeThisOptions) SetMinimumWordLength(minimumWordLength int)

func (*MoreLikeThisOptions) SetStopWordsDocumentID

func (o *MoreLikeThisOptions) SetStopWordsDocumentID(stopWordsDocumentID string)

type MoreLikeThisQueryResult

type MoreLikeThisQueryResult struct {
	DurationInMs int64 `json:"DurationInMs"`
	// contains filtered or unexported fields
}

MoreLikeThisQueryResult describes result of "more like this" operation

type MoreLikeThisStopWords

type MoreLikeThisStopWords struct {
	ID        string   `json:"Id"`
	StopWords []string `json:"StopWords"`
}

type MoreLikeThisUsingAnyDocument

type MoreLikeThisUsingAnyDocument struct {
	MoreLikeThisCommon
}

func NewMoreLikeThisUsingAnyDocument

func NewMoreLikeThisUsingAnyDocument() *MoreLikeThisUsingAnyDocument

type MoreLikeThisUsingDocument

type MoreLikeThisUsingDocument struct {
	MoreLikeThisCommon
	// contains filtered or unexported fields
}

MoreLikeThisUsingDocument represents more like this with a document

type MoreLikeThisUsingDocumentForDocumentQuery

type MoreLikeThisUsingDocumentForDocumentQuery struct {
	MoreLikeThisCommon
	// contains filtered or unexported fields
}

func NewMoreLikeThisUsingDocumentForDocumentQuery

func NewMoreLikeThisUsingDocumentForDocumentQuery() *MoreLikeThisUsingDocumentForDocumentQuery

func (*MoreLikeThisUsingDocumentForDocumentQuery) GetForDocumentQuery

func (m *MoreLikeThisUsingDocumentForDocumentQuery) GetForDocumentQuery() func(*DocumentQuery)

type MultiDatabaseHiLoIDGenerator

type MultiDatabaseHiLoIDGenerator struct {
	// contains filtered or unexported fields
}

MultiDatabaseHiLoIDGenerator manages per-database HiLoKeyGenerotr

func NewMultiDatabaseHiLoIDGenerator

func NewMultiDatabaseHiLoIDGenerator(store *DocumentStore, conventions *DocumentConventions) *MultiDatabaseHiLoIDGenerator

NewMultiDatabaseHiLoIDGenerator creates new MultiDatabaseHiLoKeyGenerator

func (*MultiDatabaseHiLoIDGenerator) GenerateDocumentID

func (g *MultiDatabaseHiLoIDGenerator) GenerateDocumentID(dbName string, entity interface{}) (string, error)

GenerateDocumentID generates id

func (*MultiDatabaseHiLoIDGenerator) ReturnUnusedRange

func (g *MultiDatabaseHiLoIDGenerator) ReturnUnusedRange()

ReturnUnusedRange returns unused range for all generators

type MultiGetCommand

type MultiGetCommand struct {
	RavenCommandBase

	Result []*GetResponse // in Java we inherit from List<GetResponse>
	// contains filtered or unexported fields
}

MultiGetCommand represents multi get command

func (*MultiGetCommand) CreateRequest

func (c *MultiGetCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*MultiGetCommand) SetResponseRaw

func (c *MultiGetCommand) SetResponseRaw(response *http.Response, stream io.Reader) error

type MultiGetOperation

type MultiGetOperation struct {
	// contains filtered or unexported fields
}

MultiGetOperation represents multi-get operation

type MultiLoaderWithInclude

type MultiLoaderWithInclude struct {
	// contains filtered or unexported fields
}

func NewMultiLoaderWithInclude

func NewMultiLoaderWithInclude(session *DocumentSession) *MultiLoaderWithInclude

func (*MultiLoaderWithInclude) Include

func (*MultiLoaderWithInclude) Load

func (l *MultiLoaderWithInclude) Load(result interface{}, id string) error

TODO: needs a test TODO: better implementation

func (*MultiLoaderWithInclude) LoadMulti

func (l *MultiLoaderWithInclude) LoadMulti(results interface{}, ids []string) error

results should be map[string]*struct

type MultiTypeHiLoIDGenerator

type MultiTypeHiLoIDGenerator struct {
	// contains filtered or unexported fields
}

MultiTypeHiLoIDGenerator manages per-type HiLoKeyGenerator

func NewMultiTypeHiLoIDGenerator

func NewMultiTypeHiLoIDGenerator(store *DocumentStore, dbName string, conventions *DocumentConventions) *MultiTypeHiLoIDGenerator

NewMultiTypeHiLoIDGenerator creates MultiTypeHiLoKeyGenerator

func (*MultiTypeHiLoIDGenerator) GenerateDocumentID

func (g *MultiTypeHiLoIDGenerator) GenerateDocumentID(entity interface{}) (string, error)

GenerateDocumentID generates a unique key for entity using its type to partition keys

func (*MultiTypeHiLoIDGenerator) ReturnUnusedRange

func (g *MultiTypeHiLoIDGenerator) ReturnUnusedRange()

ReturnUnusedRange returns unused range for all generators

type NextHiLoCommand

type NextHiLoCommand struct {
	RavenCommandBase

	Result *HiLoResult
	// contains filtered or unexported fields
}

NextHiLoCommand represents a hi-lo database command

func NewNextHiLoCommand

func NewNextHiLoCommand(tag string, lastBatchSize int64, lastRangeAt *time.Time, identityPartsSeparator string, lastRangeMax int64) *NextHiLoCommand

NewNextHiLoCommand returns new NextHiLoCommand

func (*NextHiLoCommand) CreateRequest

func (c *NextHiLoCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*NextHiLoCommand) SetResponse

func (c *NextHiLoCommand) SetResponse(response []byte, fromCache bool) error

type NextIdentityForCommand

type NextIdentityForCommand struct {
	RavenCommandBase

	Result int
	// contains filtered or unexported fields
}

func NewNextIdentityForCommand

func NewNextIdentityForCommand(id string) *NextIdentityForCommand

func (*NextIdentityForCommand) CreateRequest

func (c *NextIdentityForCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*NextIdentityForCommand) SetResponse

func (c *NextIdentityForCommand) SetResponse(response []byte, fromCache bool) error

type NoLeaderError

type NoLeaderError struct {
	RavenError
}

func (*NoLeaderError) Error

func (e *NoLeaderError) Error() string

Error makes it conform to error interface

func (*NoLeaderError) WrappedError

func (e *NoLeaderError) WrappedError() error

hackish way to get a wrapped error

type NodeID

type NodeID struct {
	NodeTag         string `json:"NodeTag"`
	NodeURL         string `json:"NodeUrl"`
	ResponsibleNode string `json:"ResponsibleNode"`
}

NodeID describes a node

type NodeIsPassiveError

type NodeIsPassiveError struct {
	RavenError
}

func (*NodeIsPassiveError) Error

func (e *NodeIsPassiveError) Error() string

Error makes it conform to error interface

func (*NodeIsPassiveError) WrappedError

func (e *NodeIsPassiveError) WrappedError() error

hackish way to get a wrapped error

type NodeSelector

type NodeSelector struct {
	// contains filtered or unexported fields
}

NodeSelector describes node selector

func NewNodeSelector

func NewNodeSelector(t *Topology) *NodeSelector

NewNodeSelector creates a new NodeSelector

func (*NodeSelector) Close

func (s *NodeSelector) Close()

type NodeSelectorState

type NodeSelectorState struct {
	// contains filtered or unexported fields
}

func NewNodeSelectorState

func NewNodeSelectorState(topology *Topology) *NodeSelectorState

type NodeStatus

type NodeStatus struct {
	// contains filtered or unexported fields
}

NodeStatus represents status of server node

func NewNodeStatus

func NewNodeStatus(requestExecutor *RequestExecutor, nodeIndex int, node *ServerNode) *NodeStatus

func (*NodeStatus) Close

func (s *NodeStatus) Close()

type NonUniqueObjectError

type NonUniqueObjectError struct {
	RavenError
}

NonUniqueObjectError represents non unique object error

func (*NonUniqueObjectError) Error

func (e *NonUniqueObjectError) Error() string

Error makes it conform to error interface

func (*NonUniqueObjectError) WrappedError

func (e *NonUniqueObjectError) WrappedError() error

hackish way to get a wrapped error

type NotImplementedError

type NotImplementedError struct {
	// contains filtered or unexported fields
}

NotImplementedError represents not implemented error

func (*NotImplementedError) Error

func (e *NotImplementedError) Error() string

Error makes it conform to error interface

func (*NotImplementedError) WrappedError

func (e *NotImplementedError) WrappedError() error

hackish way to get a wrapped error

type Operation

type Operation struct {

	// if true, this represents ServerWideOperation
	IsServerWide bool
	// contains filtered or unexported fields
}

Operation describes async operation being executed on the server

func NewOperation

func NewOperation(requestExecutor *RequestExecutor, changes func() *DatabaseChanges, conventions *DocumentConventions, id int64) *Operation

func NewServerWideOperation

func NewServerWideOperation(requestExecutor *RequestExecutor, conventions *DocumentConventions, id int64) *Operation

func (*Operation) GetID

func (o *Operation) GetID() int64

func (*Operation) WaitForCompletion

func (o *Operation) WaitForCompletion() error

type OperationCancelledError

type OperationCancelledError struct {
	// contains filtered or unexported fields
}

OperationCancelledError represents "operation cancelled" error

func (*OperationCancelledError) Error

func (e *OperationCancelledError) Error() string

Error makes it conform to error interface

func (*OperationCancelledError) WrappedError

func (e *OperationCancelledError) WrappedError() error

hackish way to get a wrapped error

type OperationExceptionResult

type OperationExceptionResult struct {
	Type       string `json:"Type"`
	Message    string `json:"Message"`
	Error      string `json:"Error"`
	StatusCode int    `json:"StatusCode"`
}

OperationExceptionResult represents an exception information from the server

type OperationExecutor

type OperationExecutor struct {
	// contains filtered or unexported fields
}

func NewOperationExecutor

func NewOperationExecutor(store *DocumentStore, databaseName string) *OperationExecutor

func (*OperationExecutor) ForDatabase

func (e *OperationExecutor) ForDatabase(databaseName string) *OperationExecutor

func (*OperationExecutor) Send

func (e *OperationExecutor) Send(operation IOperation, sessionInfo *SessionInfo) error

Note: we don't return a result because we could only return interface{} The caller has access to operation and can access strongly typed command and its result sessionInfo can be nil

func (*OperationExecutor) SendAsync

func (e *OperationExecutor) SendAsync(operation IOperation, sessionInfo *SessionInfo) (*Operation, error)

sessionInfo can be nil

func (*OperationExecutor) SendPatchOperation

func (e *OperationExecutor) SendPatchOperation(operation *PatchOperation, sessionInfo *SessionInfo) (*PatchOperationResult, error)

type OperationIDResult

type OperationIDResult struct {
	OperationID int64 `json:"OperationId"`
}

OperationIDResult is a result of commands like CompactDatabaseCommand

type OperationStatusChange

type OperationStatusChange struct {
	OperationID int64
	State       map[string]interface{}
}

OperationStatusChange describes a change to the operation status. Can be used as DatabaseChange.

type OrderingType

type OrderingType = string

type Parameters

type Parameters = map[string]interface{}

type PatchByQueryCommand

type PatchByQueryCommand struct {
	RavenCommandBase

	Result *OperationIDResult
	// contains filtered or unexported fields
}

func NewPatchByQueryCommand

func NewPatchByQueryCommand(conventions *DocumentConventions, queryToUpdate *IndexQuery, options *QueryOperationOptions) (*PatchByQueryCommand, error)

func (*PatchByQueryCommand) CreateRequest

func (c *PatchByQueryCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*PatchByQueryCommand) SetResponse

func (c *PatchByQueryCommand) SetResponse(response []byte, fromCache bool) error

type PatchByQueryOperation

type PatchByQueryOperation struct {
	Command *PatchByQueryCommand
	// contains filtered or unexported fields
}

func NewPatchByQueryOperation

func NewPatchByQueryOperation(queryToUpdate string) *PatchByQueryOperation

func NewPatchByQueryOperationWithOptions

func NewPatchByQueryOperationWithOptions(queryToUpdate string, options *QueryOperationOptions) *PatchByQueryOperation

func (*PatchByQueryOperation) GetCommand

func (o *PatchByQueryOperation) GetCommand(store *DocumentStore, conventions *DocumentConventions, cache *httpCache) (RavenCommand, error)

type PatchCommand

type PatchCommand struct {
	RavenCommandBase

	Result *PatchResult
	// contains filtered or unexported fields
}

PatchCommand represents patch command

func NewPatchCommand

func NewPatchCommand(conventions *DocumentConventions, id string, changeVector *string,
	patch *PatchRequest, patchIfMissing *PatchRequest, skipPatchIfChangeVectorMismatch bool,
	returnDebugInformation bool, test bool) (*PatchCommand, error)

NewPatchCommand returns new PatchCommand

func (*PatchCommand) CreateRequest

func (c *PatchCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*PatchCommand) SetResponse

func (c *PatchCommand) SetResponse(response []byte, fromCache bool) error

type PatchCommandData

type PatchCommandData struct {
	*CommandData
	// contains filtered or unexported fields
}

type PatchOperation

type PatchOperation struct {
	Command *PatchCommand
	// contains filtered or unexported fields
}

PatchOperation represents patch operation

func NewPatchOperation

func NewPatchOperation(id string, changeVector *string, patch *PatchRequest, patchIfMissing *PatchRequest, skipPatchIfChangeVectorMismatch bool) (*PatchOperation, error)

NewPatchOperation returns new PatchOperation

func (*PatchOperation) GetCommand

func (o *PatchOperation) GetCommand(store *DocumentStore, conventions *DocumentConventions, cache *httpCache) (RavenCommand, error)

type PatchOperationPayload

type PatchOperationPayload struct {
	// contains filtered or unexported fields
}

PatchOperationPayload represents payload of patch operation Note: in Java it's Payload nested in PatchOperation

type PatchOperationResult

type PatchOperationResult struct {
	Status   PatchStatus            `json:"Status"`
	Document map[string]interface{} `json:"Document"`
}

PatchOperationResult represents result of patch operation Note: in Java it's Result nested in PatchOperation

func (*PatchOperationResult) GetResult

func (r *PatchOperationResult) GetResult(result interface{}) error

type PatchRequest

type PatchRequest struct {
	Script string
	Values map[string]interface{}
}

PatchRequest represents patch request

func (*PatchRequest) Serialize

func (r *PatchRequest) Serialize() map[string]interface{}

Serialize serializes PatchRequest to json

type PatchResult

type PatchResult struct {
	Status           PatchStatus            `json:"Status"`
	ModifiedDocument map[string]interface{} `json:"ModifiedDocument"`
	OriginalDocument map[string]interface{} `json:"OriginalDocument"`
	Debug            map[string]interface{} `json:"Debug"`

	// TODO: can this ever be null? If not, use string for type
	ChangeVector *string `json:"ChangeVector"`
	Collection   string  `json:"Collection"`
}

PatchResult describes server results of patch command

type PatchStatus

type PatchStatus = string

type PointField

type PointField struct {
	// contains filtered or unexported fields
}

func NewPointField

func NewPointField(latitude string, longitude string) *PointField

func (*PointField) ToField

func (f *PointField) ToField(ensureValidFieldName func(string, bool) (string, error)) (string, error)

type PutAttachmentCommand

type PutAttachmentCommand struct {
	RavenCommandBase

	Result *AttachmentDetails
	// contains filtered or unexported fields
}

func NewPutAttachmentCommand

func NewPutAttachmentCommand(documentID string, name string, stream io.Reader, contentType string, changeVector *string) (*PutAttachmentCommand, error)

TODO: should stream be io.ReadCloser? Who owns closing the attachment

func (*PutAttachmentCommand) CreateRequest

func (c *PutAttachmentCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*PutAttachmentCommand) SetResponse

func (c *PutAttachmentCommand) SetResponse(response []byte, fromCache bool) error

type PutAttachmentCommandData

type PutAttachmentCommandData struct {
	*CommandData
	// contains filtered or unexported fields
}

func NewPutAttachmentCommandData

func NewPutAttachmentCommandData(documentID string, name string, stream io.Reader, contentType string, changeVector *string) (*PutAttachmentCommandData, error)

func (*PutAttachmentCommandData) GetContentType

func (d *PutAttachmentCommandData) GetContentType() string

type PutAttachmentOperation

type PutAttachmentOperation struct {
	Command *PutAttachmentCommand
	// contains filtered or unexported fields
}

func NewPutAttachmentOperation

func NewPutAttachmentOperation(documentID string, name string, stream io.Reader, contentType string, changeVector *string) *PutAttachmentOperation

func (*PutAttachmentOperation) GetCommand

func (o *PutAttachmentOperation) GetCommand(store *DocumentStore, conventions *DocumentConventions, cache *httpCache) (RavenCommand, error)

type PutClientConfigurationCommand

type PutClientConfigurationCommand struct {
	RavenCommandBase
	// contains filtered or unexported fields
}

func NewPutClientConfigurationCommand

func NewPutClientConfigurationCommand(conventions *DocumentConventions, configuration *ClientConfiguration) (*PutClientConfigurationCommand, error)

func (*PutClientConfigurationCommand) CreateRequest

func (c *PutClientConfigurationCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type PutClientConfigurationOperation

type PutClientConfigurationOperation struct {
	Command *PutClientConfigurationCommand
	// contains filtered or unexported fields
}

func NewPutClientConfigurationOperation

func NewPutClientConfigurationOperation(configuration *ClientConfiguration) (*PutClientConfigurationOperation, error)

func (*PutClientConfigurationOperation) GetCommand

type PutCommandDataWithJSON

type PutCommandDataWithJSON struct {
	*CommandData
	// contains filtered or unexported fields
}

PutCommandDataWithJSON represents data for put command with json

type PutCompareExchangeCommandData

type PutCompareExchangeCommandData struct {
	*CommandData
	// contains filtered or unexported fields
}

type PutCompareExchangeValueCommand

type PutCompareExchangeValueCommand struct {
	RavenCommandBase

	Result *CompareExchangeResult
	// contains filtered or unexported fields
}

func NewPutCompareExchangeValueCommand

func NewPutCompareExchangeValueCommand(key string, value interface{}, index int64, conventions *DocumentConventions) (*PutCompareExchangeValueCommand, error)

func (*PutCompareExchangeValueCommand) CreateRequest

func (c *PutCompareExchangeValueCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*PutCompareExchangeValueCommand) SetResponse

func (c *PutCompareExchangeValueCommand) SetResponse(response []byte, fromCache bool) error

type PutCompareExchangeValueOperation

type PutCompareExchangeValueOperation struct {
	Command *PutCompareExchangeValueCommand
	// contains filtered or unexported fields
}

func NewPutCompareExchangeValueOperation

func NewPutCompareExchangeValueOperation(key string, value interface{}, index int64) (*PutCompareExchangeValueOperation, error)

func (*PutCompareExchangeValueOperation) GetCommand

func (o *PutCompareExchangeValueOperation) GetCommand(store *DocumentStore, conventions *DocumentConventions, cache *httpCache) (RavenCommand, error)

type PutConnectionStringCommand

type PutConnectionStringCommand struct {
	RavenCommandBase

	Result *PutConnectionStringResult
	// contains filtered or unexported fields
}

func NewPutConnectionStringCommand

func NewPutConnectionStringCommand(connectionString interface{}) *PutConnectionStringCommand

connectionString should be ConnectionString or RavenConnectionString

func (*PutConnectionStringCommand) CreateRequest

func (c *PutConnectionStringCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*PutConnectionStringCommand) SetResponse

func (c *PutConnectionStringCommand) SetResponse(response []byte, fromCache bool) error

type PutConnectionStringOperation

type PutConnectionStringOperation struct {
	Command *PutConnectionStringCommand
	// contains filtered or unexported fields
}

func NewPutConnectionStringOperation

func NewPutConnectionStringOperation(connectionString interface{}) *PutConnectionStringOperation

func (*PutConnectionStringOperation) GetCommand

func (o *PutConnectionStringOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type PutConnectionStringResult

type PutConnectionStringResult struct {
	Etag int64 `json:"ETag"`
}

PutConnectionStringResult describes result of "put connection" command

type PutDocumentCommand

type PutDocumentCommand struct {
	RavenCommandBase

	Result *PutResult
	// contains filtered or unexported fields
}

func NewPutDocumentCommand

func NewPutDocumentCommand(id string, changeVector *string, document map[string]interface{}) *PutDocumentCommand

func (*PutDocumentCommand) CreateRequest

func (c *PutDocumentCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*PutDocumentCommand) SetResponse

func (c *PutDocumentCommand) SetResponse(response []byte, fromCache bool) error

type PutIndexResult

type PutIndexResult struct {
	// Note: don't know how Java does it, but this is sent
	// as Index in JSON responses from the server
	IndexName string `json:"Index"`
}

PutIndexResult represents result of put index command

type PutIndexesCommand

type PutIndexesCommand struct {
	RavenCommandBase

	Result []*PutIndexResult
	// contains filtered or unexported fields
}

PutIndexesCommand represents put indexes command

func NewPutIndexesCommand

func NewPutIndexesCommand(conventions *DocumentConventions, indexesToAdd []*IndexDefinition) (*PutIndexesCommand, error)

NewPutIndexesCommand returns new PutIndexesCommand

func (*PutIndexesCommand) CreateRequest

func (c *PutIndexesCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*PutIndexesCommand) SetResponse

func (c *PutIndexesCommand) SetResponse(response []byte, fromCache bool) error

type PutIndexesOperation

type PutIndexesOperation struct {
	Command *PutIndexesCommand
	// contains filtered or unexported fields
}

PutIndexesOperation represents put indexes operation

func NewPutIndexesOperation

func NewPutIndexesOperation(indexToAdd ...*IndexDefinition) *PutIndexesOperation

NewPutIndexesOperation returns new PutIndexesOperation

func (*PutIndexesOperation) GetCommand

func (o *PutIndexesOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

GetCommand returns a command for this operation

type PutIndexesResponse

type PutIndexesResponse struct {
	Results []*PutIndexResult `json:"Results"`
}

PutIndexesResponse represents server's response to PutIndexesCommand

type PutResult

type PutResult struct {
	ID           string  `json:"Id"`
	ChangeVector *string `json:"ChangeVector"`
}

PutResult describes result of PutDocumentCommand

type QueryCommand

type QueryCommand struct {
	RavenCommandBase

	Result *QueryResult
	// contains filtered or unexported fields
}

func NewQueryCommand

func NewQueryCommand(conventions *DocumentConventions, indexQuery *IndexQuery, metadataOnly bool, indexEntriesOnly bool) (*QueryCommand, error)

func (*QueryCommand) CreateRequest

func (c *QueryCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*QueryCommand) SetResponse

func (c *QueryCommand) SetResponse(response []byte, fromCache bool) error

type QueryData

type QueryData struct {
	// Fields lists fields to be selected from queried document
	Fields []string
	// Projections lists fields in the result entity
	Projections []string
	// contains filtered or unexported fields
}

QueryData represents

type QueryOperationOptions

type QueryOperationOptions struct {
	MaxOpsPerSecond int
	AllowStale      bool
	StaleTimeout    time.Duration
	RetrieveDetails bool
}

QueryOperationOptions represents options for query operation

type QueryOperator

type QueryOperator string

type QueryResult

type QueryResult struct {
	GenericQueryResult
}

QueryResults represents results of a query

type QueryStatistics

type QueryStatistics struct {
	IsStale           bool
	DurationInMs      int64
	TotalResults      int
	SkippedResults    int
	Timestamp         time.Time
	IndexName         string
	IndexTimestamp    time.Time
	LastQueryTime     time.Time
	TimingsInMs       map[string]float64
	ResultEtag        int64 // TODO: *int64 ?
	ResultSize        int64
	ScoreExplanations map[string]string
}

TODO: is time.Time here our *Time? TODO: needs json annotations?

func NewQueryStatistics

func NewQueryStatistics() *QueryStatistics

func (*QueryStatistics) UpdateQueryStats

func (s *QueryStatistics) UpdateQueryStats(qr *QueryResult)

type QueryStreamCommand

type QueryStreamCommand struct {
	RavenCommandBase

	Result *StreamResultResponse
	// contains filtered or unexported fields
}

func NewQueryStreamCommand

func NewQueryStreamCommand(conventions *DocumentConventions, indexQuery *IndexQuery) *QueryStreamCommand

func (*QueryStreamCommand) CreateRequest

func (c *QueryStreamCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type RaftCommandBase

type RaftCommandBase struct {
	RavenCommandBase
	// contains filtered or unexported fields
}

func (*RaftCommandBase) RaftUniqueRequestId

func (cmd *RaftCommandBase) RaftUniqueRequestId() (string, error)

type RangeBuilder

type RangeBuilder struct {
	// contains filtered or unexported fields
}

RangeBuilder helps build a string query for range requests

func NewRangeBuilder

func NewRangeBuilder(path string) *RangeBuilder

func (*RangeBuilder) Err

func (b *RangeBuilder) Err() error

func (*RangeBuilder) GetStringRepresentation

func (b *RangeBuilder) GetStringRepresentation(addQueryParameter func(interface{}) string) (string, error)

func (*RangeBuilder) IsGreaterThan

func (b *RangeBuilder) IsGreaterThan(value interface{}) *RangeBuilder

func (*RangeBuilder) IsGreaterThanOrEqualTo

func (b *RangeBuilder) IsGreaterThanOrEqualTo(value interface{}) *RangeBuilder

func (*RangeBuilder) IsLessThan

func (b *RangeBuilder) IsLessThan(value interface{}) *RangeBuilder

func (*RangeBuilder) IsLessThanOrEqualTo

func (b *RangeBuilder) IsLessThanOrEqualTo(value interface{}) *RangeBuilder

type RangeFacet

type RangeFacet struct {
	FacetBaseCommon

	Ranges []string `json:"Ranges"`
	// contains filtered or unexported fields
}

RangeFacet describes range facet

func NewRangeFacet

func NewRangeFacet(parent FacetBase) *RangeFacet

NewRangeFacet returns new RangeFacet parent is optional (can be nil)

func (*RangeFacet) ToFacetToken

func (f *RangeFacet) ToFacetToken(addQueryParameter func(interface{}) string) (*facetToken, error)

ToFacetToken converts RangeFacet to a token

type RangeValue

type RangeValue struct {
	Min     int64
	Max     int64
	Current int64 // atomic
}

RangeValue represents an inclusive integer range min to max

func NewRangeValue

func NewRangeValue(min int64, max int64) *RangeValue

NewRangeValue creates a new RangeValue

type RavenCommand

type RavenCommand interface {
	// those are meant to be over-written
	CreateRequest(node *ServerNode) (*http.Request, error)
	SetResponse(response []byte, fromCache bool) error
	SetResponseRaw(response *http.Response, body io.Reader) error

	Send(client *http.Client, req *http.Request) (*http.Response, error)

	// for all other functions, get access to underlying RavenCommandBase
	GetBase() *RavenCommandBase
}

RavenCommand defines interface for server commands

type RavenCommandBase

type RavenCommandBase struct {
	StatusCode           int
	ResponseType         RavenCommandResponseType
	CanCache             bool
	CanCacheAggressively bool

	// if true, can be cached
	IsReadRequest bool

	FailedNodes map[*ServerNode]error
}

func NewRavenCommandBase

func NewRavenCommandBase() RavenCommandBase

func (*RavenCommandBase) CreateRequest

func (c *RavenCommandBase) CreateRequest(node *ServerNode) (*http.Request, error)

func (*RavenCommandBase) GetBase

func (c *RavenCommandBase) GetBase() *RavenCommandBase

func (*RavenCommandBase) Send

func (c *RavenCommandBase) Send(client *http.Client, req *http.Request) (*http.Response, error)

func (*RavenCommandBase) SetResponse

func (c *RavenCommandBase) SetResponse(response []byte, fromCache bool) error

func (*RavenCommandBase) SetResponseRaw

func (c *RavenCommandBase) SetResponseRaw(response *http.Response, stream io.Reader) error

type RavenCommandResponseType

type RavenCommandResponseType = string

type RavenConnectionString

type RavenConnectionString struct {
	ConnectionString
	Database              string   `json:"Database"`
	TopologyDiscoveryUrls []string `json:"TopologyDiscoveryUrls"`
}

RavenConnectionString represents connection string for raven

func NewRavenConnectionString

func NewRavenConnectionString() *RavenConnectionString

type RavenError

type RavenError struct {
	// contains filtered or unexported fields
}

RavenError represents generic raven error all exceptions that in Java extend RavenException should contain this error

func (*RavenError) Error

func (e *RavenError) Error() string

Error makes it conform to error interface

func (*RavenError) WrappedError

func (e *RavenError) WrappedError() error

hackish way to get a wrapped error

type RawDocumentQuery

type RawDocumentQuery struct {
	// contains filtered or unexported fields
}

func (*RawDocumentQuery) AddAfterQueryExecutedListener

func (q *RawDocumentQuery) AddAfterQueryExecutedListener(action func(*QueryResult)) int

func (*RawDocumentQuery) AddAfterStreamExecutedListener

func (q *RawDocumentQuery) AddAfterStreamExecutedListener(action func(map[string]interface{})) int

func (*RawDocumentQuery) AddBeforeQueryExecutedListener

func (q *RawDocumentQuery) AddBeforeQueryExecutedListener(action func(*IndexQuery)) int

func (*RawDocumentQuery) AddParameter

func (q *RawDocumentQuery) AddParameter(name string, value interface{}) *RawDocumentQuery

func (RawDocumentQuery) Any

func (q RawDocumentQuery) Any() (bool, error)

Any returns true if query returns at least one result

func (RawDocumentQuery) Count

func (q RawDocumentQuery) Count() (int, error)

func (RawDocumentQuery) CountLazily

func (q RawDocumentQuery) CountLazily() (*Lazy, error)

CountLazily returns a lazy operation that returns number of results in a query. It'll set *count to number of results after Lazy.GetResult() is called. results should be of type []<type> and is only provided so that we know this is a query for <type> TODO: figure out better API.

func (RawDocumentQuery) Err

func (q RawDocumentQuery) Err() error

func (RawDocumentQuery) First

func (q RawDocumentQuery) First(result interface{}) error

First runs a query and returns a first result.

func (RawDocumentQuery) GetIndexQuery

func (q RawDocumentQuery) GetIndexQuery() (*IndexQuery, error)

func (RawDocumentQuery) GetResults

func (q RawDocumentQuery) GetResults(results interface{}) error

GetResults executes the query and sets results to returned values. results should be of type *[]<type>

func (RawDocumentQuery) Lazily

func (q RawDocumentQuery) Lazily() (*Lazy, error)

func (*RawDocumentQuery) NoCaching

func (q *RawDocumentQuery) NoCaching() *RawDocumentQuery

func (*RawDocumentQuery) NoTracking

func (q *RawDocumentQuery) NoTracking() *RawDocumentQuery

func (*RawDocumentQuery) RemoveAfterQueryExecutedListener

func (q *RawDocumentQuery) RemoveAfterQueryExecutedListener(idx int) *RawDocumentQuery

func (*RawDocumentQuery) RemoveAfterStreamExecutedListener

func (q *RawDocumentQuery) RemoveAfterStreamExecutedListener(idx int) *RawDocumentQuery

func (*RawDocumentQuery) RemoveBeforeQueryExecutedListener

func (q *RawDocumentQuery) RemoveBeforeQueryExecutedListener(idx int) *RawDocumentQuery

func (RawDocumentQuery) Single

func (q RawDocumentQuery) Single(result interface{}) error

Single runs a query that expects only a single result. If there is more than one result, it returns IllegalStateError.

func (*RawDocumentQuery) Skip

func (q *RawDocumentQuery) Skip(count int) *RawDocumentQuery

func (*RawDocumentQuery) Statistics

func (q *RawDocumentQuery) Statistics(stats **QueryStatistics) *RawDocumentQuery

func (*RawDocumentQuery) Take

func (q *RawDocumentQuery) Take(count int) *RawDocumentQuery

func (*RawDocumentQuery) UsingDefaultOperator

func (q *RawDocumentQuery) UsingDefaultOperator(queryOperator QueryOperator) *RawDocumentQuery

func (*RawDocumentQuery) WaitForNonStaleResults

func (q *RawDocumentQuery) WaitForNonStaleResults() *RawDocumentQuery

func (*RawDocumentQuery) WaitForNonStaleResultsWithTimeout

func (q *RawDocumentQuery) WaitForNonStaleResultsWithTimeout(waitTimeout time.Duration) *RawDocumentQuery

type ReadBalanceBehavior

type ReadBalanceBehavior = string

ReadBalanceBehavior defines the type of read balancing

type RemoveCompareExchangeValueCommand

type RemoveCompareExchangeValueCommand struct {
	RavenCommandBase

	Result *CompareExchangeResult
	// contains filtered or unexported fields
}

func NewRemoveCompareExchangeValueCommand

func NewRemoveCompareExchangeValueCommand(clazz reflect.Type, key string, index int64, conventions *DocumentConventions) (*RemoveCompareExchangeValueCommand, error)

func (*RemoveCompareExchangeValueCommand) CreateRequest

func (c *RemoveCompareExchangeValueCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*RemoveCompareExchangeValueCommand) SetResponse

func (c *RemoveCompareExchangeValueCommand) SetResponse(response []byte, fromCache bool) error

type ReplicationNode

type ReplicationNode struct {
	URL        string `json:"Url"`
	Database   string `json:"Database"`
	IsDisabled bool   `json:"Disabled"`
}

ReplicationNode describes replication node

type ReplicationWaitOptsBuilder

type ReplicationWaitOptsBuilder struct {
	// contains filtered or unexported fields
}

func (*ReplicationWaitOptsBuilder) Majority

func (b *ReplicationWaitOptsBuilder) Majority(waitForMajority bool) *ReplicationWaitOptsBuilder

func (*ReplicationWaitOptsBuilder) NumberOfReplicas

func (b *ReplicationWaitOptsBuilder) NumberOfReplicas(replicas int) *ReplicationWaitOptsBuilder

func (*ReplicationWaitOptsBuilder) ThrowOnTimeout

func (b *ReplicationWaitOptsBuilder) ThrowOnTimeout(shouldThrow bool) *ReplicationWaitOptsBuilder

func (*ReplicationWaitOptsBuilder) WithTimeout

type RequestExecutor

type RequestExecutor struct {
	Certificate *tls.Certificate
	TrustStore  *x509.Certificate

	NumberOfServerRequests  atomicInteger
	TopologyEtag            int64
	ClientConfigurationEtag int64

	// TODO: mulit-threaded access, protect
	Cache *httpCache
	// contains filtered or unexported fields
}

RequestExecutor describes executor of HTTP requests

func ClusterRequestExecutorCreate

func ClusterRequestExecutorCreate(initialUrls []string, certificate *tls.Certificate, trustStore *x509.Certificate, conventions *DocumentConventions) *RequestExecutor

func ClusterRequestExecutorCreateForSingleNode

func ClusterRequestExecutorCreateForSingleNode(url string, certificate *tls.Certificate, trustStore *x509.Certificate, conventions *DocumentConventions) *RequestExecutor

func NewClusterRequestExecutor

func NewClusterRequestExecutor(certificate *tls.Certificate, trustStore *x509.Certificate, conventions *DocumentConventions, initialUrls []string) *RequestExecutor

func NewRequestExecutor

func NewRequestExecutor(databaseName string, certificate *tls.Certificate, trustStore *x509.Certificate, conventions *DocumentConventions, initialUrls []string) *RequestExecutor

NewRequestExecutor creates a new executor

func RequestExecutorCreate

func RequestExecutorCreate(initialUrls []string, databaseName string, certificate *tls.Certificate, trustStore *x509.Certificate, conventions *DocumentConventions) *RequestExecutor

func RequestExecutorCreateForSingleNodeWithConfigurationUpdates

func RequestExecutorCreateForSingleNodeWithConfigurationUpdates(url string, databaseName string, certificate *tls.Certificate, trustStore *x509.Certificate, conventions *DocumentConventions) *RequestExecutor

func RequestExecutorCreateForSingleNodeWithoutConfigurationUpdates

func RequestExecutorCreateForSingleNodeWithoutConfigurationUpdates(url string, databaseName string, certificate *tls.Certificate, trustStore *x509.Certificate, conventions *DocumentConventions) *RequestExecutor

func (*RequestExecutor) Close

func (re *RequestExecutor) Close()

Close should be called when deleting executor

func (*RequestExecutor) Execute

func (re *RequestExecutor) Execute(chosenNode *ServerNode, nodeIndex int, command RavenCommand, shouldRetry bool, sessionInfo *SessionInfo) error

Execute executes a command on a given node If nodeIndex is -1, we don't know the index

func (*RequestExecutor) ExecuteCommand

func (re *RequestExecutor) ExecuteCommand(command RavenCommand, sessionInfo *SessionInfo) error

sessionInfo can be nil

func (*RequestExecutor) GetConventions

func (re *RequestExecutor) GetConventions() *DocumentConventions

func (*RequestExecutor) GetHTTPClient

func (re *RequestExecutor) GetHTTPClient() (*http.Client, error)

GetHTTPClient returns http client for sending the requests

func (*RequestExecutor) GetTopology

func (re *RequestExecutor) GetTopology() *Topology

func (*RequestExecutor) GetTopologyNodes

func (re *RequestExecutor) GetTopologyNodes() []*ServerNode

GetTopologyNodes returns a copy of topology nodes

func (*RequestExecutor) GetURL

func (re *RequestExecutor) GetURL() (string, error)

GetURL returns an URL

func (*RequestExecutor) MakeCluster

func (re *RequestExecutor) MakeCluster()

func (*RequestExecutor) UpdateTopologyAsync

func (re *RequestExecutor) UpdateTopologyAsync(node *ServerNode, timeout int) chan *clusterUpdateAsyncResult

type ResetIndexCommand

type ResetIndexCommand struct {
	RavenCommandBase
	// contains filtered or unexported fields
}

func NewResetIndexCommand

func NewResetIndexCommand(indexName string) (*ResetIndexCommand, error)

func (*ResetIndexCommand) CreateRequest

func (c *ResetIndexCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type ResetIndexOperation

type ResetIndexOperation struct {
	Command *ResetIndexCommand
	// contains filtered or unexported fields
}

func NewResetIndexOperation

func NewResetIndexOperation(indexName string) (*ResetIndexOperation, error)

func (*ResetIndexOperation) GetCommand

func (o *ResetIndexOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type ResponseTimeInformation

type ResponseTimeInformation struct {
	// contains filtered or unexported fields
}

ResponseTimeInformation describes timing information of server requests

type ResponseTimeItem

type ResponseTimeItem struct {
	URL      string
	Duration time.Duration
}

ResponseTimeItem represents a duration for executing a given url

type RestoreCaching

type RestoreCaching struct {
	// contains filtered or unexported fields
}

func (*RestoreCaching) Close

func (r *RestoreCaching) Close() error

type Revision

type Revision struct {
	Previous interface{}
	Current  interface{}
}

Revision describes a revision

type RevisionsCollectionConfiguration

type RevisionsCollectionConfiguration struct {
	// Note: in java MinimumRevisionsToKeep is Long, which is ref type
	// so by default it's not serialized to JSON if not set
	// in Go 0 is default so use "omitempty" to achieve the same effect
	MinimumRevisionsToKeep   int64     `json:"MinimumRevisionsToKeep,omitempty"`
	MinimumRevisionAgeToKeep *Duration `json:"MinimumRevisionAgeToKeep"`
	Disabled                 bool      `json:"Disabled"`
	PurgeOnDelete            bool      `json:"PurgeOnDelete"`
}

RevisionsCollectionConfiguration describes configuration for revisions collection

type RevisionsConfiguration

type RevisionsConfiguration struct {
	DefaultConfig *RevisionsCollectionConfiguration `json:"Default"`

	Collections map[string]*RevisionsCollectionConfiguration `json:"Collections"`
}

RevisionsConfiguration describes revisions configuration

type RevisionsDisabledError

type RevisionsDisabledError struct {
	RavenError
}

func (*RevisionsDisabledError) Error

func (e *RevisionsDisabledError) Error() string

Error makes it conform to error interface

func (*RevisionsDisabledError) WrappedError

func (e *RevisionsDisabledError) WrappedError() error

hackish way to get a wrapped error

type RevisionsSessionOperations

type RevisionsSessionOperations = DocumentSessionRevisions

TODO: write a unique wrapper type

type RouteNotFoundError

type RouteNotFoundError struct {
	RavenError
}

func (*RouteNotFoundError) Error

func (e *RouteNotFoundError) Error() string

Error makes it conform to error interface

func (*RouteNotFoundError) WrappedError

func (e *RouteNotFoundError) WrappedError() error

hackish way to get a wrapped error

type RuntimeError

type RuntimeError struct {
	// contains filtered or unexported fields
}

RuntimeError represents generic runtime error

func (*RuntimeError) Error

func (e *RuntimeError) Error() string

Error makes it conform to error interface

func (*RuntimeError) WrappedError

func (e *RuntimeError) WrappedError() error

hackish way to get a wrapped error

type ScriptResolver

type ScriptResolver struct {
	Script           string `json:"Script"`
	LastModifiedTime Time   `json:"LastModifiedTime"`
}

ScriptResolver describes script resolver

type SearchOperator

type SearchOperator int
const (
	SearchOperatorUnset SearchOperator = iota
	SearchOperatorOr
	SearchOperatorAnd
)

type SecurityError

type SecurityError struct {
	RavenError
}

func (*SecurityError) Error

func (e *SecurityError) Error() string

Error makes it conform to error interface

func (*SecurityError) WrappedError

func (e *SecurityError) WrappedError() error

hackish way to get a wrapped error

type SeedIdentityForCommand

type SeedIdentityForCommand struct {
	RavenCommandBase

	Result int
	// contains filtered or unexported fields
}

func NewSeedIdentityForCommand

func NewSeedIdentityForCommand(id string, value int64, forced bool) (*SeedIdentityForCommand, error)

func (*SeedIdentityForCommand) CreateRequest

func (c *SeedIdentityForCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*SeedIdentityForCommand) SetResponse

func (c *SeedIdentityForCommand) SetResponse(response []byte, fromCache bool) error

type Semaphore

type Semaphore struct {
	// contains filtered or unexported fields
}

Semaphore is a Go implementation of Java's Semaphore

func NewSemaphore

func NewSemaphore(cap int) *Semaphore

type ServerLoadFailureError

type ServerLoadFailureError struct {
	RavenError
}

func (*ServerLoadFailureError) Error

func (e *ServerLoadFailureError) Error() string

Error makes it conform to error interface

func (*ServerLoadFailureError) WrappedError

func (e *ServerLoadFailureError) WrappedError() error

hackish way to get a wrapped error

type ServerNode

type ServerNode struct {
	URL        string `json:"Url"`
	Database   string `json:"Database"`
	ClusterTag string `json:"ClusterTag"`
	ServerRole string `json:"ServerRole"`
}

ServerNode describes a single server node

func NewServerNode

func NewServerNode() *ServerNode

NewServerNode creates a new ServerNode

type ServerOperationExecutor

type ServerOperationExecutor struct {
	// contains filtered or unexported fields
}

func NewServerOperationExecutor

func NewServerOperationExecutor(store *DocumentStore) *ServerOperationExecutor

func (*ServerOperationExecutor) Close

func (e *ServerOperationExecutor) Close()

func (*ServerOperationExecutor) Send

func (e *ServerOperationExecutor) Send(operation IServerOperation) error

func (*ServerOperationExecutor) SendAsync

func (e *ServerOperationExecutor) SendAsync(operation IServerOperation) (*Operation, error)

type SessionCreatedEventArgs

type SessionCreatedEventArgs struct {
	Session *InMemoryDocumentSessionOperations
}

SessionCreatedEventArgs represents session created event args

type SessionInfo

type SessionInfo struct {
	SessionID int
	// contains filtered or unexported fields
}

SessionInfo describes a session

type SessionOptions

type SessionOptions struct {
	Database                                            string
	RequestExecutor                                     *RequestExecutor
	TransactionMode                                     int
	DisableAtomicDocumentWritesInClusterWideTransaction *bool
}

SessionOptions describes session options

type SetIndexesLockCommand

type SetIndexesLockCommand struct {
	RavenCommandBase
	// contains filtered or unexported fields
}

func NewSetIndexesLockCommand

func NewSetIndexesLockCommand(conventions *DocumentConventions, parameters *SetIndexesLockParameters) (*SetIndexesLockCommand, error)

func (*SetIndexesLockCommand) CreateRequest

func (c *SetIndexesLockCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type SetIndexesLockOperation

type SetIndexesLockOperation struct {
	Command *SetIndexesLockCommand
	// contains filtered or unexported fields
}

func NewSetIndexesLockOperation

func NewSetIndexesLockOperation(indexName string, mode IndexLockMode) (*SetIndexesLockOperation, error)

func NewSetIndexesLockOperationWithParameters

func NewSetIndexesLockOperationWithParameters(parameters *SetIndexesLockParameters) (*SetIndexesLockOperation, error)

func (*SetIndexesLockOperation) GetCommand

func (o *SetIndexesLockOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type SetIndexesLockParameters

type SetIndexesLockParameters struct {
	IndexNames []string      `json:"IndexNames"`
	Mode       IndexLockMode `json:"Mode"`
}

Note: in Java it's Parameters class nested in SetIndexesLockOperation Parameters is already taken

type SetIndexesPriorityCommand

type SetIndexesPriorityCommand struct {
	RavenCommandBase
	// contains filtered or unexported fields
}

SetIndexesPriorityCommand represents command to set indexes priority

func NewSetIndexesPriorityCommand

func NewSetIndexesPriorityCommand(conventions *DocumentConventions, parameters *SetIndexesPriorityParameters) (*SetIndexesPriorityCommand, error)

NewSetIndexesPriorityCommand returns new SetIndexesPriorityCommand

func (*SetIndexesPriorityCommand) CreateRequest

func (c *SetIndexesPriorityCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type SetIndexesPriorityOperation

type SetIndexesPriorityOperation struct {
	Command *SetIndexesPriorityCommand
	// contains filtered or unexported fields
}

SetIndexesPriorityOperation represents operation for setting indexes priority

func NewSetIndexesPriorityOperation

func NewSetIndexesPriorityOperation(indexName string, priority IndexPriority) (*SetIndexesPriorityOperation, error)

NewSetIndexesPriorityOperation returns new SetIndexesPriorityParameters

func (*SetIndexesPriorityOperation) GetCommand

func (o *SetIndexesPriorityOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

GetCommand returns a command

type SetIndexesPriorityParameters

type SetIndexesPriorityParameters struct {
	IndexNames []string      `json:"IndexNames"`
	Priority   IndexPriority `json:"Priority"`
}

SetIndexesPriorityParameters represents arrgument for SetIndexPriorityCommand Note: in Java it's Parameters class nested in SetIndexesPriorityOperation "Parameters" name is already taken

type Size

type Size struct {
	SizeInBytes int64  `json:"SizeInBytes"`
	HumaneSize  string `json:"HumaneSize"`
}

Size describes size of entity on disk

type SpatialBounds

type SpatialBounds struct {
	MinX float64
	MaxX float64
	MinY float64
	MaxY float64
}

SpatialBounds describes bounds of a region

func NewSpatialBounds

func NewSpatialBounds(minX float64, minY float64, maxX float64, maxY float64) *SpatialBounds

NewSpatialBounds returns new SpatialBounds

type SpatialCriteria

type SpatialCriteria interface {
	GetShapeToken(addQueryParameter func(interface{}) string) *shapeToken
	ToQueryToken(fieldName string, addQueryParameter func(interface{}) string) queryToken
}

type SpatialCriteriaCommon

type SpatialCriteriaCommon struct {
	// contains filtered or unexported fields
}

func NewSpatialCriteria

func NewSpatialCriteria(relation SpatialRelation, distanceErrorPct float64) SpatialCriteriaCommon

type SpatialCriteriaFactory

type SpatialCriteriaFactory struct {
}

func NewSpatialCriteriaFactory

func NewSpatialCriteriaFactory() *SpatialCriteriaFactory

func (*SpatialCriteriaFactory) Contains

func (f *SpatialCriteriaFactory) Contains(shapeWkt string) *WktCriteria

func (*SpatialCriteriaFactory) ContainsWithError

func (f *SpatialCriteriaFactory) ContainsWithError(shapeWkt string, distErrorPercent float64) *WktCriteria

func (*SpatialCriteriaFactory) Disjoint

func (f *SpatialCriteriaFactory) Disjoint(shapeWkt string) *WktCriteria

func (*SpatialCriteriaFactory) DisjointWithError

func (f *SpatialCriteriaFactory) DisjointWithError(shapeWkt string, distErrorPercent float64) *WktCriteria

func (*SpatialCriteriaFactory) Intersects

func (f *SpatialCriteriaFactory) Intersects(shapeWkt string) *WktCriteria

func (*SpatialCriteriaFactory) IntersectsWithError

func (f *SpatialCriteriaFactory) IntersectsWithError(shapeWkt string, distErrorPercent float64) *WktCriteria

func (*SpatialCriteriaFactory) RelatesToShape

func (f *SpatialCriteriaFactory) RelatesToShape(shapeWkt string, relation SpatialRelation) *WktCriteria

func (*SpatialCriteriaFactory) RelatesToShapeWithError

func (f *SpatialCriteriaFactory) RelatesToShapeWithError(shapeWkt string, relation SpatialRelation, distErrorPercent float64) *WktCriteria

func (*SpatialCriteriaFactory) Within

func (f *SpatialCriteriaFactory) Within(shapeWkt string) *WktCriteria

func (*SpatialCriteriaFactory) WithinRadius

func (f *SpatialCriteriaFactory) WithinRadius(radius float64, latitude float64, longitude float64) *CircleCriteria

func (*SpatialCriteriaFactory) WithinRadiusWithUnits

func (f *SpatialCriteriaFactory) WithinRadiusWithUnits(radius float64, latitude float64, longitude float64, radiusUnits SpatialUnits) *CircleCriteria

func (*SpatialCriteriaFactory) WithinRadiusWithUnitsAndError

func (f *SpatialCriteriaFactory) WithinRadiusWithUnitsAndError(radius float64, latitude float64, longitude float64, radiusUnits SpatialUnits, distErrorPercent float64) *CircleCriteria

func (*SpatialCriteriaFactory) WithinWithError

func (f *SpatialCriteriaFactory) WithinWithError(shapeWkt string, distErrorPercent float64) *WktCriteria

type SpatialFieldType

type SpatialFieldType = string

SpatialFieldType describe spatial field

type SpatialOptions

type SpatialOptions struct {
	Type         SpatialFieldType      `json:"Type"`
	Strategy     SpatialSearchStrategy `json:"Strategy"`
	MaxTreeLevel int                   `json:"MaxTreeLevel"`
	MinX         float64               `json:"MinX"`
	MaxX         float64               `json:"MaxX"`
	MinY         float64               `json:"MinY"`
	MaxY         float64               `json:"MaxY"`

	// Circle radius units, only used for geography  indexes
	Units SpatialUnits `json:"Units"`
}

/ SpatialOptions describes spatial options

func NewCartesianBoundingBoxIndex

func NewCartesianBoundingBoxIndex() *SpatialOptions

NewCartesianBoundingBoxIndex returns cartesian SpatialOptions

func NewCartesianQuadPrefixTreeIndex

func NewCartesianQuadPrefixTreeIndex(maxTreeLevel int, bounds *SpatialBounds) *SpatialOptions

NewCartesianQuadPrefixTreeIndex returns cartesian SpatialOptions for quad prefix tree index

func NewGeographyBoundingBoxIndexWithRadius

func NewGeographyBoundingBoxIndexWithRadius(circleRadiusUnits SpatialUnits) *SpatialOptions

NewGeographyBoundingBoxIndexWithRadius return geography SpatialOptions for a bounding box with a given radius

func NewGeographyDefaultOptions

func NewGeographyDefaultOptions() *SpatialOptions

NewGeographyDefaultOptions returns default geography SpatialOptions

func NewGeographyDefaultOptionsWithRadius

func NewGeographyDefaultOptionsWithRadius(circleRadiusUnits SpatialUnits) *SpatialOptions

NewGeographyDefaultOptionsWithRadius returns default geography SpatialOptions with a a given radius

func NewGeographyGeohashPrefixTreeIndex

func NewGeographyGeohashPrefixTreeIndex(maxTreeLevel int) *SpatialOptions

NewGeographyGeohashPrefixTreeIndex returns geography SpatialOptions for using geography geohash prefix tree index

func NewGeographyGeohashPrefixTreeIndexWithRadius

func NewGeographyGeohashPrefixTreeIndexWithRadius(maxTreeLevel int, circleRadiusUnits SpatialUnits) *SpatialOptions

NewGeographyGeohashPrefixTreeIndexWithRadius returns geography SpatialOptions for // using geography geohash prefix tree index with a given circle radius

func NewGeographyQuadPrefixTreeIndex

func NewGeographyQuadPrefixTreeIndex(maxTreeLevel int) *SpatialOptions

NewGeographyQuadPrefixTreeIndex returns geography SpatialOptions for quad prefix tree

func NewGeographyQuadPrefixTreeIndexWithRadius

func NewGeographyQuadPrefixTreeIndexWithRadius(maxTreeLevel int, circleRadiusUnits SpatialUnits) *SpatialOptions

NewGeographyQuadPrefixTreeIndex returns geography SpatialOptions for quad prefix tree with a given radius

func NewGeograpyboundingBoxIndex

func NewGeograpyboundingBoxIndex() *SpatialOptions

NewGeograpyboundingBoxIndex returns geography SpatialOptions for a bounding box

func NewSpatialOptions

func NewSpatialOptions() *SpatialOptions

NewSpatialOptions returns new SpatialOptions with default values

type SpatialRelation

type SpatialRelation = string

type SpatialSearchStrategy

type SpatialSearchStrategy = string

SpatialSearchStrategy represents spatial search strategy

type SpatialUnits

type SpatialUnits = string

SpatialUnits describes units used for spatial queries

type StartIndexCommand

type StartIndexCommand struct {
	RavenCommandBase
	// contains filtered or unexported fields
}

func NewStartIndexCommand

func NewStartIndexCommand(indexName string) (*StartIndexCommand, error)

func (*StartIndexCommand) CreateRequest

func (c *StartIndexCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type StartIndexOperation

type StartIndexOperation struct {
	Command *StartIndexCommand
	// contains filtered or unexported fields
}

func NewStartIndexOperation

func NewStartIndexOperation(indexName string) (*StartIndexOperation, error)

func (*StartIndexOperation) GetCommand

func (o *StartIndexOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type StartIndexingCommand

type StartIndexingCommand struct {
	RavenCommandBase
}

func NewStartIndexingCommand

func NewStartIndexingCommand() *StartIndexingCommand

func (*StartIndexingCommand) CreateRequest

func (c *StartIndexingCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type StartIndexingOperation

type StartIndexingOperation struct {
	Command *StartIndexingCommand
}

func NewStartIndexingOperation

func NewStartIndexingOperation() *StartIndexingOperation

func (*StartIndexingOperation) GetCommand

func (o *StartIndexingOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type StartsWithArgs

type StartsWithArgs struct {
	StartsWith string // TODO: Prefix?
	Matches    string
	Start      int
	PageSize   int
	StartAfter string

	Exclude string
}

StartsWithArgs contains arguments for functions that return documents matching one or more options. StartsWith is required, other fields are optional.

type StopIndexCommand

type StopIndexCommand struct {
	RavenCommandBase
	// contains filtered or unexported fields
}

func NewStopIndexCommand

func NewStopIndexCommand(indexName string) (*StopIndexCommand, error)

func (*StopIndexCommand) CreateRequest

func (c *StopIndexCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type StopIndexOperation

type StopIndexOperation struct {
	Command *StopIndexCommand
	// contains filtered or unexported fields
}

func NewStopIndexOperation

func NewStopIndexOperation(indexName string) (*StopIndexOperation, error)

func (*StopIndexOperation) GetCommand

func (o *StopIndexOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type StopIndexingCommand

type StopIndexingCommand struct {
	RavenCommandBase
}

func NewStopIndexingCommand

func NewStopIndexingCommand() *StopIndexingCommand

func (*StopIndexingCommand) CreateRequest

func (c *StopIndexingCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type StopIndexingOperation

type StopIndexingOperation struct {
	Command *StopIndexingCommand
}

func NewStopIndexingOperation

func NewStopIndexingOperation() *StopIndexingOperation

func (*StopIndexingOperation) GetCommand

func (o *StopIndexingOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error)

type StreamCommand

type StreamCommand struct {
	RavenCommandBase

	Result *StreamResultResponse
	// contains filtered or unexported fields
}

func NewStreamCommand

func NewStreamCommand(url string) *StreamCommand

func (*StreamCommand) CreateRequest

func (c *StreamCommand) CreateRequest(node *ServerNode) (*http.Request, error)

type StreamIterator

type StreamIterator struct {
	// contains filtered or unexported fields
}

StreamIterator represents iterator of stream query

func (*StreamIterator) Close

func (i *StreamIterator) Close() error

Close closes an iterator

func (*StreamIterator) Next

func (i *StreamIterator) Next(v interface{}) (*StreamResult, error)

Next returns next result in a streaming query.

type StreamOperation

type StreamOperation struct {
	// contains filtered or unexported fields
}

StreamOperation represents a streaming operation

func NewStreamOperation

func NewStreamOperation(session *InMemoryDocumentSessionOperations, statistics *StreamQueryStatistics) *StreamOperation

NewStreamOperation returns new StreamOperation

type StreamQueryStatistics

type StreamQueryStatistics struct {
	IndexName      string    `json:"IndexName"`
	IsStale        bool      `json:"IsStale"`
	IndexTimestamp time.Time `json:"IndexTimestamp"`
	TotalResults   int       `json:"TotalResults"`
	ResultEtag     int64     `json:"ResultEtag"`
}

type StreamResult

type StreamResult struct {
	ID           string
	ChangeVector *string
	Metadata     *MetadataAsDictionary
	Document     interface{}
}

StreamResult represents result of stream iterator

type StreamResultResponse

type StreamResultResponse struct {
	Response *http.Response `json:"Response"`
	Stream   io.Reader      `json:"Stream"`
}

type StringDistanceTypes

type StringDistanceTypes = string

type SubscriberErrorError

type SubscriberErrorError struct {
	SubscriptionError
}

SubscriberErrorError represents error about subscriber error Note: name is unfortunate but it corresponds to Java's SubscriberErrorException

func (*SubscriberErrorError) Error

func (e *SubscriberErrorError) Error() string

Error makes it conform to error interface

func (*SubscriberErrorError) WrappedError

func (e *SubscriberErrorError) WrappedError() error

hackish way to get a wrapped error

type SubscriptionBatch

type SubscriptionBatch struct {
	Items []*SubscriptionBatchItem
	// contains filtered or unexported fields
}

SubscriptionBatch describes a bunch of results for subscription

func (*SubscriptionBatch) OpenSession

func (b *SubscriptionBatch) OpenSession() (*DocumentSession, error)

type SubscriptionBatchItem

type SubscriptionBatchItem struct {
	Result       interface{}
	ErrorMessage string
	ID           string
	ChangeVector string

	RawResult   map[string]interface{}
	RawMetadata map[string]interface{}
	Metadata    *MetadataAsDictionary
}

SubscriptionBatchItem describes a single result from subscription

func (*SubscriptionBatchItem) GetMetadata

func (i *SubscriptionBatchItem) GetMetadata() *MetadataAsDictionary

func (*SubscriptionBatchItem) GetResult

func (i *SubscriptionBatchItem) GetResult(result interface{}) error

GetResult sets result to to the value of that batch item

type SubscriptionChangeVectorUpdateConcurrencyError

type SubscriptionChangeVectorUpdateConcurrencyError struct {
	SubscriptionError
}

SubscriptionChangeVectorUpdateConcurrencyError represents an error about subscription change vector update concurrency

func (*SubscriptionChangeVectorUpdateConcurrencyError) Error

func (e *SubscriptionChangeVectorUpdateConcurrencyError) Error() string

Error makes it conform to error interface

func (*SubscriptionChangeVectorUpdateConcurrencyError) WrappedError

func (e *SubscriptionChangeVectorUpdateConcurrencyError) WrappedError() error

hackish way to get a wrapped error

type SubscriptionClientMessageType

type SubscriptionClientMessageType = string

SubscriptionClientMessageType describes type of subscription client message

type SubscriptionClosedError

type SubscriptionClosedError struct {
	SubscriptionError
}

SubscriptionClosedError is returned when subscription is closed

func (*SubscriptionClosedError) Error

func (e *SubscriptionClosedError) Error() string

Error makes it conform to error interface

func (*SubscriptionClosedError) WrappedError

func (e *SubscriptionClosedError) WrappedError() error

hackish way to get a wrapped error

type SubscriptionConnectionClientMessage

type SubscriptionConnectionClientMessage struct {
	Type         SubscriptionClientMessageType `json:"Type"`
	ChangeVector *string                       `json:"ChangeVector"`
}

SubscriptionConnectionClientMessage describes a subscription connection message

type SubscriptionCreationOptions

type SubscriptionCreationOptions struct {
	// must omitempty Name or else the server will try to find a subscription
	// with empty name
	Name         string  `json:"Name,omitempty"`
	Query        string  `json:"Query"`
	ChangeVector *string `json:"ChangeVector"`
	MentorNode   string  `json:"MentorNode,omitempty"`
}

SubscriptionCreationOptions describes options for creating a subscription

type SubscriptionDoesNotBelongToNodeError

type SubscriptionDoesNotBelongToNodeError struct {
	SubscriptionError
	// contains filtered or unexported fields
}

SubscriptionDoesNotBelongToNodeError is returned when subscription does not belong to node

func (*SubscriptionDoesNotBelongToNodeError) Error

func (e *SubscriptionDoesNotBelongToNodeError) Error() string

Error makes it conform to error interface

func (*SubscriptionDoesNotBelongToNodeError) WrappedError

func (e *SubscriptionDoesNotBelongToNodeError) WrappedError() error

hackish way to get a wrapped error

type SubscriptionDoesNotExistError

type SubscriptionDoesNotExistError struct {
	SubscriptionError
}

SubscriptionDoesNotExistError is returned when subscription doesn't exist

func (*SubscriptionDoesNotExistError) Error

func (e *SubscriptionDoesNotExistError) Error() string

Error makes it conform to error interface

func (*SubscriptionDoesNotExistError) WrappedError

func (e *SubscriptionDoesNotExistError) WrappedError() error

hackish way to get a wrapped error

type SubscriptionError

type SubscriptionError struct {
	RavenError
}

a base type for subscription-related errors

func (*SubscriptionError) Error

func (e *SubscriptionError) Error() string

Error makes it conform to error interface

func (*SubscriptionError) WrappedError

func (e *SubscriptionError) WrappedError() error

hackish way to get a wrapped error

type SubscriptionInUseError

type SubscriptionInUseError struct {
	SubscriptionError
}

SubscriptionInUseError is returned when subscription is in use

func (*SubscriptionInUseError) Error

func (e *SubscriptionInUseError) Error() string

Error makes it conform to error interface

func (*SubscriptionInUseError) WrappedError

func (e *SubscriptionInUseError) WrappedError() error

hackish way to get a wrapped error

type SubscriptionInvalidStateError

type SubscriptionInvalidStateError struct {
	SubscriptionError
}

SubscriptionInvalidStateError is returned when subscription is in invalid state

func (*SubscriptionInvalidStateError) Error

func (e *SubscriptionInvalidStateError) Error() string

Error makes it conform to error interface

func (*SubscriptionInvalidStateError) WrappedError

func (e *SubscriptionInvalidStateError) WrappedError() error

hackish way to get a wrapped error

type SubscriptionOpeningStrategy

type SubscriptionOpeningStrategy = string

SubscriptionOpeningStrategy describes opening strategy for subscriptions

type SubscriptionState

type SubscriptionState struct {
	Query                                 string  `json:"Query"`
	ChangeVectorForNextBatchStartingPoint *string `json:"ChangeVectorForNextBatchStartingPoint"`
	SubscriptionID                        int64   `json:"SubscriptionId"`
	SubscriptionName                      string  `json:"SubscriptionName"`
	MentorNode                            string  `json:"MentorNode"`
	NodeTag                               string  `json:"NodeTag"`
	LastBatchAckTime                      Time    `json:"LastBatchAckTime"`
	LastClientConnectionTime              Time    `json:"LastClientConnectionTime"`
	Disabled                              bool    `json:"Disabled"`
}

SubscriptionState describes state of subscription

type SubscriptionStateWithNodeDetails

type SubscriptionStateWithNodeDetails struct {
	SubscriptionState
	ResponsibleNode NodeID
}

SubscriptionStateWithNodeDetails describes subscription state with node details

type SubscriptionTryout

type SubscriptionTryout struct {
	// contains filtered or unexported fields
}

SubscriptionTryout describes subscription tryout

type SubscriptionWorker

type SubscriptionWorker struct {
	// contains filtered or unexported fields
}

SubscriptionWorker describes subscription worker

func NewSubscriptionWorker

func NewSubscriptionWorker(clazz reflect.Type, options *SubscriptionWorkerOptions, withRevisions bool, documentStore *DocumentStore, dbName string) (*SubscriptionWorker, error)

NewSubscriptionWorker returns new SubscriptionWorker

func (*SubscriptionWorker) AddAfterAcknowledgmentListener

func (w *SubscriptionWorker) AddAfterAcknowledgmentListener(handler func(*SubscriptionBatch)) int

AddAfterAcknowledgmentListener adds callback function that will be called after listener has been acknowledged. Returns id that can be used in RemoveAfterAcknowledgmentListener

func (*SubscriptionWorker) AddOnSubscriptionConnectionRetry

func (w *SubscriptionWorker) AddOnSubscriptionConnectionRetry(handler func(error)) int

AddOnSubscriptionConnectionRetry adds a callback function that will be called when subscription connection is retried. Returns id that can be used in RemoveOnSubscriptionConnectionRetry

func (*SubscriptionWorker) Cancel

func (w *SubscriptionWorker) Cancel()

Cancel requests the worker to finish. It doesn't happen immediately. To check if the worker finished, use HasFinished To wait

func (*SubscriptionWorker) Close

func (w *SubscriptionWorker) Close() error

Close closes a subscription

func (*SubscriptionWorker) Err

func (w *SubscriptionWorker) Err() error

Err returns a potential error, available after worker finished

func (*SubscriptionWorker) IsDone

func (w *SubscriptionWorker) IsDone() bool

IsDone returns true if the worker has finished

func (*SubscriptionWorker) RemoveAfterAcknowledgmentListener

func (w *SubscriptionWorker) RemoveAfterAcknowledgmentListener(id int)

RemoveAfterAcknowledgmentListener removes a callback added with AddAfterAcknowledgmentListener

func (*SubscriptionWorker) RemoveOnSubscriptionConnectionRetry

func (w *SubscriptionWorker) RemoveOnSubscriptionConnectionRetry(id int)

RemoveOnSubscriptionConnectionRetry removes a callback added with AddOnSubscriptionConnectionRetry

func (*SubscriptionWorker) Run

func (w *SubscriptionWorker) Run(cb func(*SubscriptionBatch) error) error

func (*SubscriptionWorker) WaitUntilFinished

func (w *SubscriptionWorker) WaitUntilFinished(timeout time.Duration) error

WaitUntilFinished waits until worker finishes for up to a timeout and returns an error. If timeout is 0, it waits indefinitely.

type SubscriptionWorkerOptions

type SubscriptionWorkerOptions struct {
	SubscriptionName                string                      `json:"SubscriptionName"`
	TimeToWaitBeforeConnectionRetry Duration                    `json:"TimeToWaitBeforeConnectionRetry"`
	IgnoreSubscriberErrors          bool                        `json:"IgnoreSubscriberErrors"`
	Strategy                        SubscriptionOpeningStrategy `json:"Strategy"`
	MaxDocsPerBatch                 int                         `json:"MaxDocsPerBatch"`
	MaxErroneousPeriod              Duration                    `json:"MaxErroneousPeriod"`
	CloseWhenNoDocsLeft             bool                        `json:"CloseWhenNoDocsLeft"`
}

SubscriptionWorkerOptions describes options for subscription worker

func NewSubscriptionWorkerOptions

func NewSubscriptionWorkerOptions(subscriptionName string) *SubscriptionWorkerOptions

NewSubscriptionWorkerOptions returns new SubscriptionWorkerOptions

type SuggestionBase

type SuggestionBase interface {
	SetOptions(*SuggestionOptions)
}

for documentation purposes only TODO: could be simplified. We really only need SuggestionWithTerms, which is a superset of SuggestionWithTerm

type SuggestionBuilder

type SuggestionBuilder struct {
	// contains filtered or unexported fields
}

SuggestionsBuilder helps to build argument to SuggestUsing

func NewSuggestionBuilder

func NewSuggestionBuilder() *SuggestionBuilder

func (*SuggestionBuilder) ByField

func (b *SuggestionBuilder) ByField(fieldName string, term string, terms ...string) *SuggestionBuilder

func (*SuggestionBuilder) GetSuggestion

func (b *SuggestionBuilder) GetSuggestion() SuggestionBase

func (*SuggestionBuilder) WithOptions

func (b *SuggestionBuilder) WithOptions(options *SuggestionOptions) *SuggestionBuilder

type SuggestionCommon

type SuggestionCommon struct {
	Field   string
	Options *SuggestionOptions
}

func (*SuggestionCommon) SetOptions

func (s *SuggestionCommon) SetOptions(options *SuggestionOptions)

type SuggestionDocumentQuery

type SuggestionDocumentQuery struct {
	// contains filtered or unexported fields
}

SuggestionDocumentQuery represents "suggestion" query

func (*SuggestionDocumentQuery) Execute

func (*SuggestionDocumentQuery) ExecuteLazy

func (q *SuggestionDocumentQuery) ExecuteLazy() (*Lazy, error)

onEval: v is map[string]*SuggestionResult

func (*SuggestionDocumentQuery) InvokeAfterQueryExecuted

func (q *SuggestionDocumentQuery) InvokeAfterQueryExecuted(result *QueryResult)

type SuggestionOptions

type SuggestionOptions struct {
	PageSize int

	Distance StringDistanceTypes

	Accuracy float32

	SortMode SuggestionSortMode
}

func NewSuggestionOptions

func NewSuggestionOptions() *SuggestionOptions

type SuggestionResult

type SuggestionResult struct {
	Name        string   `json:"Name"`
	Suggestions []string `json:"Suggestions"`
}

type SuggestionSortMode

type SuggestionSortMode = string

type SuggestionWithTerm

type SuggestionWithTerm struct {
	SuggestionCommon
	Term string
}

func NewSuggestionWithTerm

func NewSuggestionWithTerm(field string) *SuggestionWithTerm

type SuggestionWithTerms

type SuggestionWithTerms struct {
	SuggestionCommon
	Terms []string
}

func NewSuggestionWithTerms

func NewSuggestionWithTerms(field string) *SuggestionWithTerms

type TcpConnectionInfo

type TcpConnectionInfo struct {
	Port        int     `json:"Port"`
	URL         string  `json:"Url"`
	Certificate *string `json:"Certificate"`
}

TcpConnectionInfo describes tpc connection

type TermsQueryResult

type TermsQueryResult struct {
	Terms      []string `json:"Terms"`
	ResultEtag int64    `json:"ResultEtag"`
	IndexName  string   `json:"IndexName"`
}

TermsQueryResult represents results of terms query

type Time

type Time time.Time

Time is an alias for time.Time that serializes/deserializes in ways compatible with Ravendb server

func (Time) Format

func (t Time) Format() string

Format formats time in a way that RavenDB server understands. RavenDB is strict enough that a single format can't produce valid string values.

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(d []byte) error

type TimeoutError

type TimeoutError struct {
	RavenError
}

TimeoutError represents timeout error

func NewTimeoutError

func NewTimeoutError(format string, args ...interface{}) *TimeoutError

NewTimeoutError returns new TimeoutError

func (*TimeoutError) Error

func (e *TimeoutError) Error() string

Error makes it conform to error interface

func (*TimeoutError) WrappedError

func (e *TimeoutError) WrappedError() error

hackish way to get a wrapped error

type Topology

type Topology struct {
	Nodes []*ServerNode `json:"Nodes"`
	Etag  int64         `json:"Etag"`
}

Topology describes server nodes

type TransactionMode

type TransactionMode = int

type UUID

type UUID struct {
	// contains filtered or unexported fields
}

UUID represents a random 16-byte number

func NewUUID

func NewUUID() *UUID

NewUUID creates a new UUID

func (*UUID) Hex

func (u *UUID) Hex() string

Hex returns hex-encoded version. Equivalent of python's uuid.uuid4().hex

func (*UUID) String

func (u *UUID) String() string

String returns xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx representation

type UnsuccessfulRequestError

type UnsuccessfulRequestError struct {
	RavenError
}

func (*UnsuccessfulRequestError) Error

func (e *UnsuccessfulRequestError) Error() string

Error makes it conform to error interface

func (*UnsuccessfulRequestError) WrappedError

func (e *UnsuccessfulRequestError) WrappedError() error

hackish way to get a wrapped error

type UnsupportedOperationError

type UnsupportedOperationError struct {
	// contains filtered or unexported fields
}

UnsupportedOperationError represents unsupported operation error

func (*UnsupportedOperationError) Error

func (e *UnsupportedOperationError) Error() string

Error makes it conform to error interface

func (*UnsupportedOperationError) WrappedError

func (e *UnsupportedOperationError) WrappedError() error

hackish way to get a wrapped error

type UpdateExternalReplicationCommand

type UpdateExternalReplicationCommand struct {
	RavenCommandBase

	Result *ModifyOngoingTaskResult
	// contains filtered or unexported fields
}

func NewUpdateExternalReplicationCommand

func NewUpdateExternalReplicationCommand(newWatcher *ExternalReplication) *UpdateExternalReplicationCommand

func (*UpdateExternalReplicationCommand) CreateRequest

func (c *UpdateExternalReplicationCommand) CreateRequest(node *ServerNode) (*http.Request, error)

func (*UpdateExternalReplicationCommand) SetResponse

func (c *UpdateExternalReplicationCommand) SetResponse(response []byte, fromCache bool) error

type UpdateExternalReplicationOperation

type UpdateExternalReplicationOperation struct {
	Command *UpdateExternalReplicationCommand
	// contains filtered or unexported fields
}

func NewUpdateExternalReplicationOperation

func NewUpdateExternalReplicationOperation(newWatcher *ExternalReplication) *UpdateExternalReplicationOperation

func (*UpdateExternalReplicationOperation) GetCommand

type WktCriteria

type WktCriteria struct {
	SpatialCriteriaCommon
	// contains filtered or unexported fields
}

func NewWktCriteria

func NewWktCriteria(shapeWkt string, relation SpatialRelation, distErrorPercent float64) *WktCriteria

func (*WktCriteria) GetShapeToken

func (c *WktCriteria) GetShapeToken(addQueryParameter func(interface{}) string) *shapeToken

func (*WktCriteria) ToQueryToken

func (c *WktCriteria) ToQueryToken(fieldName string, addQueryParameter func(interface{}) string) queryToken

type WktField

type WktField struct {
	// contains filtered or unexported fields
}

func NewWktField

func NewWktField(wkt string) *WktField

func (*WktField) ToField

func (f *WktField) ToField(ensureValidFieldName func(string, bool) (string, error)) (string, error)

Source Files

Directories

Path Synopsis
cmd
serverwide

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL