document

package
v0.0.0-...-080b9e8 Latest Latest
Warning

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

Go to latest
Published: May 7, 2025 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document struct {
	Kuzzle types.IKuzzle
}

Document controller

func NewDocument

func NewDocument(kuzzle types.IKuzzle) *Document

NewDocument instanciates a new collection controller

func (*Document) Count

func (d *Document) Count(index string, collection string, body json.RawMessage, options types.QueryOptions) (int, error)

Count returns the number of documents matching the provided set of filters. There is a small delay between documents creation and their existence in our advanced search layer, usually a couple of seconds. That means that a document that was just been created won’t be returned by this function

func (*Document) Create

func (d *Document) Create(index string, collection string, id string, body json.RawMessage, options types.QueryOptions) (json.RawMessage, error)

Create a new document in Kuzzle. Takes an optional argument object with the following properties:

  • volatile (object, default: null): Additional information passed to notifications to other users
  • ifExist (string, allowed values: "error" (default), "replace"): If the same document already exists:
  • resolves with an error if set to "error".
  • replaces the existing document if set to "replace"

func (*Document) CreateOrReplace

func (d *Document) CreateOrReplace(index string, collection string, _id string, body json.RawMessage, options types.QueryOptions) (json.RawMessage, error)

CreateOrReplace a document in Kuzzle. Takes an optional argument object with the following properties:

  • volatile (object, default: null): Additional information passed to notifications to other users
  • ifExist (string, allowed values: "error" (default), "replace"): If the same document already exists:
  • resolves with an error if set to "error".
  • replaces the existing document if set to "replace"

func (*Document) Delete

func (d *Document) Delete(index string, collection string, _id string, options types.QueryOptions) (string, error)

Delete deletes the Document using its provided unique id.

func (*Document) DeleteByQuery

func (d *Document) DeleteByQuery(index string, collection string, body json.RawMessage, options types.QueryOptions) ([]string, error)

DeleteByQuery deletes all the documents from Kuzzle that match the given filter or query.

func (*Document) Exists

func (d *Document) Exists(index string, collection string, _id string, options types.QueryOptions) (bool, error)

Exists returns a boolean indicating whether or not a document with provided ID exists.

func (*Document) Get

func (d *Document) Get(index string, collection string, _id string, options types.QueryOptions) (json.RawMessage, error)

Get retrieves a Document using its provided unique id.

func (*Document) MCreate

func (d *Document) MCreate(index string, collection string, documents json.RawMessage, options types.QueryOptions) (json.RawMessage, error)

MCreate creates the provided documents.

func (*Document) MCreateOrReplace

func (d *Document) MCreateOrReplace(index string, collection string, documents json.RawMessage, options types.QueryOptions) (json.RawMessage, error)

MCreateOrReplace creates or replaces the provided documents.

func (*Document) MDelete

func (d *Document) MDelete(index string, collection string, ids []string, options types.QueryOptions) (json.RawMessage, error)

MDelete deletes multiple documents at once

func (*Document) MGet

func (d *Document) MGet(index string, collection string, ids []string, options types.QueryOptions) (json.RawMessage, error)

MGet fetches multiple documents at once

func (*Document) MReplace

func (d *Document) MReplace(index string, collection string, documents json.RawMessage, options types.QueryOptions) (json.RawMessage, error)

MReplace replaces multiple documents at once.

func (*Document) MUpdate

func (d *Document) MUpdate(index string, collection string, documents json.RawMessage, options types.QueryOptions) (json.RawMessage, error)

MUpdate updates multiple documents at once

func (*Document) Replace

func (d *Document) Replace(index string, collection string, _id string, body json.RawMessage, options types.QueryOptions) (json.RawMessage, error)

Replace replaces a document in Kuzzle.

func (*Document) Search

func (d *Document) Search(index string, collection string, body json.RawMessage, options types.QueryOptions) (*types.SearchResult, error)

Search documents in the given Collection, using provided filters and option.

func (*Document) Update

func (d *Document) Update(index string, collection string, id string, body json.RawMessage, options types.QueryOptions) (json.RawMessage, error)

Update updates a document in Kuzzle.

func (*Document) Validate

func (d *Document) Validate(index string, collection string, body json.RawMessage, options types.QueryOptions) (bool, error)

Validate validates data against existing validation rules.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL