# C gRPC driver

## [](#_connection_header)Connection

### [](#_methods_connection_driver)driver

#### [](#_Struct_DriverTlsConfig)Struct DriverTlsConfig

`rust struct (pointer)`

TLS configuration for the TypeDB driver.

`DriverTlsConfig` represents a fully constructed and validated TLS configuration. If TLS is enabled, the underlying TLS config is built eagerly at construction time, ensuring that no connection attempt can observe a partially-configured TLS state.

The driver defaults to using TLS with native system trust roots. This matches typical system and container deployments while still allowing explicit opt-out or custom PKI configuration.

#### [](#_driver_close)function `driver_close`

```c
void driver_close(struct TypeDBDriver* driver)
```

Closes the `TypeDBDriver`. Before instantiating a new driver, the driver that’s currently open should first be closed. Closing a driver frees the underlying Rust object.

Input parameters   

Name

Description

Type

`driver`

The `TypeDBDriver` object.

`struct TypeDBDriver*`

Returns

`void`

#### [](#_driver_force_close)function `driver_force_close`

```c
void driver_force_close(struct TypeDBDriver* driver)
```

Forcibly closes the `TypeDBDriver`. To be used in exceptional cases.

Input parameters   

Name

Description

Type

`driver`

The `TypeDBDriver` object.

`struct TypeDBDriver*`

Returns

`void`

#### [](#_driver_is_open)function `driver_is_open`

```c
bool driver_is_open(const struct TypeDBDriver* driver)
```

Checks whether this connection is presently open.

Input parameters   

Name

Description

Type

`driver`

The `TypeDBDriver` object.

`const struct TypeDBDriver*`

Returns

`bool`

#### [](#_driver_new)function `driver_new`

```c
struct TypeDBDriver* driver_new(const char* address, const struct Credentials* credentials, const struct DriverOptions* driver_options, const char* driver_lang)
```

Open a TypeDB Driver to a TypeDB server available at the provided address.

Input parameters   

Name

Description

Type

`address`

The address on which the TypeDB Server is running

`const char*`

`credentials`

The `Credentials` to connect with

`const struct Credentials*`

`driver_options`

The `DriverOptions` to connect with

`const struct DriverOptions*`

`driver_lang`

The language of the driver connecting to the server. Nullable: pass NULL to default to "c".

`const char*`

Returns

`struct TypeDBDriver*`

#### [](#_driver_new_with_address_translation)function `driver_new_with_address_translation`

```c
struct TypeDBDriver* driver_new_with_address_translation(const char*const* public_addresses, const char*const* private_addresses, const struct Credentials* credentials, const struct DriverOptions* driver_options, const char* driver_lang)
```

Open a TypeDB Driver to a TypeDB cluster, using the provided address translation.

Input parameters   

Name

Description

Type

`public_addresses`

A null-terminated array holding the replica addresses on for connection.

`const char*const*`

`private_addresses`

A null-terminated array holding the private replica addresses, configured on the server side. This array _must_ have the same length as `public_addresses`.

`const char*const*`

`credentials`

The `Credentials` to connect with

`const struct Credentials*`

`driver_options`

The `DriverOptions` to connect with

`const struct DriverOptions*`

`driver_lang`

The language of the driver connecting to the server. Nullable: pass NULL to default to "c".

`const char*`

Returns

`struct TypeDBDriver*`

#### [](#_driver_new_with_addresses)function `driver_new_with_addresses`

```c
struct TypeDBDriver* driver_new_with_addresses(const char*const* addresses, const struct Credentials* credentials, const struct DriverOptions* driver_options, const char* driver_lang)
```

Open a TypeDB Driver to a TypeDB cluster available at the provided addresses.

Input parameters   

Name

Description

Type

`addresses`

A null-terminated array holding the server addresses on for connection

`const char*const*`

`credentials`

The `Credentials` to connect with

`const struct Credentials*`

`driver_options`

The `DriverOptions` to connect with

`const struct DriverOptions*`

`driver_lang`

The language of the driver connecting to the server. Nullable: pass NULL to default to "c".

`const char*`

Returns

`struct TypeDBDriver*`

#### [](#_driver_primary_server)function `driver_primary_server`

```c
struct Server* driver_primary_server(const struct TypeDBDriver* driver, const struct ServerRouting* server_routing)
```

Retrieves the server’s primary server, if exists.

Input parameters   

Name

Description

Type

`driver`

The `TypeDBDriver` object.

`const struct TypeDBDriver*`

`server_routing`

The server routing directive to use for the operation. Auto if null.

`const struct ServerRouting*`

Returns

`struct Server*`

#### [](#_driver_server_version)function `driver_server_version`

```c
struct ServerVersion* driver_server_version(const struct TypeDBDriver* driver, const struct ServerRouting* server_routing)
```

Retrieves the server version and distribution information.

Input parameters   

Name

Description

Type

`driver`

The `TypeDBDriver` object.

`const struct TypeDBDriver*`

`server_routing`

The server routing directive to use for the operation. Auto if null.

`const struct ServerRouting*`

Returns

`struct ServerVersion*`

#### [](#_driver_servers)function `driver_servers`

```c
struct ServerIterator* driver_servers(const struct TypeDBDriver* driver, const struct ServerRouting* server_routing)
```

Retrieves the servers.

Input parameters   

Name

Description

Type

`driver`

The `TypeDBDriver` object.

`const struct TypeDBDriver*`

`server_routing`

The server routing directive to use for the operation. Auto if null.

`const struct ServerRouting*`

Returns

`struct ServerIterator*`

#### [](#_driver_tls_config_drop)function `driver_tls_config_drop`

```c
void driver_tls_config_drop(struct DriverTlsConfig* tls_config)
```

Frees the native rust `DriverTlsConfig` object.

Returns

`void`

#### [](#_driver_tls_config_get_root_ca_path)function `driver_tls_config_get_root_ca_path`

```c
char* driver_tls_config_get_root_ca_path(const struct DriverTlsConfig* tls_config)
```

Returns the TLS root CA set in this `DriverTlsConfig` object. Panics if a custom root CA is absent.

Returns

`char*`

#### [](#_driver_tls_config_has_root_ca_path)function `driver_tls_config_has_root_ca_path`

```c
bool driver_tls_config_has_root_ca_path(const struct DriverTlsConfig* tls_config)
```

Returns whether a custom root CA path is set.

Returns

`bool`

#### [](#_driver_tls_config_is_enabled)function `driver_tls_config_is_enabled`

```c
bool driver_tls_config_is_enabled(const struct DriverTlsConfig* tls_config)
```

Returns whether TLS is enabled.

Returns

`bool`

#### [](#_driver_tls_config_new_disabled)function `driver_tls_config_new_disabled`

```c
struct DriverTlsConfig* driver_tls_config_new_disabled(void)
```

Creates a new `DriverTlsConfig` with TLS disabled.

Returns

`struct DriverTlsConfig*`

#### [](#_driver_tls_config_new_enabled_with_native_root_ca)function `driver_tls_config_new_enabled_with_native_root_ca`

```c
struct DriverTlsConfig* driver_tls_config_new_enabled_with_native_root_ca(void)
```

Creates a new `DriverTlsConfig` with TLS enabled using system native trust roots.

Returns

`struct DriverTlsConfig*`

#### [](#_driver_tls_config_new_enabled_with_root_ca_path)function `driver_tls_config_new_enabled_with_root_ca_path`

```c
struct DriverTlsConfig* driver_tls_config_new_enabled_with_root_ca_path(const char* tls_root_ca)
```

Creates a new `DriverTlsConfig` with TLS enabled using a custom root CA certificate (PEM).

Returns

`struct DriverTlsConfig*`

#### [](#_init_logging)function `init_logging`

```c
void init_logging(void)
```

Enables logging in the TypeDB driver.

This function sets up tracing with two environment variables:

