package
0.0.0-20250226171102-4db14ec44d68
Repository: https://github.com/cozy/cozy-stack.git
Documentation: pkg.go.dev
# Functions
AddHook adds an hook for the given doctype and event.
AllDoctypes returns a list of all the doctypes that have a database on a given instance.
BulkDeleteDocs is used to delete serveral documents in one call.
BulkForceUpdateDocs is used to update several docs in one call, and to force the revisions history.
BulkGetDocs returns the documents with the given id at the given revision.
BulkUpdateDocs is used to update several docs in one call, as a bulk.
CheckDesignDocCanBeDeleted will return false for an index or view used by the stack.
CheckStatus checks that the stack can talk to CouchDB, and returns an error if it is not the case.
Compact asks CouchDB to compact a database.
Copy copies an existing doc to a specified destination.
CountAllDocs returns the number of documents of the given doctype.
CountNormalDocs returns the number of documents of the given doctype, and excludes the design docs from the count.
CreateDB creates the necessary database for a doctype.
CreateDoc is used to persist the given document in the couchdb database.
CreateNamedDoc persist a document with an ID.
CreateNamedDocWithDB is equivalent to CreateNamedDoc but creates the database if it does not exist.
DBStatus responds with informations on the database: size, number of documents, sequence numbers, etc.
DefineIndex define the index on the doctype database see query package on how to define an index.
DefineIndexes defines a list of indexes.
DefineIndexRaw defines a index.
DefineView ensure that a view exists, or creates it.
DefineViews creates a design doc with some views.
DeleteAllDBs will remove all the couchdb doctype databases for a couchdb.DB.
DeleteDB destroy the database for a doctype.
DeleteDoc deletes a struct implementing the couchb.Doc interface If the document's current rev does not match the one passed, a CouchdbError(409 conflict) will be returned.
DeleteLocal will delete a local document in CouchDB.
EnsureDBExist creates the database for the doctype if it doesn't exist.
EscapeCouchdbName can be used to build the name of a database from the instance prefix and doctype.
ExecView executes the specified view function.
FindDocs returns all documents matching the passed FindRequest documents will be unmarshalled in the provided results slice.
FindDocsRaw find documents.
FindDocsUnoptimized allows search on non-indexed fields.
ForeachDocs traverse all the documents from the given database with the specified doctype and calls a function for each document.
ForeachDocsWithCustomPagination traverse all the documents from the given database, and calls a function for each document.
GetAllDocs returns all documents of a specified doctype.
GetChanges returns a list of changes in couchdb.
GetDesignDocs does the same as GetAllDocs, but it keeps the design docs.
GetDoc fetches a document by its docType and id It fills with out by json.Unmarshal-ing.
GetDocRev fetch a document by its docType and ID on a specific revision, out is filled with the document by json.Unmarshal-ing.
GetDocWithRevs fetches a document by its docType and ID.
GetLocal fetch a local document from CouchDB http://docs.couchdb.org/en/stable/api/local.html#get--db-_local-docid.
IndexesByDoctype returns the list of indexes for a specified doc type.
InitGlobalDB defines views and indexes on the global databases.
IsConflictError checks if an error from the error tree contains a CouchDB 409 (Conflict) status code.
IsCouchError returns whether or not one error from the error tree is of type couchdb.Error.
IsDeletedError checks if an error from the error tree contains a CouchDB a "not_found" error with the "deleted" reason.
IsFileExists checks if an error from the error tree contains a CouchDB a "file_exists" error.
IsInternalServerError checks if an error from the error tree contains a CouchDB error with a 5xx code.
IsNoDatabaseError checks if an error from the error tree contains a CouchDB a "no_db_file" error.
IsNotFoundError checks if an error from the error tree contains a CouchDB a "not_found" error.
IsNoUsableIndexError checks if an error from the error tree contains a "no_usable_index" error.
No description provided by the author
NewEmptyObjectOfSameType takes an object and returns a new object of the same type.
NewKeyCursor returns a new key based Cursor pointing to the given start_key & startkey_docid.
NewSkipCursor returns a new skip based Cursor pointing to the page after skip items.
NormalDocs returns all the documents from a database, with pagination, but it excludes the design docs.
PostChanges returns a list of changes in couchdb.
Proxy generate a httputil.ReverseProxy which forwards the request to the correct route.
ProxyBulkDocs generates a httputil.ReverseProxy to forward the couchdb request on the _bulk_docs endpoint.
PutLocal will put a local document in CouchDB.
ResetDB destroy and recreate the database for a doctype.
RTEvent published a realtime event for a couchDB change.
StaticChangesFilter checks that the filter is static (ie doesn't depend of a design doc).
UpdateDoc update a document.
UpdateDocWithOld updates a document, like UpdateDoc.
UpdateIndexesAndViews creates views and indexes that are missing or not up-to-date.
Upsert create the doc or update it if it already exists.
ValidChangesMode convert any string into a ChangesFeedMode or gives an error if the string is invalid.
ValidChangesStyle convert any string into a ChangesFeedStyle or gives an error if the string is invalid.
ViewsByDoctype returns the list of views for a specified doc type.
# Constants
ChangesModeNormal is the only mode supported by cozy-stack.
ChangesStyleAllDocs pass all revisions including conflicts.
ChangesStyleMainOnly only pass the winning revision.
Events to hook into.
Events to hook into.
Events to hook into.
IndexViewsVersion is the version of current definition of views & indexes.
MaxString is the unicode character "\uFFFF", useful in query as a upperbound for string.
SelectorReferencedBy is the string constant for the references in a JSON document.
# Variables
ContactByEmail is used to find a contact by its email address.
DirNotSynchronizedOnView is the view used for fetching directories that are not synchronized on a given device.
DiskUsageView is the view used for computing the disk usage for files.
DomainAndAliasesView defines a view to fetch instances by domain and domain aliases.
FilesByParentView is the view used for fetching files referenced by a given document.
FilesReferencedByView is the view used for fetching files referenced by a given document.
Indexes is the index list required by an instance to run properly.
OldVersionsDiskUsageView is the view used for computing the disk usage for the old versions of file contents.
PermissionsByDoctype returns a list of permissions that have at least one rule for the given doctype.
PermissionsShareByCView is the view for fetching the permissions associated to a document via a token code.
PermissionsShareByDocView is the view for fetching a list of permissions associated to a list of IDs.
PermissionsShareByShortcodeView is the view for fetching the permissions associated to a document via a token code.
ReferencedBySortedByDatetimeView is the view used for fetching files referenced by a given document, sorted by the datetime.
SharedDocsBySharingID is the view for fetching a list of shared doctype/id associated with a sharingid.
SharingsByDocTypeView is the view for fetching a list of sharings associated with a doctype.
Views is the list of all views that are created by the stack.
# Structs
AllDocsRequest is used to build a _all_docs request.
AllDocsResponse is the response we receive from an _all_docs request.
AllDocsRow is a row inside the _all_docs response.
BulkGetResponse is the response we receive from a _bulk_get request.
A Change is an atomic change in couchdb.
A ChangesRequest are all parameters than can be passed to a changes feed.
A ChangesResponse is the response provided by a GetChanges call.
DBStatusResponse is the response from DBStatus.
DesignDoc is the structure if a _design doc containing views.
DocReference is a reference to a document.
Error represent an error from couchdb.
ExecutionStats is returned by CouchDB on _find queries.
FindRequest is used to build a find request.
FindResponse is the response from couchdb on a find request.
IDRev is used for the payload of POST _bulk_get.
IndexCreationResponse is the response from couchdb when we create an Index.
JSONDoc is a map representing a simple json object that implements the Doc interface.
NormalDocsResponse is the response the stack send for _normal_docs queries.
SkipCursor is a Cursor using Skip to know how deep in the request it is.
StartKeyCursor is a Cursor using start_key, ie a reference to the last fetched item to keep pagination.
UpdateResponse is the response from couchdb when updating documents.
View is the map/reduce thing in CouchDB.
ViewRequest are all params that can be passed to a view It can be encoded either as a POST-json or a GET-url.
ViewResponse is the response we receive when executing a view.
ViewResponseRow is a row in a ViewResponse.
# Type aliases
ChangesFeedMode is a value for the feed parameter of a ChangesRequest.
ChangesFeedStyle is a value for the style parameter of a ChangesRequest.