- mg_client_version
const(char)* mg_client_version()
Client software version.
Return: Client version in the major.minor.patch format.
- mg_connect
int mg_connect(mg_session_params* params, mg_session** session)
Makes a new connection to the database server.
- mg_date_alloc
mg_date* mg_date_alloc(mg_allocator* alloc)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_date_copy
mg_date* mg_date_copy(mg_date* date)
Creates a copy of the given date.
- mg_date_days
long mg_date_days(mg_date* date)
Returns days since the Unix epoch.
- mg_date_destroy
void mg_date_destroy(mg_date* date)
- mg_date_time_alloc
mg_date_time* mg_date_time_alloc(mg_allocator* alloc)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_date_time_copy
mg_date_time* mg_date_time_copy(mg_date_time* date_time)
Creates a copy of the given date and time.
- mg_date_time_destroy
void mg_date_time_destroy(mg_date_time* date_time)
Destroys the given date and time.
- mg_date_time_nanoseconds
long mg_date_time_nanoseconds(mg_date_time* date_time)
Returns nanoseconds since midnight.
- mg_date_time_seconds
long mg_date_time_seconds(mg_date_time* date_time)
Returns seconds since Unix epoch.
- mg_date_time_tz_offset_minutes
long mg_date_time_tz_offset_minutes(mg_date_time* date_time)
Returns time zone offset in minutes from UTC.
- mg_date_time_zone_id_alloc
mg_date_time_zone_id* mg_date_time_zone_id_alloc(mg_allocator* alloc)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_date_time_zone_id_copy
mg_date_time_zone_id* mg_date_time_zone_id_copy(mg_date_time_zone_id* date_time_zone_id)
Creates a copy of the given date and time.
- mg_date_time_zone_id_destroy
void mg_date_time_zone_id_destroy(mg_date_time_zone_id* date_time_zone_id)
Destroys the given date and time.
- mg_date_time_zone_id_nanoseconds
long mg_date_time_zone_id_nanoseconds(mg_date_time_zone_id* date_time_zone_id)
Returns nanoseconds since midnight.
- mg_date_time_zone_id_seconds
long mg_date_time_zone_id_seconds(mg_date_time_zone_id* date_time_zone_id)
Returns seconds since Unix epoch.
- mg_date_time_zone_id_tz_id
long mg_date_time_zone_id_tz_id(mg_date_time_zone_id* date_time_zone_id)
Returns time zone represented by the identifier.
- mg_duration_alloc
mg_duration* mg_duration_alloc(mg_allocator* alloc)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_duration_copy
mg_duration* mg_duration_copy(mg_duration* duration)
Creates a copy of the given duration.
- mg_duration_days
long mg_duration_days(mg_duration* duration)
Returns the days part of the temporal amount.
- mg_duration_destroy
void mg_duration_destroy(mg_duration* duration)
Destroy the given duration.
- mg_duration_months
long mg_duration_months(mg_duration* duration)
Returns the months part of the temporal amount.
- mg_duration_nanoseconds
long mg_duration_nanoseconds(mg_duration* duration)
Returns the nanoseconds part of the temporal amount.
- mg_duration_seconds
long mg_duration_seconds(mg_duration* duration)
Returns the seconds part of the temporal amount.
- mg_finalize
void mg_finalize()
Finalizes the client (the whole process).
Should be called at the end of each process using the client.
- mg_init
mg_error mg_init()
Initializes the client (the whole process).
Should be called at the beginning of each process using the client.
Return: Zero if initialization was successful.
- mg_list_alloc
mg_list* mg_list_alloc(uint size, mg_allocator* allocator)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_list_append
mg_error mg_list_append(mg_list* list, mg_value* value)
Appends an element at the end of the list list.
- mg_list_at
const(mg_value)* mg_list_at(mg_list* list, uint pos)
Retrieves the element at position pos in list list.
- mg_list_copy
mg_list* mg_list_copy(mg_list* list)
Creates a copy of the given list.
- mg_list_destroy
void mg_list_destroy(mg_list* list)
- mg_list_make_empty
mg_list* mg_list_make_empty(uint capacity)
Constructs a list that can hold at most capacity elements.
- mg_list_size
uint mg_list_size(mg_list* list)
Returns the number of elements in list list.
- mg_local_date_time_alloc
mg_local_date_time* mg_local_date_time_alloc(mg_allocator* alloc)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_local_date_time_copy
mg_local_date_time* mg_local_date_time_copy(mg_local_date_time* local_date_time)
Creates a copy of the given local date and time.
- mg_local_date_time_destroy
void mg_local_date_time_destroy(mg_local_date_time* local_date_time)
Destroy the given local date and time.
- mg_local_date_time_nanoseconds
long mg_local_date_time_nanoseconds(mg_local_date_time* local_date_time)
Returns nanoseconds since midnight.
- mg_local_date_time_seconds
long mg_local_date_time_seconds(mg_local_date_time* local_date_time)
Returns seconds since Unix epoch.
- mg_local_time_alloc
mg_local_time* mg_local_time_alloc(mg_allocator* alloc)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_local_time_copy
mg_local_time* mg_local_time_copy(mg_local_time* local_time)
Creates a copy of the given local time.
- mg_local_time_destroy
void mg_local_time_destroy(mg_local_time* local_time)
Destroys the given local time.
- mg_local_time_nanoseconds
long mg_local_time_nanoseconds(mg_local_time* local_time)
Returns nanoseconds since midnight.
- mg_map_alloc
mg_map* mg_map_alloc(uint size, mg_allocator* allocator)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_map_at
const(mg_value)* mg_map_at(mg_map* map, char* key_str)
Looks up a map value with the given key.
- mg_map_at2
const(mg_value)* mg_map_at2(mg_map* map, uint key_size, char* key_data)
Looks up a map value with the given key.
- mg_map_copy
mg_map* mg_map_copy(mg_map* map)
Creates a copy of the given map.
- mg_map_destroy
void mg_map_destroy(mg_map* map)
- mg_map_insert
mg_error mg_map_insert(mg_map* map, char* key_str, mg_value* value)
Inserts the given key-value pair into the map.
- mg_map_insert2
int mg_map_insert2(mg_map* map, mg_string* key, mg_value* value)
Inserts the given key-value pair into the map.
- mg_map_insert_unsafe
int mg_map_insert_unsafe(mg_map* map, char* key_str, mg_value* value)
Inserts the given key-value pair into the map.
- mg_map_insert_unsafe2
int mg_map_insert_unsafe2(mg_map* map, mg_string* key, mg_value* value)
Inserts the given key-value pair into the map.
- mg_map_key_at
const(mg_string)* mg_map_key_at(mg_map* , uint pos)
Retrieves the key at position pos in map map.
- mg_map_make_empty
mg_map* mg_map_make_empty(uint capacity)
Constructs an empty map that can hold at most capacity key-value pairs.
- mg_map_size
uint mg_map_size(mg_map* map)
Returns the number of key-value pairs in map map.
- mg_map_value_at
const(mg_value)* mg_map_value_at(mg_map* , uint pos)
Retrieves the value at position pos in map map.
- mg_node_alloc
mg_node* mg_node_alloc(uint label_count, mg_allocator* allocator)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_node_copy
mg_node* mg_node_copy(mg_node* node)
Creates a copy of the given node.
- mg_node_destroy
void mg_node_destroy(mg_node* node)
- mg_node_id
long mg_node_id(mg_node* node)
Returns the ID of node node.
- mg_node_label_at
const(mg_string)* mg_node_label_at(mg_node* node, uint pos)
Returns the label at position pos in node node's label list.
- mg_node_label_count
uint mg_node_label_count(mg_node* node)
Returns the number of labels of node node.
- mg_node_properties
const(mg_map)* mg_node_properties(mg_node* node)
Returns property map of node node.
- mg_path_alloc
mg_path* mg_path_alloc(uint node_count, uint relationship_count, uint sequence_length, mg_allocator* allocator)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_path_copy
mg_path* mg_path_copy(mg_path* path)
Creates a copy of the given path.
- mg_path_destroy
void mg_path_destroy(mg_path* path)
- mg_path_length
uint mg_path_length(mg_path* path)
Returns the length (the number of edges) of path path.
- mg_path_node_at
const(mg_node)* mg_path_node_at(mg_path* path, uint pos)
Returns the node at position pos in the traversal of path path.
- mg_path_relationship_at
const(mg_unbound_relationship)* mg_path_relationship_at(mg_path* path, uint pos)
Returns the relationship at position pos in traversal of path path.
- mg_path_relationship_reversed_at
int mg_path_relationship_reversed_at(mg_path* path, uint pos)
Checks if the relationship at position pos in traversal of path path
is reversed.
- mg_point_2d_alloc
mg_point_2d* mg_point_2d_alloc(mg_allocator* allocator)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_point_2d_copy
mg_point_2d* mg_point_2d_copy(mg_point_2d* point_2d)
Creates a copy of the given 2D point.
- mg_point_2d_destroy
void mg_point_2d_destroy(mg_point_2d* point_2d)
Destroys the given 2D point.
- mg_point_2d_srid
long mg_point_2d_srid(mg_point_2d* point_2d)
Returns SRID of the 2D point.
- mg_point_2d_x
double mg_point_2d_x(mg_point_2d* point_2d)
Returns the x coordinate of the 2D point.
- mg_point_2d_y
double mg_point_2d_y(mg_point_2d* point_2d)
Returns the y coordinate of the 2D point.
- mg_point_3d_alloc
mg_point_3d* mg_point_3d_alloc(mg_allocator* allocator)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_point_3d_copy
mg_point_3d* mg_point_3d_copy(mg_point_3d* point_3d)
Creates a copy of the given 3D point.
- mg_point_3d_destroy
void mg_point_3d_destroy(mg_point_3d* point_3d)
Destroys the given 3D point.
- mg_point_3d_srid
long mg_point_3d_srid(mg_point_3d* point_3d)
Returns SRID of the 3D point.
- mg_point_3d_x
double mg_point_3d_x(mg_point_3d* point_3d)
Returns the x coordinate of the 3D point.
- mg_point_3d_y
double mg_point_3d_y(mg_point_3d* point_3d)
Returns the y coordinate of the 3D point.
- mg_point_3d_z
double mg_point_3d_z(mg_point_3d* point_3d)
Returns the z coordinate of the 3D point.
- mg_relationship_copy
mg_relationship* mg_relationship_copy(mg_relationship* rel)
Creates a copy of the given relationship.
- mg_relationship_destroy
void mg_relationship_destroy(mg_relationship* rel)
Destroys the given relationship.
- mg_relationship_end_id
long mg_relationship_end_id(mg_relationship* rel)
Returns the ID of the end node of relationship rel.
- mg_relationship_id
long mg_relationship_id(mg_relationship* rel)
Returns the ID of the relationship rel.
- mg_relationship_properties
const(mg_map)* mg_relationship_properties(mg_relationship* rel)
Returns the property map of the relationship rel.
- mg_relationship_start_id
long mg_relationship_start_id(mg_relationship* rel)
Returns the ID of the start node of relationship rel.
- mg_relationship_type
const(mg_string)* mg_relationship_type(mg_relationship* rel)
Returns the type of the relationship rel.
- mg_result_columns
const(mg_list)* mg_result_columns(mg_result* result)
Returns names of columns output by the current query execution.
- mg_result_row
const(mg_list)* mg_result_row(mg_result* result)
Returns column values of current result row.
- mg_result_summary
const(mg_map)* mg_result_summary(mg_result* result)
Returns query execution summary.
- mg_session_begin_transaction
int mg_session_begin_transaction(mg_session* session, mg_map* extra_run_information)
Starts an Explicit transaction on the server.
- mg_session_commit_transaction
int mg_session_commit_transaction(mg_session* session, mg_result** result)
Commits current Explicit transaction.
- mg_session_destroy
void mg_session_destroy(mg_session* session)
Destroys a mg_session and releases all of its resources.
- mg_session_error
const(char)* mg_session_error(mg_session* session)
Obtains the error message stored in mg_session (if any).
- mg_session_fetch
int mg_session_fetch(mg_session* session, mg_result** result)
Tries to fetch the next query result from mg_session.
- mg_session_params_destroy
void mg_session_params_destroy(mg_session_params* )
Destroys a mg_session_params object.
- mg_session_params_get_address
const(char)* mg_session_params_get_address(mg_session_params* )
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_get_host
const(char)* mg_session_params_get_host(mg_session_params* )
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_get_password
const(char)* mg_session_params_get_password(mg_session_params* )
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_get_port
ushort mg_session_params_get_port(mg_session_params* )
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_get_sslcert
const(char)* mg_session_params_get_sslcert(mg_session_params* )
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_get_sslkey
const(char)* mg_session_params_get_sslkey(mg_session_params* )
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_get_sslmode
mg_sslmode mg_session_params_get_sslmode(mg_session_params* )
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_get_trust_callback
mg_trust_callback_type mg_session_params_get_trust_callback(mg_session_params* params)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_get_trust_data
void* mg_session_params_get_trust_data(mg_session_params* )
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_get_user_agent
const(char)* mg_session_params_get_user_agent(mg_session_params* )
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_get_username
const(char)* mg_session_params_get_username(mg_session_params* )
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_make
mg_session_params* mg_session_params_make()
Creates a new mg_session_params object.
- mg_session_params_set_address
void mg_session_params_set_address(mg_session_params* , char* address)
Getters and setters for mg_session_params values.
- mg_session_params_set_host
void mg_session_params_set_host(mg_session_params* , char* host)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_set_password
void mg_session_params_set_password(mg_session_params* , char* password)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_set_port
void mg_session_params_set_port(mg_session_params* , ushort port)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_set_sslcert
void mg_session_params_set_sslcert(mg_session_params* , char* sslcert)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_set_sslkey
void mg_session_params_set_sslkey(mg_session_params* , char* sslkey)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_set_sslmode
void mg_session_params_set_sslmode(mg_session_params* , mg_sslmode sslmode)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_set_trust_callback
void mg_session_params_set_trust_callback(mg_session_params* , mg_trust_callback_type trust_callback)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_set_trust_data
void mg_session_params_set_trust_data(mg_session_params* , void* trust_data)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_set_user_agent
void mg_session_params_set_user_agent(mg_session_params* , char* user_agent)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_params_set_username
void mg_session_params_set_username(mg_session_params* , char* username)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_session_pull
int mg_session_pull(mg_session* session, mg_map* pull_information)
Tries to pull results of a statement.
- mg_session_rollback_transaction
int mg_session_rollback_transaction(mg_session* session, mg_result** result)
Rollbacks current Explicit transaction.
- mg_session_run
int mg_session_run(mg_session* session, char* query, mg_map* params, mg_map* extra_run_information, mg_list** columns, long* qid)
Submits a query to the server for execution.
- mg_session_status
mg_session_code mg_session_status(mg_session* session)
Returns the status of mg_session.
- mg_string_alloc
mg_string* mg_string_alloc(uint size, mg_allocator* allocator)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_string_copy
mg_string* mg_string_copy(mg_string* str)
Creates a copy of the given string.
- mg_string_data
const(char)* mg_string_data(mg_string* str)
Returns a pointer to the beginning of data buffer of string str.
- mg_string_destroy
void mg_string_destroy(mg_string* str)
Destroys the given string.
- mg_string_make
mg_string* mg_string_make(char* str)
Constructs a string given a null-terminated string.
- mg_string_make2
mg_string* mg_string_make2(uint len, char* data)
Constructs a string given its length (in bytes) and contents.
- mg_string_size
uint mg_string_size(mg_string* str)
Returns the length (in bytes) of string str.
- mg_time_alloc
mg_time* mg_time_alloc(mg_allocator* alloc)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
- mg_time_copy
mg_time* mg_time_copy(mg_time* time)
Creates a copy of the given time.
- mg_time_destroy
void mg_time_destroy(mg_time* time)
- mg_time_nanoseconds
long mg_time_nanoseconds(mg_time* time)
Returns nanoseconds since midnight.
- mg_time_tz_offset_seconds
long mg_time_tz_offset_seconds(mg_time* time)
Returns time zone offset in seconds from UTC.
- mg_unbound_relationship_copy
mg_unbound_relationship* mg_unbound_relationship_copy(mg_unbound_relationship* rel)
Creates a copy of the given unbound relationship.
- mg_unbound_relationship_destroy
void mg_unbound_relationship_destroy(mg_unbound_relationship* rel)
Destroys the given unbound relationship.
- mg_unbound_relationship_id
long mg_unbound_relationship_id(mg_unbound_relationship* rel)
Returns the ID of the unbound relationship rel.
- mg_unbound_relationship_properties
const(mg_map)* mg_unbound_relationship_properties(mg_unbound_relationship* rel)
Returns the property map of the unbound relationship rel.
- mg_unbound_relationship_type
const(mg_string)* mg_unbound_relationship_type(mg_unbound_relationship* rel)
Returns the type of the unbound relationship rel.
- mg_value_bool
bool mg_value_bool(mg_value* val)
Returns non-zero value if value contains true, zero otherwise.
- mg_value_copy
mg_value* mg_value_copy(mg_value* val)
Creates a copy of the given value.
- mg_value_date
const(mg_date)* mg_value_date(mg_value* val)
Returns the underlying mg_date value.
- mg_value_date_time
const(mg_date_time)* mg_value_date_time(mg_value* val)
Returns the underlying mg_date_time value.
- mg_value_date_time_zone_id
const(mg_date_time_zone_id)* mg_value_date_time_zone_id(mg_value* val)
Returns the underlying mg_date_time_zone_id value.
- mg_value_destroy
void mg_value_destroy(mg_value* val)
Destroys the given value.
- mg_value_duration
const(mg_duration)* mg_value_duration(mg_value* val)
Returns the underlying mg_duration value.
- mg_value_float
double mg_value_float(mg_value* val)
Returns the underlying float value.
- mg_value_get_type
mg_value_type mg_value_get_type(mg_value* val)
Returns the type of the given mg_value.
- mg_value_integer
long mg_value_integer(mg_value* val)
Returns the underlying integer value.
- mg_value_list
const(mg_list)* mg_value_list(mg_value* val)
Returns the underlying mg_list value.
- mg_value_local_date_time
const(mg_local_date_time)* mg_value_local_date_time(mg_value* val)
Returns the underlying mg_local_date_time value.
- mg_value_local_time
const(mg_local_time)* mg_value_local_time(mg_value* val)
Returns the underlying mg_local_time value.
- mg_value_make_bool
mg_value* mg_value_make_bool(int val)
Constructs a boolean mg_value.
- mg_value_make_date
mg_value* mg_value_make_date(mg_date* date)
Constructs a date mg_value given the underlying mg_date.
- mg_value_make_date_time
mg_value* mg_value_make_date_time(mg_date_time* date_time)
Constructs a date and time mg_value given the underlying mg_date_time.
- mg_value_make_date_time_zone_id
mg_value* mg_value_make_date_time_zone_id(mg_date_time_zone_id* date_time_zone_id)
Constructs a date and time mg_value given the underlying mg_date_time_zone_id.
- mg_value_make_duration
mg_value* mg_value_make_duration(mg_duration* duration)
Constructs a duration mg_value given the underlying mg_duration.
- mg_value_make_float
mg_value* mg_value_make_float(double val)
Constructs a float mg_value with the given underlying value.
- mg_value_make_integer
mg_value* mg_value_make_integer(long val)
Constructs an integer mg_value with the given underlying value.
- mg_value_make_list
mg_value* mg_value_make_list(mg_list* list)
Constructs a list mg_value given the underlying mg_list.
- mg_value_make_local_date_time
mg_value* mg_value_make_local_date_time(mg_local_date_time* local_date_time)
Constructs a local date and time mg_value given the underlying mg_local_date_time.
- mg_value_make_local_time
mg_value* mg_value_make_local_time(mg_local_time* local_time)
Constructs a local time mg_value given the underlying mg_local_time.
- mg_value_make_map
mg_value* mg_value_make_map(mg_map* map)
Constructs a map mg_value given the underlying mg_map.
- mg_value_make_node
mg_value* mg_value_make_node(mg_node* node)
Constructs a node mg_value given the underlying mg_node.
- mg_value_make_null
mg_value* mg_value_make_null()
Constructs a nil mg_value.
- mg_value_make_path
mg_value* mg_value_make_path(mg_path* path)
Constructs a path mg_value given the underlying mg_path.
- mg_value_make_point_2d
mg_value* mg_value_make_point_2d(mg_point_2d* point_2d)
Constructs a 2D point mg_value given the underlying mg_point_2d.
- mg_value_make_point_3d
mg_value* mg_value_make_point_3d(mg_point_3d* point_3d)
Constructs a 3D point mg_value given the underlying mg_point_3d.
- mg_value_make_relationship
mg_value* mg_value_make_relationship(mg_relationship* rel)
Constructs a relationship mg_value given the underlying
mg_relationship.
- mg_value_make_string
mg_value* mg_value_make_string(char* str)
Constructs a string mg_value given a null-terminated string.
- mg_value_make_string2
mg_value* mg_value_make_string2(mg_string* str)
Construct a string mg_value given the underlying mg_string.
- mg_value_make_time
mg_value* mg_value_make_time(mg_time* time)
Constructs a time mg_value given the underlying mg_time.
- mg_value_make_unbound_relationship
mg_value* mg_value_make_unbound_relationship(mg_unbound_relationship* rel)
Constructs an unbound relationship mg_value given the underlying
mg_unbound_relationship.
- mg_value_map
const(mg_map)* mg_value_map(mg_value* val)
Returns the underlying mg_map value.
- mg_value_node
const(mg_node)* mg_value_node(mg_value* val)
Returns the underlying mg_node value.
- mg_value_path
const(mg_path)* mg_value_path(mg_value* val)
Returns the underlying mg_path value.
- mg_value_point_2d
const(mg_point_2d)* mg_value_point_2d(mg_value* val)
Returns the underlying mg_point_2d value.
- mg_value_point_3d
const(mg_point_3d)* mg_value_point_3d(mg_value* val)
Returns the underlying mg_point_3d value.
- mg_value_relationship
const(mg_relationship)* mg_value_relationship(mg_value* val)
Returns the underlying mg_relationship value.
- mg_value_string
const(mg_string)* mg_value_string(mg_value* val)
Returns the underlying mg_string value.
- mg_value_time
const(mg_time)* mg_value_time(mg_value* val)
Returns the underlying mg_time value.
- mg_value_unbound_relationship
const(mg_unbound_relationship)* mg_value_unbound_relationship(mg_value* val)
Returns the underlying mg_unbound_relationship value.
C API interface to the memgraph mgclient library.
Provides mg_session, a data type representing a connection to Bolt server, along with functions for connecting to Bolt database and executing queries against it, and mg_value, a data type representing a value in Bolt protocol along with supporting types and manipulation functions for them.
mg_session is an opaque data type representing a connection to Bolt server. Commands can be submitted for execution using mg_session_run and results can be obtained using mg_session_pull. A mg_session can execute at most one command at a time, and all results should be consumed before trying to execute the next query.
The usual flow for execution of a single query would be the following:
1. Submit the command for execution using mg_session_run.
2. Call mg_session_pull until it returns 0 to consume result rows and access result values using mg_result_row.
3. If necessary, access command execution summary using mg_result_summary.
If any of the functions returns an error exit code, more detailed error message can be obtained by calling mg_session_error.
mg_value is an opaque data type representing an arbitrary value of any of the types specified by the Bolt protocol. It can encapsulate any of its supporting types: mg_string, mg_list, mg_map, mg_node, mg_relationship, mg_unbound_relationship and mg_path. Provided along with them are basic manipulation functions for those data types. The API for most of data types is quite rudimentary, and as such is not usable for complex operations on strings, maps, lists, etc. It is only supposed to be used to construct data to be sent to the Bolt server, and read data obtained from the Bolt server.
Each object has a corresponding mg_*_destroy function that should be invoked on the object at the end of its lifetime to free the resources allocated for its storage. Each object has an owner, that is responsible for its destruction. Object can be owned by the API client or by another object. When being destroyed, an object will also destroy all other objects it owns. Therefore, API client is only responsible for destroying the object it directly owns. For example, if the API client constructed a mg_list value and inserted some other mg_value objects into it, they must only invoke mg_list_destroy on the list and all of its members will be properly destroyed, because the list owns all of its elements. Invoking mg_*_destroy on objects that are not owned by the caller will usually result in memory corruption, double freeing, nuclear apocalypse and similar unwanted behaviors. Therefore, object ownership should be tracked carefully.
Invoking certain functions on objects might cause ownership changes. Obviously, you shouldn't pass objects you don't own to functions that steal ownership.
Function signatures are of big help in ownership tracking. Now follow two simple rules, all functions that do not conform to those rules (if any) will explicitly specify that in their documentation.
1. Return values
Functions that return a non-const pointer to an object give ownership of the returned object to the caller. Examples are: - creation functions (e.g. mg_list_make_empty). - copy functions (e.g. mg_value_copy). - mg_connect has a mg_session ** output parameter because the API client becomes the owner of the mg_session object
Functions that return a const pointer to a object provide read-only access to the returned object that is valid only while the owning object is alive. Examples are: - access functions on mg_value (e.g. mg_value_list). - member access functions on containers (e.g. mg_map_key_at, mg_list_at, mg_map_at). - field access functions on graph types (e.g. mg_node_properties). - mg_session_pull has a const mg_result ** output parameter, because the mg_session object keeps ownership of the returned result and destroys it on next pull
2. Function arguments
Functions that take a non-const pointer to a object either modify it or change its ownership (it is usually obvious what happens). Examples are: - member insert functions on containers transfer the ownership of inserted values to the container. They also take a non-const pointer to the container because they modify it. Ownership of the container is not changed (e.g. mg_map_insert takes ownership of the passed key and value). - mg_session_run takes a non-const pointer to the session because it modifies it internal state, but there is no ownership change
An obvious exception here are mg_*_destroy functions which do not change ownership of the object.
Functions that take a const pointer to a object do not change the owner of the passed object nor they modify it. Examples are: - member access functions on containers take const pointer to the container (e.g. mg_list_at, mg_map_at, ...). - member access functions on graph types take const pointer to the container (e.g. mg_path_node_at, mg_node_label_count, ...). - copy functions.