| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | None |
| 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 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)
- type family ResolveRelationMethod (t :: Symbol) o where ...
- data RelationCountMethodInfo
- relationCount :: (HasCallStack, MonadIO m) => Relation -> Ptr () -> Int32 -> m Int32
- data RelationDeleteMethodInfo
- relationDelete :: (HasCallStack, MonadIO m) => Relation -> Ptr () -> Int32 -> m Int32
- data RelationDestroyMethodInfo
- relationDestroy :: (HasCallStack, MonadIO m) => Relation -> m ()
- data RelationPrintMethodInfo
- relationPrint :: (HasCallStack, MonadIO m) => Relation -> m ()
Exported types
Memory-managed wrapper type.
Constructors
| Relation (ManagedPtr Relation) |
Instances
Methods
Click to display all available methods, including inherited ones
type family ResolveRelationMethod (t :: Symbol) o where ... Source #
Equations
| ResolveRelationMethod "count" o = RelationCountMethodInfo | |
| ResolveRelationMethod "delete" o = RelationDeleteMethodInfo | |
| ResolveRelationMethod "destroy" o = RelationDestroyMethodInfo | |
| ResolveRelationMethod "print" o = RelationPrintMethodInfo | |
| ResolveRelationMethod l o = MethodResolutionFailed l o :: Type |
count
data RelationCountMethodInfo Source #
Instances
| (signature ~ (Ptr () -> Int32 -> m Int32), MonadIO m) => OverloadedMethod RelationCountMethodInfo Relation signature Source # | |
Defined in GI.GLib.Structs.Relation Methods overloadedMethod :: Relation -> signature # | |
| OverloadedMethodInfo RelationCountMethodInfo Relation Source # | |
Defined in GI.GLib.Structs.Relation Methods | |
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
data RelationDeleteMethodInfo Source #
Instances
| (signature ~ (Ptr () -> Int32 -> m Int32), MonadIO m) => OverloadedMethod RelationDeleteMethodInfo Relation signature Source # | |
Defined in GI.GLib.Structs.Relation Methods overloadedMethod :: Relation -> signature # | |
| OverloadedMethodInfo RelationDeleteMethodInfo Relation Source # | |
Defined in GI.GLib.Structs.Relation Methods | |
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
data RelationDestroyMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m) => OverloadedMethod RelationDestroyMethodInfo Relation signature Source # | |
Defined in GI.GLib.Structs.Relation Methods overloadedMethod :: Relation -> signature # | |
| OverloadedMethodInfo RelationDestroyMethodInfo Relation Source # | |
Defined in GI.GLib.Structs.Relation Methods | |
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.
data RelationPrintMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m) => OverloadedMethod RelationPrintMethodInfo Relation signature Source # | |
Defined in GI.GLib.Structs.Relation Methods overloadedMethod :: Relation -> signature # | |
| OverloadedMethodInfo RelationPrintMethodInfo Relation Source # | |
Defined in GI.GLib.Structs.Relation Methods | |
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.