Skip to content

Class: RepositoryGalaxy

Methods

NameDescription
:get(key)Returns a document value given its key or nil if it does not exist
:insert(value)Inserts a new document
:remove(key)Deletes a document given its key. Does not raise any error if the document does not exist.
:update(key,value)Updates an existing document given an existing document ID.
Raises an error if the document does not exist.

Method declarations

Method: get

Returns a document value given its key or nil if it does not exist

lua
function RepositoryGalaxy:get(
    key
) end

Parameters:

  • key (integer) - The document ID

Returns:

  • any - document if found or nil if not found

Method: insert

Inserts a new document

lua
function RepositoryGalaxy:insert(
    value
) end

Parameters:

  • value (any) - The document value to insert

Returns:

  • integer - new integer ID of the inserted document

Method: remove

Deletes a document given its key. Does not raise any error if the document does not exist.

lua
function RepositoryGalaxy:remove(
    key
) end

Parameters:

  • key (integer) - The document ID

Method: update

Updates an existing document given an existing document ID. Raises an error if the document does not exist.

lua
function RepositoryGalaxy:update(
    key,
    value
) end

Parameters:

  • key (integer) - The document ID
  • value (any) - The document value to update