Gom.Repository

g GObject.Object GObject.Object Gom.Repository Gom.Repository GObject.Object->Gom.Repository

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (adapter)

automatic_migrate_async (version, object_types, callback, *user_data)

automatic_migrate_finish (result)

automatic_migrate_sync (version, object_types)

find_async (resource_type, filter, callback, *user_data)

find_finish (result)

find_one_async (resource_type, filter, callback, *user_data)

find_one_finish (result)

find_one_sync (resource_type, filter)

find_sorted_async (resource_type, filter, sorting, callback, *user_data)

find_sorted_sync (resource_type, filter, sorting)

find_sync (resource_type, filter)

get_adapter ()

migrate_async (version, migrator, migrator_data, callback, *user_data)

migrate_finish (result)

migrate_sync (version, migrator, *migrator_data)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

adapter

Gom.Adapter

r/w/co

The adapter for the repository.

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Gom.Repository(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gom.RepositoryClass

classmethod new(adapter)
Parameters:

adapter (Gom.Adapter) –

Return type:

Gom.Repository

automatic_migrate_async(version, object_types, callback, *user_data)
Parameters:

Performs an automatic migration on the underlying database. See Gom.Repository.automatic_migrate_sync() for details.

Upon completion, callback will be executed and it must call Gom.Repository.automatic_migrate_finish().

automatic_migrate_finish(result)
Parameters:

result (Gio.AsyncResult) –

Raises:

GLib.Error

Return type:

bool

automatic_migrate_sync(version, object_types)
Parameters:
Raises:

GLib.Error

Returns:

True in case of success.

Return type:

bool

Performs an automatic migration on the underlying database. For each of the GObject.GType passed in object_types, the table will be created if necessary, and each of the columns corresponding to properties will be added if needed.

find_async(resource_type, filter, callback, *user_data)
Parameters:
find_finish(result)
Parameters:

result (Gio.AsyncResult) – A Gio.AsyncResult.

Raises:

GLib.Error

Returns:

A Gom.ResourceGroup.

Return type:

Gom.ResourceGroup

Completes an asynchronous request to fetch a group of resources.

find_one_async(resource_type, filter, callback, *user_data)
Parameters:
find_one_finish(result)
Parameters:

result (Gio.AsyncResult) – A Gio.AsyncResult.

Raises:

GLib.Error

Returns:

A Gom.Resource if successful, otherwise None.

Return type:

Gom.Resource

Completes an asynchronous request to find a single resource in the repository. See Gom.Repository.find_one_async() for more info.

find_one_sync(resource_type, filter)
Parameters:
Raises:

GLib.Error

Returns:

A Gom.Resource or None.

Return type:

Gom.Resource

Synchronous version of Gom.Repository.find_async().

find_sorted_async(resource_type, filter, sorting, callback, *user_data)
Parameters:
find_sorted_sync(resource_type, filter, sorting)
Parameters:
Raises:

GLib.Error

Returns:

A Gom.ResourceGroup or None.

Return type:

Gom.ResourceGroup

Synchronously queries the Gom.Repository for objects matching the requested query. This must only be run from a callback provided to Gom.Adapter.queue_read().

find_sync(resource_type, filter)
Parameters:
Raises:

GLib.Error

Returns:

A Gom.ResourceGroup or None.

Return type:

Gom.ResourceGroup

Synchronously queries the Gom.Repository for objects matching the requested query. This must only be run from a callback provided to Gom.Adapter.queue_read().

get_adapter()
Returns:

A Gom.Adapter.

Return type:

Gom.Adapter

Fetches the underlying adapter.

migrate_async(version, migrator, migrator_data, callback, *user_data)
Parameters:

Asynchronously performs a migration on the underlying database. This will call migrator from the SQLite thread for each migration to perform.

Upon completion, callback will be executed and it must call Gom.Repository.migrate_finish().

migrate_finish(result)
Parameters:

result (Gio.AsyncResult) –

Raises:

GLib.Error

Return type:

bool

migrate_sync(version, migrator, *migrator_data)
Parameters:
  • version (int) – The version to migrate to.

  • migrator (Gom.RepositoryMigrator) – A function to perform the migrations.

  • migrator_data (object or None) – User data for migrator.

Raises:

GLib.Error

Returns:

True in case of success.

Return type:

bool

Performs a migration on the underlying database. This will call migrator from the SQLite thread for each migration to perform.

Property Details

Gom.Repository.props.adapter
Name:

adapter

Type:

Gom.Adapter

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The adapter for the repository.