\`\`TYPEDB\_DRIVER\_LOG\`\`: Fine-grained control using the same syntax as \`\`RUST\_LOG\`\`. Example: \`\`TYPEDB\_DRIVER\_LOG=typedb\_driver=debug,typedb\_driver\_clib=trace\`\`
\`\`TYPEDB\_DRIVER\_LOG\_LEVEL\`\`: Simple log level that applies to both \`\`typedb\_driver\`\` and \`\`typedb\_driver\_clib\`\` crates. Overrides any settings from \`\`TYPEDB\_DRIVER\_LOG\`\`. Example: \`\`TYPEDB\_DRIVER\_LOG\_LEVEL=debug\`\`

If neither is set, the default level is INFO for driver crates.

The logging is initialized only once to prevent multiple initializations in applications that create multiple drivers.

Returns

`void`

### [](#_methods_connection_typedbdriver)typedbdriver

#### [](#_Struct_TypeDBDriver)Struct TypeDBDriver

`rust struct (pointer)`

A connection to a TypeDB server which serves as the starting point for all interaction.

### [](#_methods_connection_credential)credential

#### [](#_Struct_Credentials)Struct Credentials

`rust struct (pointer)`

User credentials for connecting to TypeDB

#### [](#_credentials_drop)function `credentials_drop`

```c
void credentials_drop(struct Credentials* credentials)
```

Frees the native rust `Credentials` object

Returns

`void`

#### [](#_credentials_new)function `credentials_new`

```c
struct Credentials* credentials_new(const char* username, const char* password)
```

Creates a new `Credentials` for connecting to TypeDB Server.

Input parameters   

Name

Description

Type

`username`

The name of the user to connect as

`const char*`

`password`

The password for the user

`const char*`

Returns

`struct Credentials*`

### [](#_methods_connection_driveroptions)driveroptions

#### [](#_Struct_DriverOptions)Struct DriverOptions

`rust struct (pointer)`

TypeDB driver connection options. `DriverOptions` object can be used to override the default driver behavior while connecting to TypeDB.

#### [](#_driver_options_drop)function `driver_options_drop`

```c
void driver_options_drop(struct DriverOptions* driver_options)
```

Frees the native rust `DriverOptions` object.

Returns

`void`

#### [](#_driver_options_get_primary_failover_retries)function `driver_options_get_primary_failover_retries`

```c
int64_t driver_options_get_primary_failover_retries(const struct DriverOptions* options)
```

Returns the value set for the primary failover retries limit in this `DriverOptions` object. Specifies the number of retries the driver performs to find and reach the cluster primary after a failed request, before giving up. Total attempts per user request = `N + 1`. Each retry either follows the server’s redirect address (fast path) or polls the known replicas with a 2-second sleep between polls (slow path). Set to 0 to disable failover. Defaults to 1.

Returns

`int64_t`

#### [](#_driver_options_get_request_timeout_millis)function `driver_options_get_request_timeout_millis`

```c
int64_t driver_options_get_request_timeout_millis(const struct DriverOptions* options)
```

Returns the request timeout in milliseconds set for this `DriverOptions` object. Specifies the maximum time to wait for a response to a unary RPC request. This applies to operations like database creation, user management, and initial transaction opening. It does NOT apply to operations within transactions (queries, commits).

Returns

`int64_t`

#### [](#_driver_options_get_tls_config)function `driver_options_get_tls_config`

```c
struct DriverTlsConfig* driver_options_get_tls_config(const struct DriverOptions* options)
```

Returns the TLS Config set for this `DriverOptions` object. Specifies the TLS configuration of the connection to TypeDB.

Returns

`struct DriverTlsConfig*`

#### [](#_driver_options_new)function `driver_options_new`

```c
struct DriverOptions* driver_options_new(const struct DriverTlsConfig* tls_config)
```

Creates a new `DriverOptions` for connecting to TypeDB Server using custom TLS settings. WARNING: Disabled TLS settings will make the driver sending passwords as plaintext.

Returns

`struct DriverOptions*`

#### [](#_driver_options_set_primary_failover_retries)function `driver_options_set_primary_failover_retries`

```c
void driver_options_set_primary_failover_retries(struct DriverOptions* options, int64_t primary_failover_retries)
```

Specifies the number of retries the driver performs to find and reach the cluster primary after a failed request, before giving up. Total attempts per user request = `N + 1`. Each retry either follows the server’s redirect address (fast path) or polls the known replicas with a 2-second sleep between polls (slow path). Set to 0 to disable failover. Defaults to 1.

Returns

`void`

#### [](#_driver_options_set_request_timeout_millis)function `driver_options_set_request_timeout_millis`

```c
void driver_options_set_request_timeout_millis(struct DriverOptions* options, int64_t timeout_millis)
```

Sets the maximum time (in milliseconds) to wait for a response to a unary RPC request. This applies to operations like database creation, user management, and initial transaction opening. It does NOT apply to operations within transactions (queries, commits). Set to 0 to disable the timeout (not recommended for production use). Defaults to 2 hours (7200000 milliseconds).

Returns

`void`

#### [](#_driver_options_set_tls_config)function `driver_options_set_tls_config`

```c
void driver_options_set_tls_config(struct DriverOptions* options, const struct DriverTlsConfig* tls_config)
```

Overrides the TLS configuration on `DriverOptions`. WARNING: Disabled TLS settings will make the driver sending passwords as plaintext.

Returns

`void`

### [](#_methods_connection_databases)databases

#### [](#_database_schema)function `database_schema`

```c
char* database_schema(const struct Database* database)
```

A full schema text as a valid TypeQL define query string.

Input parameters   

Name

Description

Type

`database`

The `Database` to get the schema from.

`const struct Database*`

Returns

`char*`

#### [](#_databases_all)function `databases_all`

```c
struct DatabaseIterator* databases_all(struct TypeDBDriver* driver)
```

Returns a `DatabaseIterator` over all databases present on the TypeDB server.

Input parameters   

Name

Description

Type

`driver`

The `TypeDBDriver` object.

`struct TypeDBDriver*`

Returns

`struct DatabaseIterator*`

#### [](#_databases_contains)function `databases_contains`

```c
bool databases_contains(struct TypeDBDriver* driver, const char* name)
```

Checks if a database with the given name exists.

Input parameters   

Name

Description

Type

`driver`

The `TypeDBDriver` object.

`struct TypeDBDriver*`

`name`

The name of the database.

`const char*`

Returns

`bool`

#### [](#_databases_create)function `databases_create`

```c
void databases_create(struct TypeDBDriver* driver, const char* name)
```

Creates a database with the given name.

Input parameters   

Name

Description

Type

`driver`

The `TypeDBDriver` object.

`struct TypeDBDriver*`

`name`

The name of the database to be created.

`const char*`

Returns

`void`

#### [](#_databases_get)function `databases_get`

```c
const struct Database* databases_get(struct TypeDBDriver* driver, const char* name)
```

Retrieves the database with the given name.

Input parameters   

Name

Description

Type

`driver`

The `TypeDBDriver` object.

`struct TypeDBDriver*`

`name`

The name of the database.

`const char*`

Returns

`const struct Database*`

#### [](#_databases_import_from_file)function `databases_import_from_file`

```c
void databases_import_from_file(struct TypeDBDriver* driver, const char* name, const char* schema, const char* data_file)
```

Creates a database with the given name based on previously exported another database’s data loaded from a file. This is a blocking operation and may take a significant amount of time depending on the database size.

Input parameters   

Name

Description

Type

`driver`

The `TypeDBDriver` object.

`struct TypeDBDriver*`

`name`

The name of the database to be created.

`const char*`

`schema`

The schema definition query string for the database.

`const char*`

`data_file`

The exported database file path to import the data from.

`const char*`

Returns

`void`

### [](#_methods_connection_database)database

#### [](#_Struct_Database)Struct Database

`rust struct (pointer)`

A TypeDB database.

#### [](#_database_close)function `database_close`

```c
void database_close(const struct Database* database)
```

Frees the native rust `Database` object.

Returns

`void`

#### [](#_database_delete)function `database_delete`

```c
void database_delete(const struct Database* database)
```

Deletes this database.

Input parameters   

Name

Description

Type

`database`

The `Database` to delete.

`const struct Database*`

Returns

`void`

#### [](#_database_export_to_file)function `database_export_to_file`

```c
void database_export_to_file(const struct Database* database, const char* schema_file, const char* data_file)
```

Export a database into a schema definition and a data files saved to the disk. This is a blocking operation and may take a significant amount of time depending on the database size.

Input parameters   

Name

Description

Type

`database`

The `Database` object to export from.

`const struct Database*`

`schema_file`

The path to the schema definition file to be created.

`const char*`

`data_file`

The path to the data file to be created.

`const char*`

Returns

`void`

#### [](#_database_get_name)function `database_get_name`

```c
char* database_get_name(const struct Database* database)
```

The `Database` name as a string.

Returns

`char*`

#### [](#_database_type_schema)function `database_type_schema`

```c
char* database_type_schema(const struct Database* database)
```

The types in the schema as a valid TypeQL define query string.

Input parameters   

Name

Description

Type

`database`

The `Database` to get the type schema from.

`const struct Database*`

Returns

`char*`

### [](#_methods_connection_databaseiterator)databaseiterator

#### [](#_Struct_DatabaseIterator)Struct DatabaseIterator

`rust struct (pointer)`

An `Iterator` over databases present on the TypeDB server.

#### [](#_database_iterator_drop)function `database_iterator_drop`

```c
void database_iterator_drop(struct DatabaseIterator* it)
```

Frees the native rust `DatabaseIterator` object.

Returns

`void`

#### [](#_database_iterator_next)function `database_iterator_next`

```c
const struct Database* database_iterator_next(struct DatabaseIterator* it)
```

Forwards the `DatabaseIterator` and returns the next `Database` if it exists, or null if there are no more elements.

Returns

`const struct Database*`

### [](#_methods_connection_users)users

#### [](#_users_all)function `users_all`

```c
struct UserIterator* users_all(const struct TypeDBDriver* driver)
```

Retrieves all users which exist on the TypeDB server.

Input parameters   

Name

Description

Type

`driver`

The `TypeDBDriver` object.

`const struct TypeDBDriver*`

Returns

`struct UserIterator*`

#### [](#_users_contains)function `users_contains`

```c
bool users_contains(const struct TypeDBDriver* driver, const char* username)
```

Checks if a user with the given name exists.

Input parameters   

Name

Description

Type

`driver`

The `TypeDBDriver` object.

`const struct TypeDBDriver*`

`username`

The username of the user.

`const char*`

Returns

`bool`

#### [](#_users_create)function `users_create`

```c
void users_create(const struct TypeDBDriver* driver, const char* username, const char* password)
```

Creates a user with the given name & password.

Input parameters   

Name

Description

Type

`username`

The username of the created user.

`const char*`

`password`

The password of the created user.

`const char*`

Returns

`void`

#### [](#_users_get)function `users_get`

```c
struct User* users_get(const struct TypeDBDriver* driver, const char* username)
```

Retrieves a user with the given name.

Input parameters   

Name

Description

Type

`driver`

The `TypeDBDriver` object.

`const struct TypeDBDriver*`

`username`

The username of the user.

`const char*`

Returns

`struct User*`

#### [](#_users_get_current)function `users_get_current`

```c
struct User* users_get_current(const struct TypeDBDriver* driver)
```

Retrieves the username of the user who opened this connection.

Input parameters   

Name

Description

Type

`driver`

The `TypeDBDriver` object.

`const struct TypeDBDriver*`

Returns

`struct User*`

### [](#_methods_connection_user)user

#### [](#_Struct_User)Struct User

`rust struct (pointer)`

A TypeDB server user, identified by a username.

#### [](#_user_delete)function `user_delete`

```c
void user_delete(struct User* user)
```

Deletes this user.

Input parameters   

Name

Description

Type

`user`

The `User` to delete.

`struct User*`

Returns

`void`

#### [](#_user_drop)function `user_drop`

```c
void user_drop(struct User* user)
```

Frees the native rust `User` object.

Returns

`void`

#### [](#_user_get_name)function `user_get_name`

```c
char* user_get_name(struct User* user)
```

Returns the name of this user.

Returns

`char*`

#### [](#_user_update_password)function `user_update_password`

```c
void user_update_password(struct User* user, const char* password)
```

Updates the password for the current authenticated user.

Input parameters   

Name

Description

Type

`user`

The user to update the password of - must be the current user.

`struct User*`

`password`

The new password.

`const char*`

Returns

`void`

### [](#_methods_connection_useriterator)useriterator

#### [](#_Struct_UserIterator)Struct UserIterator

`rust struct (pointer)`

Iterator over a set of `User`s.

#### [](#_user_iterator_drop)function `user_iterator_drop`

```c
void user_iterator_drop(struct UserIterator* it)
```

Frees the native rust `UserIterator` object.

Returns

`void`

#### [](#_user_iterator_next)function `user_iterator_next`

```c
struct User* user_iterator_next(struct UserIterator* it)
```

Forwards the `UserIterator` and returns the next `User` if it exists, or null if there are no more elements.

Returns

`struct User*`

## [](#_transaction_header)Transaction

### [](#_methods_transaction_transaction)transaction

#### [](#_Struct_Transaction)Struct Transaction

`rust struct (pointer)`

A transaction with a TypeDB database.

#### [](#_transaction_analyze)function `transaction_analyze`

```c
struct AnalyzedQueryPromise* transaction_analyze(struct Transaction* transaction, const char* query)
```

Analyzes a TypeQL query in the transaction.

Input parameters   

Name

Description

Type

`transaction`

The `Transaction` to analyze the query within.

`struct Transaction*`

`query`

The query string.

`const char*`

Returns

`struct AnalyzedQueryPromise*`

#### [](#_transaction_close)function `transaction_close`

```c
struct VoidPromise* transaction_close(struct Transaction* txn)
```

Forcibly closes this transaction. Returns a resolvable promise.

Returns

`struct VoidPromise*`

#### [](#_transaction_commit)function `transaction_commit`

```c
struct VoidPromise* transaction_commit(struct Transaction* txn)
```

Commits the changes made via this transaction to the TypeDB database. Whether or not the transaction is commited successfully, the transaction is closed after the commit call and the native rust object is freed.

Returns

`struct VoidPromise*`

#### [](#_transaction_drop_sync)function `transaction_drop_sync`

```c
void transaction_drop_sync(struct Transaction* txn)
```

Closes the transaction, waits for all callbacks to complete, then frees the memory.

Returns

`void`

#### [](#_transaction_is_open)function `transaction_is_open`

```c
bool transaction_is_open(const struct Transaction* txn)
```

Checks whether this transaction is open.

Returns

`bool`

#### [](#_transaction_new)function `transaction_new`

```c
struct Transaction* transaction_new(struct TypeDBDriver* driver, const char* database_name, enum TransactionType type_, const struct TransactionOptions* options)
```

Opens a transaction to perform read or write queries on the database connected to the session.

Input parameters   

Name

Description

Type

`databases`

The `DatabaseManager` object on this connection.

`database_name`

The name of the database with which the transaction connects.

`const char*`

`type_`

The type of transaction to be created (Write / Read / Schema).

`enum TransactionType`

`options`

`TransactionOptions` to configure the opened transaction.

`const struct TransactionOptions*`

Returns

`struct Transaction*`

#### [](#_transaction_on_close)function `transaction_on_close`

```c
struct VoidPromise* transaction_on_close(const struct Transaction* txn, uintptr_t callback_id, void(*)(uintptr_t, struct Error*) callback)
```

Registers a callback function which will be executed when this transaction is closed.

Input parameters   

Name

Description

Type

`txn`

The transaction on which to register the callback

`const struct Transaction*`

`callback_id`

The argument to be passed to the callback function when it is executed.

`uintptr_t`

`callback`

The function to be called

Returns

`struct VoidPromise*`

#### [](#_transaction_query)function `transaction_query`

```c
struct QueryAnswerPromise* transaction_query(struct Transaction* transaction, const char* query, const struct QueryOptions* options)
```

Performs a TypeQL query in the transaction.

Input parameters   

Name

Description

Type

`transaction`

The `Transaction` to execute the query within.

`struct Transaction*`

`query`

The query string.

`const char*`

`options`

`QueryOptions` to configure the executed query.

`const struct QueryOptions*`

Returns

`struct QueryAnswerPromise*`

#### [](#_transaction_query_given_rows)function `transaction_query_given_rows`

```c
struct QueryAnswerPromise* transaction_query_given_rows(struct Transaction* transaction, const char* query, const struct QueryOptions* options, struct GivenRows* given_rows)
```

Performs a TypeQL query in the transaction with the given rows

Input parameters   

Name

Description

Type

`transaction`

The `Transaction` to execute the query within.

`struct Transaction*`

`query`

The query string.

`const char*`

`options`

`QueryOptions` to configure the executed query.

`const struct QueryOptions*`

`given_rows`

`QueryGivenRows` the rows given as input to the query.

`struct GivenRows*`

Returns

`struct QueryAnswerPromise*`

#### [](#_transaction_rollback)function `transaction_rollback`

```c
struct VoidPromise* transaction_rollback(const struct Transaction* txn)
```

Rolls back the uncommitted changes made via this transaction.

Returns

`struct VoidPromise*`

### [](#_methods_transaction_transactiontype)transactiontype

#### [](#_Struct_TransactionType)Struct TransactionType

`rust struct (pointer)`

This enum is used to specify the type of transaction.

#### [](#_Enum_TransactionType)Enum TransactionType

`rust enum (pointer)`

This enum is used to specify the type of transaction.

Read-only transaction.

Write&nbsp;

Data-modifying transaction.

Schema&nbsp;

Schema-modifying transaction.

Enum constants 

Name

`Read = 0`

`Schema = 2`

`Write = 1`

### [](#_methods_transaction_transactionoptions)transactionoptions

#### [](#_Struct_TransactionOptions)Struct TransactionOptions

`rust struct (pointer)`

TypeDB transaction options. `TransactionOptions` object can be used to override the default behaviour for opened transactions.

#### [](#_transaction_options_drop)function `transaction_options_drop`

```c
void transaction_options_drop(struct TransactionOptions* options)
```

Frees the native Rust `TransactionOptions` object.

Returns

`void`

#### [](#_transaction_options_get_schema_lock_acquire_timeout_millis)function `transaction_options_get_schema_lock_acquire_timeout_millis`

```c
int64_t transaction_options_get_schema_lock_acquire_timeout_millis(const struct TransactionOptions* options)
```

Returns the value set for the schema lock acquire timeout in this `TransactionOptions` object. If set, specifies how long the driver should wait if opening a transaction is blocked by an exclusive schema write lock.

Returns

`int64_t`

#### [](#_transaction_options_get_transaction_timeout_millis)function `transaction_options_get_transaction_timeout_millis`

```c
int64_t transaction_options_get_transaction_timeout_millis(const struct TransactionOptions* options)
```

Returns the value set for the transaction timeout in this `TransactionOptions` object. If set, specifies a timeout for killing transactions automatically, preventing memory leaks in unclosed transactions.

Returns

`int64_t`

#### [](#_transaction_options_has_schema_lock_acquire_timeout_millis)function `transaction_options_has_schema_lock_acquire_timeout_millis`

```c
bool transaction_options_has_schema_lock_acquire_timeout_millis(const struct TransactionOptions* options)
```

Checks whether the option for schema lock acquire timeout was explicitly set for this `TransactionOptions` object.

Returns

`bool`

#### [](#_transaction_options_has_transaction_timeout_millis)function `transaction_options_has_transaction_timeout_millis`

```c
bool transaction_options_has_transaction_timeout_millis(const struct TransactionOptions* options)
```

Checks whether the option for transaction timeout was explicitly set for this `TransactionOptions` object.

Returns

`bool`

#### [](#_transaction_options_new)function `transaction_options_new`

```c
struct TransactionOptions* transaction_options_new(void)
```

Produces a new `TransactionOptions` object.

Returns

`struct TransactionOptions*`

#### [](#_transaction_options_set_schema_lock_acquire_timeout_millis)function `transaction_options_set_schema_lock_acquire_timeout_millis`

```c
void transaction_options_set_schema_lock_acquire_timeout_millis(struct TransactionOptions* options, int64_t timeout_millis)
```

Explicitly sets schema lock acquire timeout. If set, specifies how long the driver should wait if opening a transaction is blocked by an exclusive schema write lock.

Returns

`void`

#### [](#_transaction_options_set_transaction_timeout_millis)function `transaction_options_set_transaction_timeout_millis`

```c
void transaction_options_set_transaction_timeout_millis(struct TransactionOptions* options, int64_t timeout_millis)
```

Explicitly sets a transaction timeout. If set, specifies a timeout for killing transactions automatically, preventing memory leaks in unclosed transactions.

Returns

`void`

### [](#_methods_transaction_queryoptions)queryoptions

#### [](#_Struct_QueryOptions)Struct QueryOptions

`rust struct (pointer)`

TypeDB query options. `QueryOptions` object can be used to override the default server behaviour for executed queries.

#### [](#_query_options_drop)function `query_options_drop`

```c
void query_options_drop(struct QueryOptions* options)
```

Frees the native Rust `QueryOptions` object.

Returns

`void`

#### [](#_query_options_get_include_instance_types)function `query_options_get_include_instance_types`

```c
bool query_options_get_include_instance_types(const struct QueryOptions* options)
```

Returns the value set for the "include instance types" flag in this `QueryOptions` object. If set, specifies if types should be included in instance structs returned in ConceptRow answers. This option allows reducing the amount of unnecessary data transmitted.

Returns

`bool`

#### [](#_query_options_get_include_query_structure)function `query_options_get_include_query_structure`

```c
bool query_options_get_include_query_structure(const struct QueryOptions* options)
```

Returns the value set for 'include query structure' in this `QueryOptions` object.

Returns

`bool`

#### [](#_query_options_get_prefetch_size)function `query_options_get_prefetch_size`

```c
int64_t query_options_get_prefetch_size(const struct QueryOptions* options)
```

Returns the value set for the prefetch size in this `QueryOptions` object. If set, specifies the number of extra query responses sent before the client side has to re-request more responses. Increasing this may increase performance for queries with a huge number of answers, as it can reduce the number of network round-trips at the cost of more resources on the server side. Minimal value: 1.

Returns

`int64_t`

#### [](#_query_options_has_include_instance_types)function `query_options_has_include_instance_types`

```c
bool query_options_has_include_instance_types(const struct QueryOptions* options)
```

Checks whether the "include instance types" flag was explicitly set for this `QueryOptions` object.

Returns

`bool`

#### [](#_query_options_has_include_query_structure)function `query_options_has_include_query_structure`

```c
bool query_options_has_include_query_structure(const struct QueryOptions* options)
```

Checks whether the prefetch size was explicitly set for this `QueryOptions` object.

Returns

`bool`

#### [](#_query_options_has_prefetch_size)function `query_options_has_prefetch_size`

```c
bool query_options_has_prefetch_size(const struct QueryOptions* options)
```

Checks whether the prefetch size was explicitly set for this `QueryOptions` object.

Returns

`bool`

#### [](#_query_options_new)function `query_options_new`

```c
struct QueryOptions* query_options_new(void)
```

Produces a new `QueryOptions` object.

Returns

`struct QueryOptions*`

#### [](#_query_options_set_include_instance_types)function `query_options_set_include_instance_types`

```c
void query_options_set_include_instance_types(struct QueryOptions* options, bool include_instance_types)
```

Explicitly sets the "include instance types" flag. If set, specifies if types should be included in instance structs returned in ConceptRow answers. This option allows reducing the amount of unnecessary data transmitted.

Returns

`void`

#### [](#_query_options_set_include_query_structure)function `query_options_set_include_query_structure`

```c
void query_options_set_include_query_structure(struct QueryOptions* options, bool include_query_structure)
```

Explicitly set the prefetch size. If set, it requests the server to include the query structure in the answer header.

Returns

`void`

#### [](#_query_options_set_prefetch_size)function `query_options_set_prefetch_size`

```c
void query_options_set_prefetch_size(struct QueryOptions* options, int64_t prefetch_size)
```

Explicitly sets the prefetch size. If set, specifies the number of extra query responses sent before the client side has to re-request more responses. Increasing this may increase performance for queries with a huge number of answers, as it can reduce the number of network round-trips at the cost of more resources on the server side. Minimal value: 1.

Returns

`void`

## [](#_answer_header)Answer

### [](#_methods_answer_queryanswer)queryanswer

#### [](#_query_answer_drop)function `query_answer_drop`

```c
void query_answer_drop(struct QueryAnswer* query_answer)
```

Frees the native rust `QueryAnswer` object.

Returns

`void`

#### [](#_query_answer_get_query_type)function `query_answer_get_query_type`

```c
enum QueryType query_answer_get_query_type(const struct QueryAnswer* query_answer)
```

Retrieves the executed query’s type of the `QueryAnswer`.

Returns

`enum QueryType`

#### [](#_query_answer_into_documents)function `query_answer_into_documents`

```c
struct StringIterator* query_answer_into_documents(struct QueryAnswer* query_answer)
```

Produces an `Iterator` over all JSON `ConceptDocument`s in this `QueryAnswer`.

Returns

`struct StringIterator*`

#### [](#_query_answer_into_rows)function `query_answer_into_rows`

```c
struct ConceptRowIterator* query_answer_into_rows(struct QueryAnswer* query_answer)
```

Produces an `Iterator` over all `ConceptRow`s in this `QueryAnswer`.

Returns

`struct ConceptRowIterator*`

#### [](#_query_answer_is_concept_document_stream)function `query_answer_is_concept_document_stream`

```c
bool query_answer_is_concept_document_stream(const struct QueryAnswer* query_answer)
```

Checks if the query answer is a `ConceptDocumentStream`.

Returns

`bool`

#### [](#_query_answer_is_concept_row_stream)function `query_answer_is_concept_row_stream`

```c
bool query_answer_is_concept_row_stream(const struct QueryAnswer* query_answer)
```

Checks if the query answer is a `ConceptRowStream`.

Returns

`bool`

#### [](#_query_answer_is_ok)function `query_answer_is_ok`

```c
bool query_answer_is_ok(const struct QueryAnswer* query_answer)
```

Checks if the query answer is an `Ok`.

Returns

`bool`

### [](#_methods_answer_queryanswerpromise)queryanswerpromise

#### [](#_Struct_QueryAnswerPromise)Struct QueryAnswerPromise

`rust struct (pointer)`

Promise object representing the result of an asynchronous operation. Use query\_answer\_promise\_resolve(QueryAnswerPromise\*) to wait for and retrieve the resulting boolean value.

#### [](#_query_answer_promise_drop)function `query_answer_promise_drop`

```c
void query_answer_promise_drop(struct QueryAnswerPromise* promise)
```

Frees the native rust `QueryAnswerPromise` object.

Returns

`void`

#### [](#_query_answer_promise_resolve)function `query_answer_promise_resolve`

```c
struct QueryAnswer* query_answer_promise_resolve(struct QueryAnswerPromise* promise)
```

Waits for and returns the result of the operation represented by the `QueryAnswer` object. In case the operation failed, the error flag will only be set when the promise is resolved. The native promise object is freed when it is resolved.

Returns

`struct QueryAnswer*`

### [](#_methods_answer_querytype)querytype

#### [](#_Struct_QueryType)Struct QueryType

`rust struct (pointer)`

This enum is used to specify the type of the query resulted in this answer.

#### [](#_Enum_QueryType)Enum QueryType

`rust enum (pointer)`

This enum is used to specify the type of the query resulted in this answer.

A read-only query (e.g. `match`).

WriteQuery&nbsp;

A data-modifying query (e.g. `insert`, `delete`, `update`).

SchemaQuery&nbsp;

A schema-modifying query (e.g. `define`, `undefine`, `redefine`).

Enum constants 

Name

`ReadQuery`

`SchemaQuery`

`WriteQuery`

Unresolved include directive in modules/ROOT/partials/c/api-reference.adoc - include::3.x@external-typedb-driver::partial$c/answer/conceptrow.adoc\[\]

### [](#_methods_answer_conceptrowiterator)conceptrowiterator

#### [](#_Struct_ConceptRowIterator)Struct ConceptRowIterator

`rust struct (pointer)`

Iterator over the `ConceptRow`s returned by an API method or query.

#### [](#_concept_row_iterator_drop)function `concept_row_iterator_drop`

```c
void concept_row_iterator_drop(struct ConceptRowIterator* it)
```

Frees the native rust `ConceptRowIterator` object

Returns

`void`

#### [](#_concept_row_iterator_next)function `concept_row_iterator_next`

```c
struct ConceptRow* concept_row_iterator_next(struct ConceptRowIterator* it)
```

Forwards the `ConceptRowIterator` and returns the next `ConceptRow` if it exists, or null if there are no more elements.

Returns

`struct ConceptRow*`

### [](#_methods_answer_voidpromise)voidpromise

#### [](#_Struct_VoidPromise)Struct VoidPromise

`rust struct (pointer)`

Promise object representing the result of an asynchronous operation. A VoidPromise does not return a value, but must be resolved using void\_promise\_resolve(VoidPromise\*) to ensure the operation has completed, or for a failed operation to set the error.

#### [](#_void_promise_drop)function `void_promise_drop`

```c
void void_promise_drop(struct VoidPromise* promise)
```

Frees the native rust `VoidPromise` object.

Returns

`void`

#### [](#_void_promise_resolve)function `void_promise_resolve`

```c
void void_promise_resolve(struct VoidPromise* promise)
```

Waits for the operation represented by the `VoidPromise` to complete. In case the operation failed, the error flag will only be set when the promise is resolved. The native promise object is freed when it is resolved.

Returns

`void`

### [](#_methods_answer_boolpromise)boolpromise

#### [](#_Struct_BoolPromise)Struct BoolPromise

`rust struct (pointer)`

Promise object representing the result of an asynchronous operation. Use bool\_promise\_resolve(BoolPromise\*) to wait for and retrieve the resulting boolean value.

#### [](#_bool_promise_drop)function `bool_promise_drop`

```c
void bool_promise_drop(struct BoolPromise* promise)
```

Frees the native rust `BoolPromise` object.

Returns

`void`

#### [](#_bool_promise_resolve)function `bool_promise_resolve`

```c
bool bool_promise_resolve(struct BoolPromise* promise)
```

Waits for and returns the result of the operation represented by the `BoolPromise` object. In case the operation failed, the error flag will only be set when the promise is resolved. The native promise object is freed when it is resolved.

Returns

`bool`

### [](#_methods_answer_stringpromise)stringpromise

#### [](#_Struct_StringPromise)Struct StringPromise

`rust struct (pointer)`

Promise object representing the result of an asynchronous operation. Use string\_promise\_resolve(StringPromise\*) to wait for and retrieve the resulting string.

#### [](#_string_promise_drop)function `string_promise_drop`

```c
void string_promise_drop(struct StringPromise* promise)
```

Frees the native rust `StringPromise` object.

Returns

`void`

#### [](#_string_promise_resolve)function `string_promise_resolve`

```c
char* string_promise_resolve(struct StringPromise* promise)
```

Waits for and returns the result of the operation represented by the `BoolPromise` object. In case the operation failed, the error flag will only be set when the promise is resolved. The native promise object is freed when it is resolved.

Returns

`char*`

Unresolved include directive in modules/ROOT/partials/c/api-reference.adoc - include::3.x@external-typedb-driver::partial$c/answer/conceptpromise.adoc\[\]

### [](#_methods_answer_string)string

#### [](#_string_free)function `string_free`

```c
void string_free(char* str)
```

Frees a native rust string. _WARNING: Always use this function to free strings returned by the driver. Using the standard C free function will create a dangling reference on the rust side._

Returns

`void`

### [](#_methods_answer_stringiterator)stringiterator

#### [](#_Struct_StringIterator)Struct StringIterator

`rust struct (pointer)`

Iterator over the strings in the result of a request or a TypeQL Fetch query.

#### [](#_string_iterator_drop)function `string_iterator_drop`

```c
void string_iterator_drop(struct StringIterator* it)
```

Frees the native rust `StringIterator` object

Returns

`void`

#### [](#_string_iterator_next)function `string_iterator_next`

```c
char* string_iterator_next(struct StringIterator* it)
```

Forwards the `StringIterator` and returns the next string if it exists, or null if there are no more elements.

Returns

`char*`

## [](#_concept_header)Concept

### [](#_methods_concept_concept)concept

#### [](#_Struct_Concept)Struct Concept

`rust struct (pointer)`

The fundamental TypeQL object.

#### [](#_Struct_ConceptRow)Struct ConceptRow

`rust struct (pointer)`

A single row of concepts representing substitutions for variables in the query. Contains a Header (column names and query type), and the row of optional concepts. An empty concept in a column means the variable does not have a substitution in this answer.

#### [](#_concept_drop)function `concept_drop`

```c
void concept_drop(struct Concept* concept)
```

Frees the native rust `Concept` object

Returns

`void`

#### [](#_concept_equals)function `concept_equals`

```c
bool concept_equals(const struct Concept* lhs, const struct Concept* rhs)
```

Checks whether the provided `Concept` objects are equal

Returns

`bool`

#### [](#_concept_get_boolean)function `concept_get_boolean`

```c
bool concept_get_boolean(const struct Concept* concept)
```

Returns a `boolean` value of this value concept. If the value has another type, the error is set.

Returns

`bool`

#### [](#_concept_get_date_as_seconds)function `concept_get_date_as_seconds`

```c
int64_t concept_get_date_as_seconds(const struct Concept* concept)
```

Returns the value of this date value concept as seconds since the start of the UNIX epoch. If the value has another type, the error is set.

Returns

`int64_t`

#### [](#_concept_get_datetime)function `concept_get_datetime`

```c
struct DatetimeInNanos concept_get_datetime(const struct Concept* concept)
```

Returns the value of this datetime value concept as seconds and nanoseconds parts since the start of the UNIX epoch. If the value has another type, the error is set.

Returns

`struct DatetimeInNanos`

#### [](#_concept_get_datetime_tz)function `concept_get_datetime_tz`

```c
struct DatetimeAndTimeZone* concept_get_datetime_tz(const struct Concept* concept)
```

Returns the value of this datetime-tz value concept as seconds and nanoseconds parts since the start of the UNIX epoch and timezone information. If the value has another type, the error is set.

Returns

`struct DatetimeAndTimeZone*`

#### [](#_concept_get_decimal)function `concept_get_decimal`

```c
struct Decimal concept_get_decimal(const struct Concept* concept)
```

Returns the `decimal` value of this value concept. If the value has another type, the error is set.

Returns

`struct Decimal`

#### [](#_concept_get_double)function `concept_get_double`

```c
double concept_get_double(const struct Concept* concept)
```

Returns the `double` value of this value concept. If the value has another type, the error is set.

Returns

`double`

#### [](#_concept_get_duration)function `concept_get_duration`

```c
struct Duration concept_get_duration(const struct Concept* concept)
```

Returns the value of this duration value. If the value has another type, the error is set.

Returns

`struct Duration`

#### [](#_concept_get_integer)function `concept_get_integer`

```c
int64_t concept_get_integer(const struct Concept* concept)
```

Returns the `integer` value of this value concept. If the value has another type, the error is set.

Returns

`int64_t`

#### [](#_concept_get_label)function `concept_get_label`

```c
char* concept_get_label(const struct Concept* concept)
```

Retrieves the label of this `Concept`. If this is an `Instance`, returns the label of the type of this instance ("unknown" if type fetching is disabled). If this is a `Value`, returns the label of the value type of the value. If this is a `Type`, returns the label of the type.

Returns

`char*`

#### [](#_concept_get_string)function `concept_get_string`

```c
char* concept_get_string(const struct Concept* concept)
```

Returns the `string` value of this value concept. If the value has another type, the error is set.

Returns

`char*`

#### [](#_concept_get_struct)function `concept_get_struct`

```c
struct StringAndOptValueIterator* concept_get_struct(const struct Concept* concept)
```

Returns the value of this struct value concept represented as an iterator of {field\_name: value?} pairs. If the value has another type, the error is set.

Returns

`struct StringAndOptValueIterator*`

#### [](#_concept_is_attribute)function `concept_is_attribute`

```c
bool concept_is_attribute(const struct Concept* concept)
```

Checks if this `Concept` is an `Attribute`.

Returns

`bool`

#### [](#_concept_is_attribute_type)function `concept_is_attribute_type`

```c
bool concept_is_attribute_type(const struct Concept* concept)
```

Checks if this `Concept` is an `AttributeType`.

Returns

`bool`

#### [](#_concept_is_boolean)function `concept_is_boolean`

```c
bool concept_is_boolean(const struct Concept* concept)
```

Returns `true` if the value which this `Concept` holds is of type `boolean`. Otherwise, returns `false`.

Returns

`bool`

#### [](#_concept_is_date)function `concept_is_date`

```c
bool concept_is_date(const struct Concept* concept)
```

Returns `true` if the value which this `Concept` holds is of type `date`. Otherwise, returns `false`.

Returns

`bool`

#### [](#_concept_is_datetime)function `concept_is_datetime`

```c
bool concept_is_datetime(const struct Concept* concept)
```

Returns `true` if the value which this `Concept` holds is of type `datetime`. Otherwise, returns `false`.

Returns

`bool`

#### [](#_concept_is_datetime_tz)function `concept_is_datetime_tz`

```c
bool concept_is_datetime_tz(const struct Concept* concept)
```

Returns `true` if the value which this `Concept` holds is of type `datetime-tz`. Otherwise, returns `false`.

Returns

`bool`

#### [](#_concept_is_decimal)function `concept_is_decimal`

```c
bool concept_is_decimal(const struct Concept* concept)
```

Returns `true` if the value which this `Concept` holds is of type `decimal`. Otherwise, returns `false`.

Returns

`bool`

#### [](#_concept_is_double)function `concept_is_double`

```c
bool concept_is_double(const struct Concept* concept)
```

Returns `true` if the value which this `Concept` holds is of type `double`. Otherwise, returns `false`.

Returns

`bool`

#### [](#_concept_is_duration)function `concept_is_duration`

```c
bool concept_is_duration(const struct Concept* concept)
```

Returns `true` if the value which this `Concept` holds is of type `duration`. Otherwise, returns `false`.

Returns

`bool`

#### [](#_concept_is_entity)function `concept_is_entity`

```c
bool concept_is_entity(const struct Concept* concept)
```

Checks if this `Concept` is an `Entity`.

Returns

`bool`

#### [](#_concept_is_entity_type)function `concept_is_entity_type`

```c
bool concept_is_entity_type(const struct Concept* concept)
```

Checks if this `Concept` is an `EntityType`.

Returns

`bool`

#### [](#_concept_is_integer)function `concept_is_integer`

```c
bool concept_is_integer(const struct Concept* concept)
```

Returns `true` if the value which this `Concept` holds is of type `integer`. Otherwise, returns `false`.

Returns

`bool`

#### [](#_concept_is_relation)function `concept_is_relation`

```c
bool concept_is_relation(const struct Concept* concept)
```

Checks if this `Concept` is a `Relation`.

Returns

`bool`

#### [](#_concept_is_relation_type)function `concept_is_relation_type`

```c
bool concept_is_relation_type(const struct Concept* concept)
```

Checks if this `Concept` is a `RelationType`.

Returns

`bool`

#### [](#_concept_is_role_type)function `concept_is_role_type`

```c
bool concept_is_role_type(const struct Concept* concept)
```

Checks if this `Concept` is a `RoleType`.

Returns

`bool`

#### [](#_concept_is_string)function `concept_is_string`

```c
bool concept_is_string(const struct Concept* concept)
```

Returns `true` if the value which this `Concept` holds is of type `string`. Otherwise, returns `false`.

Returns

`bool`

#### [](#_concept_is_struct)function `concept_is_struct`

```c
bool concept_is_struct(const struct Concept* concept)
```

Returns `true` if the value which this `Concept` holds is of type `struct`. Otherwise, returns `false`.

Returns

`bool`

#### [](#_concept_is_value)function `concept_is_value`

```c
bool concept_is_value(const struct Concept* concept)
```

Checks if this `Concept` is a `Value`.

Returns

`bool`

#### [](#_concept_new_boolean)function `concept_new_boolean`

```c
struct Concept* concept_new_boolean(bool value)
```

Creates a new `Concept` object wrapping the specified `bool` value

Returns

`struct Concept*`

#### [](#_concept_new_date_from_seconds)function `concept_new_date_from_seconds`

```c
struct Concept* concept_new_date_from_seconds(int64_t seconds_since_epoch)
```

Creates a new `Concept` object wrapping a specified `NaiveDate` value. The value must be seconds since the start of the UNIX epoch.

Returns

`struct Concept*`

#### [](#_concept_new_datetime)function `concept_new_datetime`

```c
struct Concept* concept_new_datetime(int64_t seconds, uint32_t subsec_nanos)
```

Creates a new `Concept` object wrapping the specified naive datetime value, provided as seconds and nanoseconds since the Unix epoch.

Returns

`struct Concept*`

#### [](#_concept_new_datetime_tz_iana)function `concept_new_datetime_tz_iana`

```c
struct Concept* concept_new_datetime_tz_iana(int64_t seconds, uint32_t subsec_nanos, const char* zone_name)
```

Creates a new `Concept` object wrapping the specified timezone-aware datetime value with an IANA timezone name, provided as seconds and nanoseconds since the Unix epoch.

Returns

`struct Concept*`

#### [](#_concept_new_datetime_tz_offset)function `concept_new_datetime_tz_offset`

```c
struct Concept* concept_new_datetime_tz_offset(int64_t seconds, uint32_t subsec_nanos, int32_t offset_seconds)
```

Creates a new `Concept` object wrapping the specified timezone-aware datetime value with a fixed UTC offset in seconds, provided as seconds and nanoseconds since the Unix epoch.

Returns

`struct Concept*`

#### [](#_concept_new_decimal)function `concept_new_decimal`

```c
struct Concept* concept_new_decimal(int64_t integer, uint64_t fractional)
```

Creates a new `Concept` object wrapping the specified `Decimal` value, provided as its integer and fractional parts. The fractional part is in units of 10^-19.

Returns

`struct Concept*`

#### [](#_concept_new_decimal_from_string)function `concept_new_decimal_from_string`

```c
struct Concept* concept_new_decimal_from_string(const char* str)
```

Creates a new `Concept` object wrapping the specified `Decimal` value, provided as a string (without the dec suffix).

Returns

`struct Concept*`

#### [](#_concept_new_double)function `concept_new_double`

```c
struct Concept* concept_new_double(double value)
```

Creates a new `Concept` object wrapping the specified `f64` value

Returns

`struct Concept*`

#### [](#_concept_new_duration)function `concept_new_duration`

```c
struct Concept* concept_new_duration(uint32_t months, uint32_t days, uint64_t nanos)
```

Creates a new `Concept` object wrapping the specified `Duration` value, provided as its months, days, and nanoseconds components.

Returns

`struct Concept*`

#### [](#_concept_new_integer)function `concept_new_integer`

```c
struct Concept* concept_new_integer(int64_t value)
```

Creates a new `Concept` object wrapping the specified `i64` value

Returns

`struct Concept*`

#### [](#_concept_new_string)function `concept_new_string`

```c
struct Concept* concept_new_string(const char* value)
```

Creates a new `Concept` object wrapping the specified `String` value

Returns

`struct Concept*`

#### [](#_concept_row_drop)function `concept_row_drop`

```c
void concept_row_drop(struct ConceptRow* concept_row)
```

Frees the native rust `ConceptRow` object.

Returns

`void`

#### [](#_concept_row_equals)function `concept_row_equals`

```c
bool concept_row_equals(const struct ConceptRow* lhs, const struct ConceptRow* rhs)
```

Checks whether the provided `ConceptRow` objects are equal

Returns

`bool`

#### [](#_concept_row_get)function `concept_row_get`

```c
struct Concept* concept_row_get(const struct ConceptRow* concept_row, const char* column_name)
```

Retrieves a concept for a given column name.

Returns

`struct Concept*`

#### [](#_concept_row_get_column_names)function `concept_row_get_column_names`

```c
struct StringIterator* concept_row_get_column_names(const struct ConceptRow* concept_row)
```

Produces an `Iterator` over all `String` column names of the `ConceptRow`'s header.

Returns

`struct StringIterator*`

#### [](#_concept_row_get_concepts)function `concept_row_get_concepts`

```c
struct ConceptIterator* concept_row_get_concepts(const struct ConceptRow* concept_row)
```

Produces an `Iterator` over all `Concepts` in this `ConceptRow`.

Returns

`struct ConceptIterator*`

#### [](#_concept_row_get_index)function `concept_row_get_index`

```c
struct Concept* concept_row_get_index(const struct ConceptRow* concept_row, uintptr_t column_index)
```

Retrieves a concept for a given column index.

Returns

`struct Concept*`

#### [](#_concept_row_get_query_structure)function `concept_row_get_query_structure`

```c
struct Pipeline* concept_row_get_query_structure(const struct ConceptRow* concept_row)
```

Retrieves the executed query’s structure from the `ConceptRow`'s header, if set. It must be requested via "include query structure" in `QueryOptions`

Returns

`struct Pipeline*`

#### [](#_concept_row_get_query_type)function `concept_row_get_query_type`

```c
enum QueryType concept_row_get_query_type(const struct ConceptRow* concept_row)
```

Retrieves the executed query’s type of the `ConceptRow`'s header.

Returns

`enum QueryType`

#### [](#_concept_row_involved_conjunctions)function `concept_row_involved_conjunctions`

```c
struct ConjunctionIDIterator* concept_row_involved_conjunctions(const struct ConceptRow* concept_row)
```

Retrieve the `ConjunctionID`s of `Conjunction`s that answered this row. May be null.

Returns

`struct ConjunctionIDIterator*`

#### [](#_concept_row_to_string)function `concept_row_to_string`

```c
char* concept_row_to_string(const struct ConceptRow* concept_row)
```

A string representation of this ConceptRow.

Returns

`char*`

#### [](#_concept_to_string)function `concept_to_string`

```c
char* concept_to_string(const struct Concept* concept)
```

A string representation of this `Concept` object.

Returns

`char*`

#### [](#_concept_try_get_iid)function `concept_try_get_iid`

```c
char* concept_try_get_iid(struct Concept* instance)
```

Retrieves the unique id (IID) of this `Concept`. If this is an Entity or Relation Instance, returns the IID of the instance. Otherwise, returns null.

Returns

`char*`

#### [](#_concept_try_get_label)function `concept_try_get_label`

```c
char* concept_try_get_label(const struct Concept* concept)
```

Retrieves the optional label of this `Concept`. If this is an `Instance`, returns the label of the type of this instance (None if type fetching is disabled). If this is a `Value`, returns the label of the value type of the value. If this is a `Type`, returns the label of the type.

Returns

`char*`

#### [](#_concept_try_get_value)function `concept_try_get_value`

```c
struct Concept* concept_try_get_value(const struct Concept* concept)
```

Retrieves the value of this `Concept`, if it exists. If this is an `Attribute` instance, returns the value of this instance. If this a `Value`, returns the value. Otherwise, returns null.

Returns

`struct Concept*`

#### [](#_concept_try_get_value_type)function `concept_try_get_value_type`

```c
char* concept_try_get_value_type(const struct Concept* concept)
```

Retrieves the value type of this `Concept`, if it exists. If this is an `Attribute` instance, returns the value type of this instance. If this is a `Value`, returns its value type. If this is an `AttributeType`, returns the value type that the schema permits for the attribute type, if one is defined. Otherwise, returns null.

Returns

`char*`

### [](#_methods_concept_conceptiterator)conceptiterator

#### [](#_Struct_ConceptIterator)Struct ConceptIterator

`rust struct (pointer)`

Iterator over the `Concepts`s returned by an API method or query.

#### [](#_concept_iterator_drop)function `concept_iterator_drop`

```c
void concept_iterator_drop(struct ConceptIterator* it)
```

Frees the native rust `ConceptIterator` object

Returns

`void`

#### [](#_concept_iterator_next)function `concept_iterator_next`

```c
struct Concept* concept_iterator_next(struct ConceptIterator* it)
```

Forwards the `ConceptIterator` and returns the next `Concept` if it exists, or null if there are no more elements.

Returns

`struct Concept*`

### [](#_methods_concept_kind)kind

#### [](#_Struct_Kind)Struct Kind

`rust struct (pointer)`

Kind represents the base of a defined type to describe its capabilities. For example, "define entity person;" defines a type "person" of a kind "entity".

#### [](#_Enum_Kind)Enum Kind

`rust enum (pointer)`

Kind represents the base of a defined type to describe its capabilities. For example, "define entity person;" defines a type "person" of a kind "entity".

Enumerator

Entity&nbsp;

Entity type kind.

Attribute&nbsp;

Attribute type kind.

Relation&nbsp;

Relation type kind.

Role&nbsp;

Role type kind (a role played in a relation).

Enum constants 

Name

`Attribute`

`Entity`

`Relation`

`Role`

### [](#_methods_concept_entity)entity

#### [](#_entity_get_type)function `entity_get_type`

```c
struct Concept* entity_get_type(const struct Concept* entity)
```

Retrieves the type which this `Entity` belongs to.

Returns

`struct Concept*`

### [](#_methods_concept_relation)relation

#### [](#_relation_get_type)function `relation_get_type`

```c
struct Concept* relation_get_type(const struct Concept* relation)
```

Retrieves the type which this `Relation` belongs to.

Returns

`struct Concept*`

### [](#_methods_concept_attribute)attribute

#### [](#_attribute_get_type)function `attribute_get_type`

```c
struct Concept* attribute_get_type(const struct Concept* attribute)
```

Retrieves the type which this `Attribute` belongs to.

Returns

`struct Concept*`

### [](#_methods_concept_datetimeinnanos)datetimeinnanos

#### [](#_Struct_DatetimeInNanos)Struct DatetimeInNanos

`rust struct (pointer)`

A `DatetimeInNanos` used to represent datetime as a pair of seconds part and a number of nanoseconds since the last seconds boundary.

### [](#_methods_concept_datetimeandtimezone)datetimeandtimezone

#### [](#_Struct_DatetimeAndTimeZone)Struct DatetimeAndTimeZone

`rust struct (pointer)`

`DatetimeAndTimeZone` is used to represent time zoned datetime in FFI. Time zone can be represented either as an IANA `Tz` or as a `FixedOffset`. Either the zone\_name (is\_fixed\_offset == false) or offset (is\_fixed\_offset == true) is set.

#### [](#_datetime_and_time_zone_drop)function `datetime_and_time_zone_drop`

```c
void datetime_and_time_zone_drop(struct DatetimeAndTimeZone* datetime_tz)
```

Frees the native rust `DatetimeAndTimeZone` object

Returns

`void`

### [](#_methods_concept_stringandoptvalue)stringandoptvalue

#### [](#_Struct_StringAndOptValue)Struct StringAndOptValue

`rust struct (pointer)`

A `StringAndOptValue` used to represent the pair of variables involved in an ownership. `_0` and `_1` are the owner and attribute variables respectively.

#### [](#_string_and_opt_value_drop)function `string_and_opt_value_drop`

```c
void string_and_opt_value_drop(struct StringAndOptValue* string_and_opt_value)
```

Frees the native rust `StringAndOptValue` object

Returns

`void`

### [](#_methods_concept_stringandoptvalueiterator)stringandoptvalueiterator

#### [](#_Struct_StringAndOptValueIterator)Struct StringAndOptValueIterator

`rust struct (pointer)`

Iterator over the `StringAndOptValue`s representing struct value {field\_name: value?} info.

#### [](#_string_and_opt_value_iterator_drop)function `string_and_opt_value_iterator_drop`

```c
void string_and_opt_value_iterator_drop(struct StringAndOptValueIterator* it)
```

Frees the native rust `StringAndOptValueIterator` object

Returns

`void`

#### [](#_string_and_opt_value_iterator_next)function `string_and_opt_value_iterator_next`

```c
struct StringAndOptValue* string_and_opt_value_iterator_next(struct StringAndOptValueIterator* it)
```

Forwards the `StringAndOptValueIterator` and returns the next `StringAndOptValue` if it exists, or null if there are no more elements.

Returns

`struct StringAndOptValue*`

## [](#_value_header)Value

### [](#_methods_value_decimal)decimal

#### [](#_Struct_Decimal)Struct Decimal

`rust struct (pointer)`

A fixed-point decimal number. Holds exactly 19 digits after the decimal point and a 64-bit value before the decimal point.

### [](#_methods_value_duration)duration

#### [](#_Struct_Duration)Struct Duration

`rust struct (pointer)`

A relative duration, which contains months, days, and nanoseconds. Can be used for calendar-relative durations (eg 7 days forward), or for absolute durations using the nanosecond component When used as an absolute duration, convertible to chrono::Duration

## [](#_analyze_header)Analyze

### [](#_methods_analyze_analyzed)analyzed

#### [](#_analyzed_fetch)function `analyzed_fetch`

```c
struct Fetch* analyzed_fetch(const struct AnalyzedQuery* analyzed_query)
```

Returns the analyzed fetch

Returns

`struct Fetch*`

#### [](#_analyzed_given)function `analyzed_given`

```c
struct Given* analyzed_given(const struct AnalyzedQuery* analyzed_query)
```

Returns the analyzed given stage, or null if the query has no given stage.

Returns

`struct Given*`

#### [](#_analyzed_preamble)function `analyzed_preamble`

```c
struct FunctionIterator* analyzed_preamble(const struct AnalyzedQuery* analyzed_query)
```

Returns the analyzed functions in the preamble of the query.

Returns

`struct FunctionIterator*`

### [](#_methods_analyze_analyzedquery)analyzedquery

#### [](#_Struct_AnalyzedQuery)Struct AnalyzedQuery

`rust struct (pointer)`

An `AnalyzedQuery` contains the server’s representation of the query and preamble functions; as well as the result of types inferred for each variable by type-inference.

#### [](#_analyzed_query_drop)function `analyzed_query_drop`

```c
void analyzed_query_drop(struct AnalyzedQuery* obj)
```

Frees the native rust `AnalyzedQuery` object.

Returns

`void`

#### [](#_analyzed_query_pipeline)function `analyzed_query_pipeline`

```c
struct Pipeline* analyzed_query_pipeline(const struct AnalyzedQuery* analyzed_query)
```

Returns the structure of the query pipeline in the analyzed query.

Returns

`struct Pipeline*`

### [](#_methods_analyze_analyzedquerypromise)analyzedquerypromise

#### [](#_analyzed_query_promise_drop)function `analyzed_query_promise_drop`

```c
void analyzed_query_promise_drop(struct AnalyzedQueryPromise* promise)
```

Frees the native rust `AnalyzePromise` object.

Returns

`void`

#### [](#_analyzed_query_promise_resolve)function `analyzed_query_promise_resolve`

```c
struct AnalyzedQuery* analyzed_query_promise_resolve(struct AnalyzedQueryPromise* promise)
```

Waits for and returns the result of the Analyze request. In case the operation failed, the error flag will only be set when the promise is resolved. The native promise object is freed when it is resolved.

Returns

`struct AnalyzedQuery*`

### [](#_methods_analyze_pipeline)pipeline

#### [](#_Struct_Pipeline)Struct Pipeline

`rust struct (pointer)`

A representation of a query pipeline.

#### [](#_pipeline_drop)function `pipeline_drop`

```c
void pipeline_drop(struct Pipeline* obj)
```

Frees the native rust `Pipeline` object.

Returns

`void`

#### [](#_pipeline_get_conjunction)function `pipeline_get_conjunction`

```c
struct Conjunction* pipeline_get_conjunction(const struct Pipeline* pipeline, const struct ConjunctionID* conjunction_id)
```

Returns the `Conjunction` corresponding to the ConjunctionID. The `Pipeline` must be the one that contains the Conjunction & ConjunctionID.

Returns

`struct Conjunction*`

### [](#_methods_analyze_pipelinestage)pipelinestage

#### [](#_Struct_PipelineStage)Struct PipelineStage

`rust struct (pointer)`

Representation of a stage in a `Pipeline`.

#### [](#_pipeline_stage_delete_get_deleted_variables)function `pipeline_stage_delete_get_deleted_variables`

```c
struct VariableIterator* pipeline_stage_delete_get_deleted_variables(const struct PipelineStage* stage)
```

Unwraps the `PipelineStage` instance as a Delete stage, and returns the variables deleted. Will panic if the stage is not a Delete.

Returns

`struct VariableIterator*`

#### [](#_pipeline_stage_drop)function `pipeline_stage_drop`

```c
void pipeline_stage_drop(struct PipelineStage* obj)
```

Frees the native rust `PipelineStage` object.

Returns

`void`

#### [](#_pipeline_stage_get_block)function `pipeline_stage_get_block`

```c
struct ConjunctionID* pipeline_stage_get_block(const struct PipelineStage* stage)
```

Returns the block of the pipeline stage - this is the `ConjunctionID` of the root conjunction. Will panic if the stage does not have a block.

Returns

`struct ConjunctionID*`

#### [](#_pipeline_stage_limit_get_limit)function `pipeline_stage_limit_get_limit`

```c
int64_t pipeline_stage_limit_get_limit(const struct PipelineStage* stage)
```

Unwraps the `PipelineStage` instance as a Limit stage, and returns the limit applied. Will panic if the stage is not a Limit stage.

Returns

`int64_t`

#### [](#_pipeline_stage_offset_get_offset)function `pipeline_stage_offset_get_offset`

```c
int64_t pipeline_stage_offset_get_offset(const struct PipelineStage* stage)
```

Unwraps the `PipelineStage` instance as an Offset stage, and returns the offset applied. Will panic if the stage is not an Offset stage.

Returns

`int64_t`

#### [](#_pipeline_stage_reduce_get_groupby)function `pipeline_stage_reduce_get_groupby`

```c
struct VariableIterator* pipeline_stage_reduce_get_groupby(const struct PipelineStage* stage)
```

Unwraps the `PipelineStage` instance as a Reduce stage, and returns the variables being grouped on. Will panic if the stage is not a Reduce stage.

Returns

`struct VariableIterator*`

#### [](#_pipeline_stage_reduce_get_reducer_assignments)function `pipeline_stage_reduce_get_reducer_assignments`

```c
struct ReduceAssignmentIterator* pipeline_stage_reduce_get_reducer_assignments(const struct PipelineStage* stage)
```

Unwraps the `PipelineStage` instance as a Reduce stage, and returns the reducers applied and the variables their results are assigned to. Will panic if the stage is not a Reduce stage.

Returns

`struct ReduceAssignmentIterator*`

#### [](#_pipeline_stage_require_get_variables)function `pipeline_stage_require_get_variables`

```c
struct VariableIterator* pipeline_stage_require_get_variables(const struct PipelineStage* stage)
```

Unwraps the `PipelineStage` instance as a Require stage, and returns the required variables. Will panic if the stage is not a Require stage.

Returns

`struct VariableIterator*`

#### [](#_pipeline_stage_select_get_variables)function `pipeline_stage_select_get_variables`

```c
struct VariableIterator* pipeline_stage_select_get_variables(const struct PipelineStage* stage)
```

Unwraps the `PipelineStage` instance as a Select stage, and returns the variables selected. Will panic if the stage is not a Select.

Returns

`struct VariableIterator*`

#### [](#_pipeline_stage_sort_get_sort_variables)function `pipeline_stage_sort_get_sort_variables`

```c
struct SortVariableIterator* pipeline_stage_sort_get_sort_variables(const struct PipelineStage* stage)
```

Unwraps the `PipelineStage` instance as a Sort stage, and returns the `SortVariable`. Will panic if the stage is not a Sort stage.

Returns

`struct SortVariableIterator*`

#### [](#_pipeline_stage_string_repr)function `pipeline_stage_string_repr`

```c
char* pipeline_stage_string_repr(const struct PipelineStage* stage)
```

Returns a string representation of the pipeline stage

Returns

`char*`

#### [](#_pipeline_stage_variant)function `pipeline_stage_variant`

```c
enum PipelineStageVariant pipeline_stage_variant(const struct PipelineStage* stage)
```

Returns the variant of the `Pipeline` stage.

Returns

`enum PipelineStageVariant`

#### [](#_pipeline_stages)function `pipeline_stages`

```c
struct PipelineStageIterator* pipeline_stages(const struct Pipeline* pipeline)
```

Returns an iterator over the stages making up the `Pipeline`

Returns

`struct PipelineStageIterator*`

### [](#_methods_analyze_pipelinestageiterator)pipelinestageiterator

#### [](#_pipeline_stage_iterator_drop)function `pipeline_stage_iterator_drop`

```c
void pipeline_stage_iterator_drop(struct PipelineStageIterator* it)
```

Frees the native rust `PipelineStageIterator` object.

Returns

`void`

#### [](#_pipeline_stage_iterator_next)function `pipeline_stage_iterator_next`

```c
struct PipelineStage* pipeline_stage_iterator_next(struct PipelineStageIterator* it)
```

Forwards the `PipelineStageIterator` and returns the next `PipelineStage` if it exists, or null if there are no more elements.

Returns

`struct PipelineStage*`

### [](#_methods_analyze_conjunction)conjunction

#### [](#_Struct_Conjunction)Struct Conjunction

`rust struct (pointer)`

A representation of the constraints involved in the query, and types inferred for each variable.

#### [](#_conjunction_drop)function `conjunction_drop`

```c
void conjunction_drop(struct Conjunction* obj)
```

Frees the native rust `Conjunction` object.

Returns

`void`

#### [](#_conjunction_get_annotated_variables)function `conjunction_get_annotated_variables`

```c
struct VariableIterator* conjunction_get_annotated_variables(const struct Conjunction* conjunction)
```

Returns the variables in the current conjunction for which type annotations are available

Returns

`struct VariableIterator*`

#### [](#_conjunction_get_constraints)function `conjunction_get_constraints`

```c
struct ConstraintWithSpanIterator* conjunction_get_constraints(const struct Conjunction* conjunction)
```

Returns the `Constraint`s in the given conjunction.

Returns

`struct ConstraintWithSpanIterator*`

#### [](#_conjunction_get_variable_annotations)function `conjunction_get_variable_annotations`

```c
struct VariableAnnotations* conjunction_get_variable_annotations(const struct Conjunction* conjunction, const struct Variable* variable)
```

Returns the inferred types for the specified variable in the specified conjunction.

Returns

`struct VariableAnnotations*`

### [](#_methods_analyze_conjunctionid)conjunctionid

#### [](#_Struct_ConjunctionID)Struct ConjunctionID

`rust struct (pointer)`

Holds the index of the conjunction in a `Pipeline`'s `conjunctions` field. Used as indirection in the representation of a pipeline.

#### [](#_conjunction_id_as_u32)function `conjunction_id_as_u32`

```c
uint32_t conjunction_id_as_u32(const struct ConjunctionID* conjunction_id)
```

Returns the ConjunctionID as u32 to use in hash, equality etc.

Returns

`uint32_t`

#### [](#_conjunction_id_drop)function `conjunction_id_drop`

```c
void conjunction_id_drop(struct ConjunctionID* obj)
```

Frees the native rust `ConjunctionID` object.

Returns

`void`

#### [](#_conjunction_id_string_repr)function `conjunction_id_string_repr`

```c
char* conjunction_id_string_repr(const struct ConjunctionID* conjunction_id)
```

Returns a string representation of the ConjunctionID.

Returns

`char*`

### [](#_methods_analyze_conjunctioniditerator)conjunctioniditerator

#### [](#_conjunction_id_iterator_drop)function `conjunction_id_iterator_drop`

```c
void conjunction_id_iterator_drop(struct ConjunctionIDIterator* it)
```

Frees the native rust `ConjunctionIDIterator` object.

Returns

`void`

#### [](#_conjunction_id_iterator_next)function `conjunction_id_iterator_next`

```c
struct ConjunctionID* conjunction_id_iterator_next(struct ConjunctionIDIterator* it)
```

Forwards the `ConjunctionIDIterator` and returns the next `ConjunctionID` if it exists, or null if there are no more elements.

Returns

`struct ConjunctionID*`

### [](#_methods_analyze_constraint)constraint

#### [](#_constraint_comparison_get_comparator)function `constraint_comparison_get_comparator`

```c
enum Comparator constraint_comparison_get_comparator(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Comparison` constraint, and returns the comparator used in the comparison. Will panic if the Constraint is not a Comparison constraint.

Returns

`enum Comparator`

#### [](#_constraint_comparison_get_lhs)function `constraint_comparison_get_lhs`

```c
struct ConstraintVertex* constraint_comparison_get_lhs(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Comparison` constraint, and returns the left-hand side vertex. Will panic if the Constraint is not a Comparison constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_comparison_get_rhs)function `constraint_comparison_get_rhs`

```c
struct ConstraintVertex* constraint_comparison_get_rhs(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Comparison` constraint, and returns the right-hand side vertex. Will panic if the Constraint is not a Comparison constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_expression_get_arguments)function `constraint_expression_get_arguments`

```c
struct ConstraintVertexIterator* constraint_expression_get_arguments(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as an `Expression` constraint, and returns the expression arguments - These are any variables used in the right-hand side of the expression. Will panic if the Constraint is not an Expression constraint.

Returns

`struct ConstraintVertexIterator*`

#### [](#_constraint_expression_get_assigned)function `constraint_expression_get_assigned`

```c
struct ConstraintVertex* constraint_expression_get_assigned(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as an `Expression` constraint, and returns the variable assigned by the expression. Will panic if the Constraint is not an Expression constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_expression_get_text)function `constraint_expression_get_text`

```c
char* constraint_expression_get_text(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as an `Expression` constraint, and returns the expression text. Will panic if the Constraint is not an Expression constraint.

Returns

`char*`

#### [](#_constraint_function_call_get_arguments)function `constraint_function_call_get_arguments`

```c
struct ConstraintVertexIterator* constraint_function_call_get_arguments(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `FunctionCall` constraint, and returns the variables passed as arguments to the function call . Will panic if the Constraint is not a FunctionCall constraint.

Returns

`struct ConstraintVertexIterator*`

#### [](#_constraint_function_call_get_assigned)function `constraint_function_call_get_assigned`

```c
struct ConstraintVertexIterator* constraint_function_call_get_assigned(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `FunctionCall` constraint, and returns the variables assigned by the function call. Will panic if the Constraint is not a FunctionCall constraint.

Returns

`struct ConstraintVertexIterator*`

#### [](#_constraint_function_call_get_name)function `constraint_function_call_get_name`

```c
char* constraint_function_call_get_name(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `FunctionCall` constraint, and returns the function name. Will panic if the Constraint is not a FunctionCall constraint.

Returns

`char*`

#### [](#_constraint_has_get_attribute)function `constraint_has_get_attribute`

```c
struct ConstraintVertex* constraint_has_get_attribute(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Has` constraint, and returns the attribute vertex. Will panic if the Constraint is not a Has constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_has_get_exactness)function `constraint_has_get_exactness`

```c
enum ConstraintExactness constraint_has_get_exactness(const struct ConstraintWithSpan* constraint)
```

(FUTURE-USE: Currently always ConstraintExactness::Subtypes) Unwraps the `Constraint` instance as a `Has` constraint, and returns the exactness of the attribute match. Will panic if the Constraint is not a Has constraint.

Returns

`enum ConstraintExactness`

#### [](#_constraint_has_get_owner)function `constraint_has_get_owner`

```c
struct ConstraintVertex* constraint_has_get_owner(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Has` constraint, and returns the owner vertex. Will panic if the Constraint is not a Has constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_iid_get_iid)function `constraint_iid_get_iid`

```c
char* constraint_iid_get_iid(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as an `Iid` constraint, and returns the iid value as a string. Will panic if the Constraint is not an Iid constraint.

Returns

`char*`

#### [](#_constraint_iid_get_variable)function `constraint_iid_get_variable`

```c
struct ConstraintVertex* constraint_iid_get_variable(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as an `Iid` constraint, and returns the concept (variable) the iid applies to. Will panic if the Constraint is not an Iid constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_is_get_lhs)function `constraint_is_get_lhs`

```c
struct ConstraintVertex* constraint_is_get_lhs(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as an `Is` constraint, and returns the left-hand side vertex. Will panic if the Constraint is not an Is constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_is_get_rhs)function `constraint_is_get_rhs`

```c
struct ConstraintVertex* constraint_is_get_rhs(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as an `Is` constraint, and returns the right-hand side vertex. Will panic if the Constraint is not an Is constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_isa_get_exactness)function `constraint_isa_get_exactness`

```c
enum ConstraintExactness constraint_isa_get_exactness(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as an `Isa` constraint, and returns the exactness of the type match. Will panic if the Constraint is not an Isa constraint.

Returns

`enum ConstraintExactness`

#### [](#_constraint_isa_get_instance)function `constraint_isa_get_instance`

```c
struct ConstraintVertex* constraint_isa_get_instance(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as an `Isa` constraint, and returns the instance vertex. Will panic if the Constraint is not an Isa constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_isa_get_type)function `constraint_isa_get_type`

```c
struct ConstraintVertex* constraint_isa_get_type(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as an `Isa` constraint, and returns the type vertex. Will panic if the Constraint is not an Isa constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_kind_get_kind)function `constraint_kind_get_kind`

```c
enum Kind constraint_kind_get_kind(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Kind` constraint, and returns the `Kind` of the type-vertex. Will panic if the Constraint is not a Kind constraint.

Returns

`enum Kind`

#### [](#_constraint_kind_get_type)function `constraint_kind_get_type`

```c
struct ConstraintVertex* constraint_kind_get_type(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Kind` constraint, and returns the associated type vertex. Will panic if the Constraint is not a Kind constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_label_get_label)function `constraint_label_get_label`

```c
char* constraint_label_get_label(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Label` constraint, and returns the label string. Will panic if the Constraint is not a Label constraint.

Returns

`char*`

#### [](#_constraint_label_get_variable)function `constraint_label_get_variable`

```c
struct ConstraintVertex* constraint_label_get_variable(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Label` constraint, and returns the type-vertex the label applies to. Will panic if the Constraint is not a Label constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_links_get_exactness)function `constraint_links_get_exactness`

```c
enum ConstraintExactness constraint_links_get_exactness(const struct ConstraintWithSpan* constraint)
```

(FUTURE-USE: Currently always ConstraintExactness::Subtypes) Unwraps the `Constraint` instance as a `Links` constraint, and returns the exactness of the role-type match. Will panic if the Constraint is not a Links constraint.

Returns

`enum ConstraintExactness`

#### [](#_constraint_links_get_player)function `constraint_links_get_player`

```c
struct ConstraintVertex* constraint_links_get_player(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Links` constraint, and returns the player vertex. Will panic if the Constraint is not a Links constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_links_get_relation)function `constraint_links_get_relation`

```c
struct ConstraintVertex* constraint_links_get_relation(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Links` constraint, and returns the relation vertex. Will panic if the Constraint is not a Links constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_links_get_role)function `constraint_links_get_role`

```c
struct ConstraintVertex* constraint_links_get_role(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Links` constraint, and returns the role vertex. Will panic if the Constraint is not a Links constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_not_get_conjunction)function `constraint_not_get_conjunction`

```c
struct ConjunctionID* constraint_not_get_conjunction(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Not` constraint, and returns the `ConjunctionID` of the negated conjunction. Will panic if the Constraint is not a Not constraint.

Returns

`struct ConjunctionID*`

#### [](#_constraint_or_get_branches)function `constraint_or_get_branches`

```c
struct ConjunctionIDIterator* constraint_or_get_branches(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as an `Or` constraint, and returns the `ConjunctionID`s of the conjunction in each of the branches. Will panic if the Constraint is not an Or constraint.

Returns

`struct ConjunctionIDIterator*`

#### [](#_constraint_owns_get_attribute)function `constraint_owns_get_attribute`

```c
struct ConstraintVertex* constraint_owns_get_attribute(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as an `Owns` constraint, and returns the attribute-type vertex. Will panic if the Constraint is not an Owns constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_owns_get_exactness)function `constraint_owns_get_exactness`

```c
enum ConstraintExactness constraint_owns_get_exactness(const struct ConstraintWithSpan* constraint)
```

(FUTURE-USE: Currently always ConstraintExactness::Subtypes) Will panic if the Constraint is not an Owns constraint.

Returns

`enum ConstraintExactness`

#### [](#_constraint_owns_get_owner)function `constraint_owns_get_owner`

```c
struct ConstraintVertex* constraint_owns_get_owner(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as an `Owns` constraint, and returns the owner-type vertex. Will panic if the Constraint is not an Owns constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_plays_get_exactness)function `constraint_plays_get_exactness`

```c
enum ConstraintExactness constraint_plays_get_exactness(const struct ConstraintWithSpan* constraint)
```

(FUTURE-USE: Currently always ConstraintExactness::Subtypes)

Returns

`enum ConstraintExactness`

#### [](#_constraint_plays_get_player)function `constraint_plays_get_player`

```c
struct ConstraintVertex* constraint_plays_get_player(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Plays` constraint, and returns the player type vertex. Will panic if the Constraint is not a Plays constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_plays_get_role)function `constraint_plays_get_role`

```c
struct ConstraintVertex* constraint_plays_get_role(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Plays` constraint, and returns the role-type vertex. Will panic if the Constraint is not a Plays constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_relates_get_exactness)function `constraint_relates_get_exactness`

```c
enum ConstraintExactness constraint_relates_get_exactness(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Relates` constraint, and returns the exactness of the relation match. Will panic if the Constraint is not a Relates constraint.

Returns

`enum ConstraintExactness`

#### [](#_constraint_relates_get_relation)function `constraint_relates_get_relation`

```c
struct ConstraintVertex* constraint_relates_get_relation(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Relates` constraint, and returns the relation-type vertex. Will panic if the Constraint is not a Relates constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_relates_get_role)function `constraint_relates_get_role`

```c
struct ConstraintVertex* constraint_relates_get_role(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Relates` constraint, and returns the role-type vertex. Will panic if the Constraint is not a Relates constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_string_repr)function `constraint_string_repr`

```c
char* constraint_string_repr(const struct ConstraintWithSpan* constraint)
```

Returns a string representation of the constraint

Returns

`char*`

#### [](#_constraint_sub_get_exactness)function `constraint_sub_get_exactness`

```c
enum ConstraintExactness constraint_sub_get_exactness(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Sub` constraint, and returns the exactness of the subtype match. If Exact (i.e. `sub!`), only the immediate subtype is returned else, (i.e. `sub`) the type itself and all subtypes are returned. Will panic if the Constraint is not a Sub constraint.

Returns

`enum ConstraintExactness`

#### [](#_constraint_sub_get_subtype)function `constraint_sub_get_subtype`

```c
struct ConstraintVertex* constraint_sub_get_subtype(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Sub` constraint, and returns the subtype vertex. Will panic if the Constraint is not a Sub constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_sub_get_supertype)function `constraint_sub_get_supertype`

```c
struct ConstraintVertex* constraint_sub_get_supertype(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Sub` constraint, and returns the supertype vertex. Will panic if the Constraint is not a Sub constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_try_get_conjunction)function `constraint_try_get_conjunction`

```c
struct ConjunctionID* constraint_try_get_conjunction(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Try` constraint, and returns the `ConjunctionID` of the optionally matched conjunction. Will panic if the Constraint is not a Try constraint.

Returns

`struct ConjunctionID*`

#### [](#_constraint_value_get_attribute_type)function `constraint_value_get_attribute_type`

```c
struct ConstraintVertex* constraint_value_get_attribute_type(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Value` constraint, and returns the attribute type vertex. Will panic if the Constraint is not a Value constraint.

Returns

`struct ConstraintVertex*`

#### [](#_constraint_value_get_value_type)function `constraint_value_get_value_type`

```c
char* constraint_value_get_value_type(const struct ConstraintWithSpan* constraint)
```

Unwraps the `Constraint` instance as a `Value` constraint, and returns the specified ValueType as a string. Will panic if the Constraint is not a Value constraint.

Returns

`char*`

#### [](#_constraint_variant)function `constraint_variant`

```c
enum ConstraintVariant constraint_variant(const struct ConstraintWithSpan* constraint)
```

The variant of the specified constraint

Returns

`enum ConstraintVariant`

### [](#_methods_analyze_constraintexactness)constraintexactness

#### [](#_Struct_ConstraintExactness)Struct ConstraintExactness

`rust struct (pointer)`

Tells apart exact variants of constraints from the ones allowing subtype-polymorphism. e.g. `isa!` would be represented as an `Constraint::Isa` with its exactness field `ConstraintExactness::Exact`.

#### [](#_Enum_ConstraintExactness)Enum ConstraintExactness

`rust enum (pointer)`

Tells apart exact variants of constraints from the ones allowing subtype-polymorphism. e.g. `isa!` would be represented as an `Constraint::Isa` with its exactness field `ConstraintExactness::Exact`.

Enumerator

Exact&nbsp;

Indicates the constraint matches exactly the specified type - e.g. `isa!` or `sub!`

Subtypes&nbsp;

Indicates the constraint matches the specified type and its subtypes - e.g. `isa!` or `sub!`

Enum constants 

Name

`Exact`

`Subtypes`

### [](#_methods_analyze_constraintspan)constraintspan

#### [](#_constraint_span_begin)function `constraint_span_begin`

```c
int64_t constraint_span_begin(const struct ConstraintWithSpan* constraint)
```

The offset of the first character of the specified constraint in the source query .

Returns

`int64_t`

#### [](#_constraint_span_end)function `constraint_span_end`

```c
int64_t constraint_span_end(const struct ConstraintWithSpan* constraint)
```

The offset after the last character of the specified constraint in the source query .

Returns

`int64_t`

### [](#_methods_analyze_constraintwithspan)constraintwithspan

#### [](#_constraint_with_span_drop)function `constraint_with_span_drop`

```c
void constraint_with_span_drop(struct ConstraintWithSpan* obj)
```

Frees the native rust `Constraint` object.

Returns

`void`

### [](#_methods_analyze_constraintwithspaniterator)constraintwithspaniterator

#### [](#_constraint_with_span_iterator_drop)function `constraint_with_span_iterator_drop`

```c
void constraint_with_span_iterator_drop(struct ConstraintWithSpanIterator* it)
```

Frees the native rust `ConstraintWithSpanIterator` object.

Returns

`void`

#### [](#_constraint_with_span_iterator_next)function `constraint_with_span_iterator_next`

```c
struct ConstraintWithSpan* constraint_with_span_iterator_next(struct ConstraintWithSpanIterator* it)
```

Forwards the `ConstraintWithSpanIterator` and returns the next `ConstraintWithSpan` if it exists, or null if there are no more elements.

Returns

`struct ConstraintWithSpan*`

### [](#_methods_analyze_constraintvertex)constraintvertex

#### [](#_Struct_ConstraintVertex)Struct ConstraintVertex

`rust struct (pointer)`

The answer to a TypeDB query is a set of concepts which satisfy the `Constraints` in the query. A `ConstraintVertex` is either a variable, or some identifier of the concept.

A \`\`Variable\`\` is a vertex the query must match and return.
A \`\`Label\`\` uniquely identifies a type
A \`\`Value\`\` represents a primitive value literal in TypeDB.
A \`\`NamedRole\`\` vertex is used in links &amp; relates constraints, as multiple relations may have roles with the same name.

The types inferred for `Variable`, `Label` and `NamedRole` vertices can be read from the `variable_annotations` field of the `Conjunction` it is in.

#### [](#_constraint_vertex_as_label)function `constraint_vertex_as_label`

```c
struct Concept* constraint_vertex_as_label(const struct ConstraintVertex* vertex)
```

Unwraps the `ConstraintVertex` instance as a Label. Will panic if the instance is not a Label variant.

Returns

`struct Concept*`

#### [](#_constraint_vertex_as_named_role)function `constraint_vertex_as_named_role`

```c
struct NamedRole* constraint_vertex_as_named_role(const struct ConstraintVertex* vertex)
```

Unwraps the `ConstraintVertex` instance as a NamedRole. 'links' & 'relates' constraints accept unscoped role names. Since an unscoped role-name does not uniquely identify a role-type, (Different role-types belonging to different relation types may share the same name) an internal variable is introduced to handle the ambiguity Will panic if the instance is not a NamedRole variant.

Returns

`struct NamedRole*`

#### [](#_constraint_vertex_as_value)function `constraint_vertex_as_value`

```c
struct Concept* constraint_vertex_as_value(const struct ConstraintVertex* vertex)
```

Unwraps the `ConstraintVertex` instance as a Value. Will panic if the instance is not a Value variant.

Returns

`struct Concept*`

#### [](#_constraint_vertex_as_variable)function `constraint_vertex_as_variable`

```c
struct Variable* constraint_vertex_as_variable(const struct ConstraintVertex* vertex)
```

Unwraps the `ConstraintVertex` instance as a Variable. Will panic if the instance is not a Variable variant.

Returns

`struct Variable*`

#### [](#_constraint_vertex_drop)function `constraint_vertex_drop`

```c
void constraint_vertex_drop(struct ConstraintVertex* obj)
```

Frees the native rust `ConstraintVertex` object.

Returns

`void`

#### [](#_constraint_vertex_variant)function `constraint_vertex_variant`

```c
enum ConstraintVertexVariant constraint_vertex_variant(const struct ConstraintVertex* vertex)
```

Returns the variant of the constraint

Returns

`enum ConstraintVertexVariant`

### [](#_methods_analyze_constraintvertexiterator)constraintvertexiterator

#### [](#_constraint_vertex_iterator_drop)function `constraint_vertex_iterator_drop`

```c
void constraint_vertex_iterator_drop(struct ConstraintVertexIterator* it)
```

Frees the native rust `ConstraintVertexIterator` object.

Returns

`void`

#### [](#_constraint_vertex_iterator_next)function `constraint_vertex_iterator_next`

```c
struct ConstraintVertex* constraint_vertex_iterator_next(struct ConstraintVertexIterator* it)
```

Forwards the `ConstraintVertexIterator` and returns the next `ConstraintVertex` if it exists, or null if there are no more elements.

Returns

`struct ConstraintVertex*`

### [](#_methods_analyze_variable)variable

#### [](#_Struct_Variable)Struct Variable

`rust struct (pointer)`

Uniquely identifies a variable in a `Pipeline`pipeline. Its name (if any) can be retrieved from the `variable_names` field in `Pipeline`

#### [](#_variable_drop)function `variable_drop`

```c
void variable_drop(struct Variable* obj)
```

Frees the native rust `Variable` object.

Returns

`void`

#### [](#_variable_get_name)function `variable_get_name`

```c
char* variable_get_name(const struct Pipeline* pipeline_structure, const struct Variable* variable)
```

Returns the name of the specified variable if it has one, and null otherwise. The `Pipeline` must be the one that contains the variable.

Returns

`char*`

#### [](#_variable_id_as_u32)function `variable_id_as_u32`

```c
uint32_t variable_id_as_u32(const struct Variable* variable)
```

Returns the Variable id as u32 to use in hash, equality etc.

Returns

`uint32_t`

#### [](#_variable_string_repr)function `variable_string_repr`

```c
char* variable_string_repr(const struct Variable* variable)
```

Returns a string representation of the variable. Does not resolve the name.

Returns

`char*`

### [](#_methods_analyze_variableannotations)variableannotations

#### [](#_variable_annotations_drop)function `variable_annotations_drop`

```c
void variable_annotations_drop(struct VariableAnnotations* obj)
```

Frees the native rust `VariableAnnotations` object.

Returns

`void`

#### [](#_variable_annotations_instance)function `variable_annotations_instance`

```c
struct ConceptIterator* variable_annotations_instance(const struct VariableAnnotations* annotations)
```

Unwraps the `VariableAnnotations` instance as annotations for an Instance variable, and returns the possible types of the instances the variable may hold. Will panic if the variable is not an Instance variable.

Returns

`struct ConceptIterator*`

#### [](#_variable_annotations_type)function `variable_annotations_type`

```c
struct ConceptIterator* variable_annotations_type(const struct VariableAnnotations* annotations)
```

Unwraps the `VariableAnnotations` instance as annotations for a Type variable, and returns the possible types the variable may be. Will panic if the variable is not a Type variable.

Returns

`struct ConceptIterator*`

#### [](#_variable_annotations_value)function `variable_annotations_value`

```c
struct StringIterator* variable_annotations_value(const struct VariableAnnotations* annotations)
```

Unwraps the `VariableAnnotations` instance as annotations for a Value variable, and returns the possible ValueTypes the value may be. Will panic if the variable is not a Value variable.

Returns

`struct StringIterator*`

#### [](#_variable_annotations_variant)function `variable_annotations_variant`

```c
enum VariableAnnotationsVariant variable_annotations_variant(const struct VariableAnnotations* annotations)
```

Returns the variant of the specified VariableAnnotations. This tells us whether the variable holds an instance, a type or a raw value.

Returns

`enum VariableAnnotationsVariant`

### [](#_methods_analyze_variableannotationsiterator)variableannotationsiterator

#### [](#_variable_annotations_iterator_drop)function `variable_annotations_iterator_drop`

```c
void variable_annotations_iterator_drop(struct VariableAnnotationsIterator* it)
```

Frees the native rust `VariableAnnotationsIterator` object.

Returns

`void`

#### [](#_variable_annotations_iterator_next)function `variable_annotations_iterator_next`

```c
struct VariableAnnotations* variable_annotations_iterator_next(struct VariableAnnotationsIterator* it)
```

Forwards the `VariableAnnotationsIterator` and returns the next `VariableAnnotations` if it exists, or null if there are no more elements.

Returns

`struct VariableAnnotations*`

### [](#_methods_analyze_variableiterator)variableiterator

#### [](#_variable_iterator_drop)function `variable_iterator_drop`

```c
void variable_iterator_drop(struct VariableIterator* it)
```

Frees the native rust `VariableIterator` object.

Returns

`void`

#### [](#_variable_iterator_next)function `variable_iterator_next`

```c
struct Variable* variable_iterator_next(struct VariableIterator* it)
```

Forwards the `VariableIterator` and returns the next `Variable` if it exists, or null if there are no more elements.

Returns

`struct Variable*`

### [](#_methods_analyze_fetch)fetch

#### [](#_Struct_Fetch)Struct Fetch

`rust struct (pointer)`

A representation of the 'fetch' stage of a query

#### [](#_fetch_drop)function `fetch_drop`

```c
void fetch_drop(struct Fetch* obj)
```

Frees the native rust `Fetch` object.

Returns

`void`

#### [](#_fetch_leaf_annotations)function `fetch_leaf_annotations`

```c
struct StringIterator* fetch_leaf_annotations(const struct Fetch* fetch)
```

Unwraps the `Fetch` instance as a Leaf variant, and returns an iterator over possible value types. Will panic if the instance is not a Leaf variant.

Returns

`struct StringIterator*`

#### [](#_fetch_list_element)function `fetch_list_element`

```c
struct Fetch* fetch_list_element(const struct Fetch* fetch)
```

Unwraps the `Fetch` instance as a List variant, and returns the `Fetch` for an element of the list. Will panic if the instance is not a List variant.

Returns

`struct Fetch*`

#### [](#_fetch_object_fields)function `fetch_object_fields`

```c
struct StringIterator* fetch_object_fields(const struct Fetch* fetch)
```

Unwraps the `Fetch` instance as an Object variant, and returns the available fields. Will panic if the instance is not an Object variant.

Returns

`struct StringIterator*`

#### [](#_fetch_object_get_field)function `fetch_object_get_field`

```c
struct Fetch* fetch_object_get_field(const struct Fetch* fetch, const char* field)
```

Unwraps the `Fetch` instance as an Object variant, and returns the value of the specified field. Will panic if the instance is not an Object variant.

Returns

`struct Fetch*`

#### [](#_fetch_variant)function `fetch_variant`

```c
enum FetchVariant fetch_variant(const struct Fetch* fetch)
```

Returns the variant of the `Fetch` instance.

Returns

`enum FetchVariant`

### [](#_methods_analyze_function)function

#### [](#_Struct_Function)Struct Function

`rust struct (pointer)`

Holds a representation of the function, and the result of type-inference for each variable.

#### [](#_function_argument_annotations)function `function_argument_annotations`

```c
struct VariableAnnotationsIterator* function_argument_annotations(const struct Function* function)
```

Returns the inferred type for each argument of the function.

Returns

`struct VariableAnnotationsIterator*`

#### [](#_function_argument_variables)function `function_argument_variables`

```c
struct VariableIterator* function_argument_variables(const struct Function* function)
```

Returns the `Variable`s which are the arguments of the function.

Returns

`struct VariableIterator*`

#### [](#_function_body)function `function_body`

```c
struct Pipeline* function_body(const struct Function* function)
```

A representation of the `Pipeline` which forms the body of the function.

Returns

`struct Pipeline*`

#### [](#_function_drop)function `function_drop`

```c
void function_drop(struct Function* obj)
```

Frees the native rust `Function` object.

Returns

`void`

#### [](#_function_return_annotations)function `function_return_annotations`

```c
struct VariableAnnotationsIterator* function_return_annotations(const struct Function* function)
```

Returns the inferred type for each concept returned by the function.

Returns

`struct VariableAnnotationsIterator*`

#### [](#_function_return_operation)function `function_return_operation`

```c
struct ReturnOperation* function_return_operation(const struct Function* function)
```

A representation of the `ReturnOperation` of the function.

Returns

`struct ReturnOperation*`

### [](#_methods_analyze_functioniterator)functioniterator

#### [](#_function_iterator_drop)function `function_iterator_drop`

```c
void function_iterator_drop(struct FunctionIterator* it)
```

Frees the native rust `FunctionIterator` object.

Returns

`void`

#### [](#_function_iterator_next)function `function_iterator_next`

```c
struct Function* function_iterator_next(struct FunctionIterator* it)
```

Forwards the `FunctionIterator` and returns the next `Function` if it exists, or null if there are no more elements.

Returns

`struct Function*`

### [](#_methods_analyze_returnoperation)returnoperation

#### [](#_Struct_ReturnOperation)Struct ReturnOperation

`rust struct (pointer)`

A representation of the return operation of the function

#### [](#_return_operation_drop)function `return_operation_drop`

```c
void return_operation_drop(struct ReturnOperation* obj)
```

Frees the native rust `ReturnOperation` object.

Returns

`void`

#### [](#_return_operation_reducers)function `return_operation_reducers`

```c
struct ReducerIterator* return_operation_reducers(const struct ReturnOperation* return_operation)
```

Unwraps the `ReturnOperation` instance as a Reduce variant, and returns the reducers applied. Will panic if the instance is not a Reduce variant.

Returns

`struct ReducerIterator*`

#### [](#_return_operation_single_selector)function `return_operation_single_selector`

```c
char* return_operation_single_selector(const struct ReturnOperation* return_operation)
```

Unwraps the `ReturnOperation` instance as a Single variant, and returns the selector applied. Will panic if the instance is not a Single variant.

Returns

`char*`

#### [](#_return_operation_single_variables)function `return_operation_single_variables`

```c
struct VariableIterator* return_operation_single_variables(const struct ReturnOperation* return_operation)
```

Unwraps the `ReturnOperation` instance as a Single variant, and returns the returned variables. Will panic if the instance is not a Single variant.

Returns

`struct VariableIterator*`

#### [](#_return_operation_stream_variables)function `return_operation_stream_variables`

```c
struct VariableIterator* return_operation_stream_variables(const struct ReturnOperation* return_operation)
```

Unwraps the `ReturnOperation` instance as a Stream variant, and returns the returned variables. Will panic if the instance is not a Stream variant.

Returns

`struct VariableIterator*`

#### [](#_return_operation_variant)function `return_operation_variant`

```c
enum ReturnOperationVariant return_operation_variant(const struct ReturnOperation* return_operation)
```

Returns the variant of the `ReturnOperation`.

Returns

`enum ReturnOperationVariant`

### [](#_methods_analyze_reducer)reducer

#### [](#_Struct_Reducer)Struct Reducer

`rust struct (pointer)`

Representation of a reducer used either in a `PipelineStage::Reduce` or in a function’s `ReturnOperation`.

#### [](#_reducer_drop)function `reducer_drop`

```c
void reducer_drop(struct Reducer* obj)
```

Frees the native rust `Reducer` object.

Returns

`void`

#### [](#_reducer_get_arguments)function `reducer_get_arguments`

```c
struct VariableIterator* reducer_get_arguments(const struct Reducer* reducer)
```

The arguments to this Reducer. e.g. `$x` in `sum($x)`

Returns

`struct VariableIterator*`

#### [](#_reducer_get_name)function `reducer_get_name`

```c
char* reducer_get_name(const struct Reducer* reducer)
```

The name of the operation applied by this Reducer. e.g. `sum` in `sum($x)`

Returns

`char*`

### [](#_methods_analyze_reduceriterator)reduceriterator

#### [](#_reducer_iterator_drop)function `reducer_iterator_drop`

```c
void reducer_iterator_drop(struct ReducerIterator* it)
```

Frees the native rust `ReducerIterator` object.

Returns

`void`

#### [](#_reducer_iterator_next)function `reducer_iterator_next`

```c
struct Reducer* reducer_iterator_next(struct ReducerIterator* it)
```

Forwards the `ReducerIterator` and returns the next `Reducer` if it exists, or null if there are no more elements.

Returns

`struct Reducer*`

### [](#_methods_analyze_reduceassignment)reduceassignment

#### [](#_Struct_ReduceAssignment)Struct ReduceAssignment

`rust struct (pointer)`

Representation of an assignment from a reduction in a `PipelineStage::Reduce`, such as `reduce $c = sum($x);`

#### [](#_reduce_assignment_drop)function `reduce_assignment_drop`

```c
void reduce_assignment_drop(struct ReduceAssignment* obj)
```

Frees the native rust `ReduceAssignment` object.

Returns

`void`

#### [](#_reduce_assignment_get_assigned)function `reduce_assignment_get_assigned`

```c
struct Variable* reduce_assignment_get_assigned(const struct ReduceAssignment* reduce_assignment)
```

The variable being assigned to in this ReduceAssignment. e.g. `$c` in `$c = sum($x)`

Returns

`struct Variable*`

#### [](#_reduce_assignment_get_reducer)function `reduce_assignment_get_reducer`

```c
struct Reducer* reduce_assignment_get_reducer(const struct ReduceAssignment* reduce_assignment)
```

The reducer applied in this ReduceAssignment. e.g. `sum($x)` in `$c = sum($x)`

Returns

`struct Reducer*`

### [](#_methods_analyze_reduceassignmentiterator)reduceassignmentiterator

#### [](#_reduce_assignment_iterator_drop)function `reduce_assignment_iterator_drop`

```c
void reduce_assignment_iterator_drop(struct ReduceAssignmentIterator* it)
```

Frees the native rust `ReduceAssignmentIterator` object.

Returns

`void`

#### [](#_reduce_assignment_iterator_next)function `reduce_assignment_iterator_next`

```c
struct ReduceAssignment* reduce_assignment_iterator_next(struct ReduceAssignmentIterator* it)
```

Forwards the `ReduceAssignmentIterator` and returns the next `ReduceAssignment` if it exists, or null if there are no more elements.

Returns

`struct ReduceAssignment*`

### [](#_methods_analyze_sortvariable)sortvariable

#### [](#_Struct_SortVariable)Struct SortVariable

`rust struct (pointer)`

The variable being sorted on and the ordering of the sort, as used in a `PipelineStage::Sort`, e.g. `sort $v desc`

#### [](#_sort_variable_drop)function `sort_variable_drop`

```c
void sort_variable_drop(struct SortVariable* obj)
```

Frees the native rust `SortVariable` object.

Returns

`void`

#### [](#_sort_variable_get_order)function `sort_variable_get_order`

```c
enum SortOrder sort_variable_get_order(const struct SortVariable* sort_variable)
```

Returns the sort order for the variable being sorted on.

Returns

`enum SortOrder`

#### [](#_sort_variable_get_variable)function `sort_variable_get_variable`

```c
struct Variable* sort_variable_get_variable(const struct SortVariable* sort_variable)
```

Returns the variable being sorted on.

Returns

`struct Variable*`

### [](#_methods_analyze_sortvariableiterator)sortvariableiterator

#### [](#_sort_variable_iterator_drop)function `sort_variable_iterator_drop`

```c
void sort_variable_iterator_drop(struct SortVariableIterator* it)
```

Frees the native rust `SortVariableIterator` object.

Returns

`void`

#### [](#_sort_variable_iterator_next)function `sort_variable_iterator_next`

```c
struct SortVariable* sort_variable_iterator_next(struct SortVariableIterator* it)
```

Forwards the `SortVariableIterator` and returns the next `SortVariable` if it exists, or null if there are no more elements.

Returns

`struct SortVariable*`

### [](#_methods_analyze_sortorder)sortorder

#### [](#_Struct_SortOrder)Struct SortOrder

`rust struct (pointer)`

The order of a variable being sorted on in a `PipelineStage::Sort`

#### [](#_Enum_SortOrder)Enum SortOrder

`rust enum (pointer)`

The order of a variable being sorted on in a `PipelineStage::Sort`

Enum constants 

Name

`Ascending`

`Descending`

### [](#_methods_analyze_namedrole)namedrole

#### [](#_Struct_NamedRole)Struct NamedRole

`rust struct (pointer)`

A `NamedRole` vertex is used in links & relates constraints, as multiple relations may have roles with the same name.

#### [](#_named_role_as_u32)function `named_role_as_u32`

```c
uint32_t named_role_as_u32(const struct NamedRole* named_role)
```

Returns a u32 identifying the named role instance. Meant to be used to implement hash, equality etc.

Returns

`uint32_t`

#### [](#_named_role_drop)function `named_role_drop`

```c
void named_role_drop(struct NamedRole* obj)
```

Frees the native rust `NamedRole` object.

Returns

`void`

#### [](#_named_role_get_name)function `named_role_get_name`

```c
char* named_role_get_name(const struct NamedRole* named_role)
```

Returns the role name associated with the NamedRole.

Returns

`char*`

#### [](#_named_role_get_variable)function `named_role_get_variable`

```c
struct Variable* named_role_get_variable(const struct NamedRole* named_role)
```

Returns the role-type variable associated with the NamedRole.

Returns

`struct Variable*`

#### [](#_named_role_string_repr)function `named_role_string_repr`

```c
char* named_role_string_repr(const struct NamedRole* named_role)
```

Returns a string representation of the NamedRole

Returns

`char*`

### [](#_methods_analyze_comparator)comparator

#### [](#_Struct_Comparator)Struct Comparator

`rust struct (pointer)`

A representation of the comparator used in a comparison constraint.

#### [](#_Enum_Comparator)Enum Comparator

`rust enum (pointer)`

A representation of the comparator used in a comparison constraint.

Enum constants 

Name

`Contains`

`Equal`

`Greater`

`GreaterOrEqual`

`LessOrEqual`

`LessThan`

`Like`

`NotEqual`

#### [](#_comparator_get_name)function `comparator_get_name`

```c
char* comparator_get_name(enum Comparator comparator)
```

Unwraps the `Comparator` and returns its name (or symbol).

Returns

`char*`

## [](#_errors_header)Errors

### [](#_methods_errors_error)error

#### [](#_Struct_Error)Struct Error

`rust struct (pointer)`

Represents errors encountered during operation.

#### [](#_check_error)function `check_error`

```c
bool check_error(void)
```

Checks if the error flag was set by the last operation. If true, the error can be retrieved using get\_last\_error(void)

Returns

`bool`

#### [](#_error_code)function `error_code`

```c
char* error_code(const struct Error* error)
```

Returns the error code of the `Error` object

Returns

`char*`

#### [](#_error_drop)function `error_drop`

```c
void error_drop(struct Error* error)
```

Frees the native rust `Error` object

Returns

`void`

#### [](#_error_message)function `error_message`

```c
char* error_message(const struct Error* error)
```

Returns the error message of the `Error` object

Returns

`char*`

#### [](#_get_last_error)function `get_last_error`

```c
struct Error* get_last_error(void)
```

Returns the error which set the error flag.

Returns

`struct Error*`

[Rust gRPC driver](../rust/index.md) [C# gRPC driver](../csharp/index.md)

[Edit on GitHub](https://github.com/typedb/typedb-docs/edit/3.x-development/reference/modules/ROOT/pages/typedb-grpc-drivers/c.adoc) Edit this page on GitHub.