generic-persistence-0.3.0.1: Database persistence using generics
Safe HaskellSafe-Inferred
LanguageGHC2021

Database.GP.SqlGenerator

Synopsis

Documentation

insertStmtFor :: forall a. Entity a => String Source #

This module defines some basic SQL statements for Record Data Types that are instances of Entity. 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");

updateStmtFor :: forall a. Entity a => String Source #

A function that returns an SQL update statement for an entity. Type a must be an instance of Entity.

selectStmtFor :: forall a. Entity a => String Source #

A function that returns an SQL select statement for entity type a with primary key id.

deleteStmtFor :: forall a. Entity a => String Source #