h)>;      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~0.4.0.0  Safe-Inferred generic-persistenceA pool of connections.generic-persistence/An enumeration of the supported database types.generic-persistenceThis module defines a wrapper around an HDBC IConnection. Using this wrapper 2 simplifies the signature of the functions in the    module. It allows to use any HDBC connection without having to define a new function for each connection type. It also provides additional attributes to the connection, like the database type and the implicit commit flag. These attributes can be used to implement database specific functionality, modify transaction behaviour, etc.This code has been inspired by the HDBC ConnectionWrapper and some parts have been copied verbatim from the HDBC Database.HDBC.Types module.This module also defines a ConnectionPool type, which provides basic connection pooling functionality.%A wrapper around an HDBC IConnection. generic-persistenceThe database type generic-persistenceIf True, the GenericPersistence functions will commit the transaction after each operation. generic-persistenceThe wrapped connection generic-persistence&a smart constructor for the Conn type.generic-persistence.allows to execute a function that requires an  argument on a .generic-persistenceCreates a connection pool.generic-persistencemanually implement the IConnection type class for the Conn type.generic-persistence.the database type e.g. Postgres, MySQL, SQLitegeneric-persistencethe connection stringgeneric-persistencea function that takes a connection string and returns an IConnectiongeneric-persistence3the time (in seconds) to keep idle connections opengeneric-persistence.the maximum number of connections to keep opengeneric-persistencethe resulting connection pool   Safe-Inferred generic-persistenceA data type holding meta-data about a type. The Phantom type parameter a ensures type safety for reflective functions that use this type to create type instances.generic-persistencethis function is a smart constructor for TypeInfo objects. It takes a value of type a and returns a `TypeInfo a` object. If the type has no named fields, an error is thrown. If the type has more than one constructor, an error is thrown.   Safe-Inferred1<I (generic-persistenceThis is the Entity class. It is a type class that is used to define the mapping between a Haskell product type in record notation and a database table. The class has a default implementation for all methods. The default implementation uses the type information to determine a simple 1:1 mapping.That means that - the type name is used as the table name and the - field names are used as the column names. - A field named ' lowercasetypeName%ID' is used as the primary key field.The default implementation can be overridden by defining a custom instance for a type.Please note the following constraints, which apply to all valid Entity type, but that are not explicitely encoded in the type class definition:3The type must be a product type in record notation.+The type must have exactly one constructor.There must be single primary key field, compund primary keys are not supported.)generic-persistence+Converts a database row to a value of type a.*generic-persistenceConverts a value of type a to a database row.+generic-persistence5Returns the name of the primary key field for a type a.,generic-persistenceReturns a list of tuples that map field names to column names for a type a.-generic-persistence)Returns the name of the table for a type a..generic-persistenceA convenience function: returns the name of the column for a field of a type a.0generic-persistence3Returns a string representation of a value of type a.8generic-persistenceThis instance is the most interesting one. It splits the list of s into two parts, one for the first field and one for the rest. Then it uses the % instance for the first field to convert the first part of the list and the % instance for the rest of the fields to convert the second part of the list. Finally, it combines the two results using the  constructor. https://stackoverflow.com/questions/75485429/how-to-use-ghc-generics-to-convert-from-product-data-types-to-a-list-of-sqlvalue/75485650#75485650(+)*,-.0&'%/ (+)*,-.0'&%/  Safe-Inferred9:;MO<=>?@ABCDEFGHIPLJNK9:;MO<=>?@ABCDEFGHIPLJNK <3=2>4?4@4A4B4C4D4E4F4G4 Safe-InferredWgeneric-persistenceThis module defines some basic SQL statements for Record Data Types that are instances of (. The SQL statements are generated using Haskell generics to provide compile time reflection capabilities.A function that returns an SQL insert statement for an entity. Type a must be an instance of Data. The function will use the field names of the data type to generate the column names in the insert statement. The values of the fields will be used as the values in the insert statement. Output example: INSERT INTO Person (id, name, age, address) VALUES (123456, Alice, 25, "123 Main St");Xgeneric-persistenceA function that returns an SQL update statement for an entity. Type a must be an instance of Entity.Ygeneric-persistenceA function that returns an SQL select statement for an entity. Type a must be an instance of Entity. The function takes a where clause expression as parameter. This expression is used to filter the result set.generic-persistenceA function that returns the column type for a field of an entity. TODO: Support other databases than just SQLite.WXYZ[\9:;O<=>?@ABCDEFGHILJKWXYZ[\9:;O<=>?@ABCDEFGHILJK Safe-Inferred=)]generic-persistenceThis is the "safe" version of the module Database.GP.GenericPersistence. It uses Either to return errors.This module defines RDBMS Persistence operations for Record Data Types that are instances of Data1. I call instances of such a data type Entities.The Persistence operations are using Haskell generics to provide compile time reflection capabilities. HDBC is used to access the RDBMS.7exceptions that may occur during persistence operationsbgeneric-persistenceA function that retrieves an entity from a database. The function takes entity id as parameter. If an entity with the given id exists in the database, it is returned as a Just value. If no such entity exists, Nothing is returned. An error is thrown if there are more than one entity with the given id.cgeneric-persistence-This function retrieves all entities of type a that match some query criteria. The function takes an HDBC connection and a 9 as parameters. The type a is determined by the context of the function call. The function returns a (possibly empty) list of all matching entities. The 9 is typically constructed using any tiny query dsl based on infix operators.dgeneric-persistenceThis function converts a list of database rows, represented as a `[[SqlValue]]` to a list of entities. The function takes an HDBC connection and a list of database rows as parameters. The type a is determined by the context of the function call. The function returns a (possibly empty) list of all matching entities. The function is used internally by  retrieveAll and retrieveAllWhere. But it can also be used to convert the result of a custom SQL query to a list of entities.egeneric-persistenceA function that persists an entity to a database. The function takes an HDBC connection and an entity as parameters. The entity is either inserted or updated, depending on whether it already exists in the database. The required SQL statements are generated dynamically using Haskell generics and reflectionfgeneric-persistence>A function that explicitely inserts an entity into a database.ggeneric-persistenceA function that inserts a list of entities into a database. The function takes an HDBC connection and a list of entities as parameters. The insert-statement is compiled only once and then executed for each entity.hgeneric-persistence?@ABCDEFGHILJKbcdefghijklm (+)*,-&%./0]^_`a9:;<=>?@ABCDEFGHILJK Safe-Inferred:p sgeneric-persistenceThis module defines RDBMS Persistence operations for Record Data Types that are instances of Data1. I call instances of such a data type Entities.The Persistence operations are using Haskell generics to provide compile time reflection capabilities. HDBC is used to access the RDBMS.A function that retrieves an entity from a database. The function takes entity id as parameter. If an entity with the given id exists in the database, it is returned as a Just value. If no such entity exists, Nothing is returned. An error is thrown if there are more than one entity with the given id.tgeneric-persistence-This function retrieves all entities of type a from a database. The function takes an HDBC connection as parameter. The type a is determined by the context of the function call. retrieveAll :: forall a. (Entity a) => Conn -> IO [a] retrieveAll conn = do eitherExRow <- GpSafe.retrieveAll @a conn case eitherExRow of Left ex -> throw ex Right rows -> pure rows-This function retrieves all entities of type a that match some query criteria. The function takes an HDBC connection and a 9 as parameters. The type a is determined by the context of the function call. The function returns a (possibly empty) list of all matching entities. The 9 is typically constructed using any tiny query dsl based on infix operators.ugeneric-persistenceThis function converts a list of database rows, represented as a `[[SqlValue]]` to a list of entities. The function takes an HDBC connection and a list of database rows as parameters. The type a is determined by the context of the function call. The function returns a (possibly empty) list of all matching entities. The function is used internally by  retrieveAll and retrieveAllWhere. But it can also be used to convert the result of a custom SQL query to a list of entities.vgeneric-persistenceA function that persists an entity to a database. The function takes an HDBC connection and an entity as parameters. The entity is either inserted or updated, depending on whether it already exists in the database. The required SQL statements are generated dynamically using Haskell generics and reflectionwgeneric-persistence>A function that explicitely inserts an entity into a database.xgeneric-persistenceA function that inserts a list of entities into a database. The function takes an HDBC connection and a list of entities as parameters. The insert-statement is compiled only once and then executed for each entity.ygeneric-persistence?@ABCDEFGHILJKstuvwxyz{|}~ (+)*,-&%./0]^_`a9:;<=>?@ABCDEFGHILJK  Safe-Inferred; stuvwxyz{|}~ (+)*,-&%./0]^_`a9:;<=>?@ABCDEFGHILJstuvwxyz{|}~ (+)*,-&%./0]^_`a9:;<=>?@ABCDEFGHILJ  Safe-Inferred;   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~opqrstuvwxyz        #generic-persistence-0.4.0.0-inplaceDatabase.GP.ConnDatabase.GP.TypeInfoDatabase.GP.EntityDatabase.GP.QueryDatabase.GP.SqlGenerator"Database.GP.GenericPersistenceSafeDatabase.GP.GenericPersistencegeneric-persistenceDatabaseGP Database.GPPaths_generic_persistencersrc-pl-0.4.0.0-c1e48853 Data.Pool withResourceConnectionPoolPostgresMySQLSQLiteOracleMSSQLConndbimplicitCommit connectionconnectcreateConnPool$fIConnectionConn$fShowDatabase $fEqDatabase$fEnumDatabase HasSelectors selectorsHasConstructorgenericConstrNameTypeInfoconstructorName fieldNames fieldTypestypeInfo$fHasConstructorM1$fHasConstructor:+:$fHasConstructorM10$fHasSelectorsFUNU1$fHasSelectorsFUN:*:$fHasSelectorsFUNM1$fHasSelectorsFUNM10$fHasSelectorsFUNM11$fShowTypeInfoGFromRowGToRowgtoRowEntityfromRowtoRowidFieldfieldsToColumns tableName columnNameFormaybeFieldTypeFortoString $fGToRowkM1 $fGToRowk:*: $fGToRowkK1 $fGToRowkU1 $fGFromRowkM1 $fGFromRowkK1 $fGFromRowkU1$fGFromRowTYPE:*:WhereClauseExprFieldfield&&.||.=.>.<.>=.<=.<>.likecontainsbetweenin'isNullnot' allEntriesbyIdsqlFunwhereClauseExprToSqlidColumnwhereClauseValuesparams$fShowWhereClauseExpr$fEqWhereClauseExpr $fShowField $fEqField$fShowCompareOp $fEqCompareOp insertStmtFor updateStmtForselectFromStmt deleteStmtForcreateTableStmtFordropTableStmtForPersistenceExceptionEntityNotFoundDuplicateInsert DatabaseError NoUniqueKey selectByIdselectentitiesFromRowspersistinsert insertManyupdate updateManydelete deleteMany setupTableForidValue$fConvertibleaSqlValue$fConvertibleSqlValuea$fShowPersistenceException$fEqPersistenceException$fExceptionPersistenceException withWConnHDBC-2.4.0.4-5c3a3ab2Database.HDBC.Types IConnectionDatabase.HDBC.SqlValueSqlValuebase GHC.Generics:*: columnTypeFor fieldIndexversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDirgetDataFileName getSysconfDir