## GomRepository GomRepository |

## Functions

#define | GOM_REPOSITORY_CONST()
gboolean | (*GomRepositoryMigrator) ()
GomAdapter * | gom_repository_get_adapter ()
GomRepository * | gom_repository_new ()
gboolean | gom_repository_migrate_sync ()
void | gom_repository_migrate_async ()
gboolean | gom_repository_migrate_finish ()
gboolean | gom_repository_automatic_migrate_sync ()
void | gom_repository_automatic_migrate_async ()
gboolean | gom_repository_automatic_migrate_finish ()
GomResource * | gom_repository_find_one_sync ()
void | gom_repository_find_one_async ()
GomResource * | gom_repository_find_one_finish ()
GomResourceGroup * | gom_repository_find_sync ()
GomResourceGroup * | gom_repository_find_sorted_sync ()
void | gom_repository_find_async ()
void | gom_repository_find_sorted_async ()
GomResourceGroup * | gom_repository_find_finish ()

## Properties

GomAdapter * | adapter | Read / Write / Construct Only

## Object Hierarchy

        GObject
        ╰── GomRepository

## Description

## Functions

### GOM_REPOSITORY_CONST()

    #define GOM_REPOSITORY_CONST(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GOM_TYPE_REPOSITORY, GomRepository const))

### GomRepositoryMigrator ()

    gboolean
    (*GomRepositoryMigrator) (GomRepository *repository,
                              GomAdapter *adapter,
                              guint version,
                              gpointer user_data,
                              GError **error);

### gom_repository_get_adapter ()

    GomAdapter *
    gom_repository_get_adapter (GomRepository *repository);

Fetches the underlying adapter.

#### Parameters

repository | A GomRepository. | [in]

#### Returns

A GomAdapter.

[transfer none]

### gom_repository_new ()

    GomRepository *
    gom_repository_new (GomAdapter *adapter);

### gom_repository_migrate_sync ()

    gboolean
    gom_repository_migrate_sync (GomRepository *repository,
                                 guint version,
                                 GomRepositoryMigrator migrator,
                                 gpointer migrator_data,
                                 GError **error);

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

#### Parameters

repository | A GomRepository. | [in]
version | The version to migrate to. | [in]
migrator | A function to perform the migrations. | [in][scope call]
migrator_data | User data for `migrator` . | [in]
error | a GError |

#### Returns

TRUE in case of success.

### gom_repository_migrate_async ()

    void
    gom_repository_migrate_async (GomRepository *repository,
                                  guint version,
                                  GomRepositoryMigrator migrator,
                                  gpointer migrator_data,
                                  GAsyncReadyCallback callback,
                                  gpointer user_data);

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()`.

#### Parameters

repository | A GomRepository. | [in]
version | The version to migrate to. | [in]
migrator | A function to perform the migrations. | [in][scope async]
migrator_data | User data for `migrator` . | [in]
callback | A callback to execute upon completion. | [in]
user_data | User data for `callback` . | [in]

### gom_repository_migrate_finish ()

    gboolean
    gom_repository_migrate_finish (GomRepository *repository,
                                   GAsyncResult *result,
                                   GError **error);

### gom_repository_automatic_migrate_sync ()

    gboolean
    gom_repository_automatic_migrate_sync (GomRepository *repository,
                                           guint version,
                                           GList *object_types,
                                           GError **error);

Performs an automatic migration on the underlying database. For each of the 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.

#### Parameters

repository | A GomRepository. | [in]
version | The version to migrate to. | [in]
object_types | a GList of GType. | [element-type GType][transfer container]
error | a GError |

#### Returns

TRUE in case of success.

### gom_repository_automatic_migrate_async ()

    void
    gom_repository_automatic_migrate_async
                                   (GomRepository *repository,
                                    guint version,
                                    GList *object_types,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

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()`.

#### Parameters

repository | A GomRepository. | [in]
version | The version to migrate to. | [in]
object_types | a GList of GType. | [element-type GType][transfer container]
callback | A callback to execute upon completion. | [in]
user_data | User data for `callback` . | [in]

