Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
GI.GLib.Structs.Relation
Description
A GRelation
is a table of data which can be indexed on any number
of fields, rather like simple database tables. A GRelation
contains
a number of records, called tuples. Each record contains a number of
fields. Records are not ordered, so it is not possible to find the
record at a particular index.
Note that GRelation
tables are currently limited to 2 fields.
To create a GRelation
, use [funcgLib
.Relation.new].
To specify which fields should be indexed, use Relation
.index
().
Note that this must be called before any tuples are added to the
GRelation
.
To add records to a GRelation
use Relation
.insert
().
To determine if a given record appears in a GRelation
, use
Relation
.exists
(). Note that fields are compared directly, so
pointers must point to the exact same position (i.e. different
copies of the same string will not match.)
To count the number of records which have a particular value in a
given field, use relationCount
.
To get all the records which have a particular value in a given
field, use Relation
.select
(). To access fields of the resulting
records, use tuplesIndex
. To free the resulting records use
tuplesDestroy
.
To delete all records which have a particular value in a given
field, use relationDelete
.
To destroy the GRelation
, use relationDestroy
.
To help debug GRelation
objects, use relationPrint
.
GRelation
has been marked as deprecated, since this API has never
been fully implemented, is not very actively maintained and rarely
used.
Synopsis
- newtype Relation = Relation (ManagedPtr Relation)
- relationCount :: (HasCallStack, MonadIO m) => Relation -> Ptr () -> Int32 -> m Int32
- relationDelete :: (HasCallStack, MonadIO m) => Relation -> Ptr () -> Int32 -> m Int32
- relationDestroy :: (HasCallStack, MonadIO m) => Relation -> m ()
- relationPrint :: (HasCallStack, MonadIO m) => Relation -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq Relation Source # | |
BoxedPtr Relation Source # | |
Defined in GI.GLib.Structs.Relation | |
ManagedPtrNewtype Relation Source # | |
Defined in GI.GLib.Structs.Relation Methods toManagedPtr :: Relation -> ManagedPtr Relation |
Methods
Click to display all available methods, including inherited ones
count
Arguments
:: (HasCallStack, MonadIO m) | |
=> Relation |
|
-> Ptr () |
|
-> Int32 |
|
-> m Int32 | Returns: the number of matches. |
Deprecated: (Since version 2.26)Rarely used API
Returns the number of tuples in a Relation
that have the given
value in the given field.
delete
Arguments
:: (HasCallStack, MonadIO m) | |
=> Relation |
|
-> Ptr () |
|
-> Int32 |
|
-> m Int32 | Returns: the number of records deleted. |
Deprecated: (Since version 2.26)Rarely used API
Deletes any records from a Relation
that have the given key value
in the given field.
destroy
Arguments
:: (HasCallStack, MonadIO m) | |
=> Relation |
|
-> m () |
Deprecated: (Since version 2.26)Rarely used API
Destroys the Relation
, freeing all memory allocated. However, it
does not free memory allocated for the tuple data, so you should
free that first if appropriate.
Arguments
:: (HasCallStack, MonadIO m) | |
=> Relation |
|
-> m () |
Deprecated: (Since version 2.26)Rarely used API
Outputs information about all records in a Relation
, as well as
the indexes. It is for debugging.