### gom_repository_automatic_migrate_finish ()

    gboolean
    gom_repository_automatic_migrate_finish
                                   (GomRepository *repository,
                                    GAsyncResult *result,
                                    GError **error);

### gom_repository_find_one_sync ()

    GomResource *
    gom_repository_find_one_sync (GomRepository *repository,
                                  GType resource_type,
                                  GomFilter *filter,
                                  GError **error);

Synchronous version of `gom_repository_find_async()`.

#### Parameters

repository | A GomRepository. | [in]
resource_type | A GType of the resource to lookup. | [in]
filter | A GomFilter to apply to your search. | [in][allow-none]
error | A location for a GError, or `NULL`. | [out]

#### Returns

A GomResource or `NULL`.

[transfer full]

### gom_repository_find_one_async ()

    void
    gom_repository_find_one_async (GomRepository *repository,
                                   GType resource_type,
                                   GomFilter *filter,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data);

### gom_repository_find_one_finish ()

    GomResource *
    gom_repository_find_one_finish (GomRepository *repository,
                                    GAsyncResult *result,
                                    GError **error);

Completes an asynchronous request to find a single resource in the repository. See `gom_repository_find_one_async()` for more info.

#### Parameters

repository | A GomRepository. | [in]
result | A GAsyncResult. | [in]
error | A location for a GError, or `NULL`. | [out]

#### Returns

A GomResource if successful, otherwise `NULL`.

[transfer full]

### gom_repository_find_sync ()

    GomResourceGroup *
    gom_repository_find_sync (GomRepository *repository,
                              GType resource_type,
                              GomFilter *filter,
                              GError **error);

Synchronously queries the GomRepository for objects matching the requested query. This must only be run from a callback provided to `gom_adapter_queue_read()`.

#### Parameters

repository | A GomRepository. | [in]
resource_type | The GType of the resources to query. | [in]
filter | An optional filter for the query. | [in][allow-none]
error | A location for a GError, or `NULL`. | [out]

#### Returns

A GomResourceGroup or `NULL`.

[transfer full]

### gom_repository_find_sorted_sync ()

    GomResourceGroup *
    gom_repository_find_sorted_sync (GomRepository *repository,
                                     GType resource_type,
                                     GomFilter *filter,
                                     GomSorting *sorting,
                                     GError **error);

Synchronously queries the GomRepository for objects matching the requested query. This must only be run from a callback provided to `gom_adapter_queue_read()`.

#### Parameters

repository | A GomRepository. | [in]
resource_type | The GType of the resources to query. | [in]
filter | An optional filter for the query. | [in][allow-none]
sorting | An optional GomSorting to order the query results. | [in][allow-none]
error | A location for a GError, or `NULL`. | [out]

#### Returns

A GomResourceGroup or `NULL`.

[transfer full]

### gom_repository_find_async ()

    void
    gom_repository_find_async (GomRepository *repository,
                               GType resource_type,
                               GomFilter *filter,
                               GAsyncReadyCallback callback,
                               gpointer user_data);

### gom_repository_find_sorted_async ()

    void
    gom_repository_find_sorted_async (GomRepository *repository,
                                      GType resource_type,
                                      GomFilter *filter,
                                      GomSorting *sorting,
                                      GAsyncReadyCallback callback,
                                      gpointer user_data);

### gom_repository_find_finish ()

    GomResourceGroup *
    gom_repository_find_finish (GomRepository *repository,
                                GAsyncResult *result,
                                GError **error);

Completes an asynchronous request to fetch a group of resources.

#### Parameters

repository | A GomRepository. | [in]
result | A GAsyncResult. | [in]
error | A location for a GError, or `NULL`. | [out]

#### Returns

A GomResourceGroup.

[transfer full]

## Types and Values

## Property Details

### The `“adapter”` property

      “adapter”                  GomAdapter *

The adapter for the repository.

Flags: Read / Write / Construct Only