Hoogle Search

Within LTS Haskell 24.41 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. newtype EntityWithPrefix (prefix :: Symbol) record

    persistent Database.Persist.Sql

    This newtype wrapper is useful when selecting an entity out of the database and you want to provide a prefix to the table being selected. Consider this raw SQL query:

    SELECT ??
    FROM my_long_table_name AS mltn
    INNER JOIN other_table AS ot
    ON mltn.some_col = ot.other_col
    WHERE ...
    
    We don't want to refer to my_long_table_name every time, so we create an alias. If we want to select it, we have to tell the raw SQL quasi-quoter that we expect the entity to be prefixed with some other name. We can give the above query a type with this, like:
    getStuff :: SqlPersistM [EntityWithPrefix "mltn" MyLongTableName]
    getStuff = rawSql queryText []
    
    The EntityWithPrefix bit is a boilerplate newtype wrapper, so you can remove it with unPrefix, like this:
    getStuff :: SqlPersistM [Entity MyLongTableName]
    getStuff = unPrefix @"mltn" <$> rawSql queryText []
    
    The symbol is a "type application" and requires the TypeApplications@ language extension.

  2. EntityWithPrefix :: Entity record -> EntityWithPrefix (prefix :: Symbol) record

    persistent Database.Persist.Sql

    No documentation available.

  3. data FilterTablePrefix

    persistent Database.Persist.Sql

    Used when determining how to prefix a column name in a WHERE clause.

  4. PrefixExcluded :: FilterTablePrefix

    persistent Database.Persist.Sql

    Prefix the column name with the EXCLUDED keyword. This is used with the Postgresql backend when doing ON CONFLICT DO UPDATE clauses - see the documentation on upsertWhere and upsertManyWhere.

  5. PrefixTableName :: FilterTablePrefix

    persistent Database.Persist.Sql

    Prefix the column with the table name. This is useful if the column name might be ambiguous.

  6. unEntityWithPrefix :: EntityWithPrefix (prefix :: Symbol) record -> Entity record

    persistent Database.Persist.Sql

    No documentation available.

  7. unPrefix :: forall (prefix :: Symbol) record . EntityWithPrefix prefix record -> Entity record

    persistent Database.Persist.Sql

    A helper function to tell GHC what the EntityWithPrefix prefix should be. This allows you to use a type application to specify the prefix, instead of specifying the etype on the result. As an example, here's code that uses this:

    myQuery :: SqlPersistM [Entity Person]
    myQuery = fmap (unPrefix @"p") $ rawSql query []
    where
    query = "SELECT ?? FROM person AS p"
    

  8. mpsPrefixFields :: MkPersistSettings -> Bool

    persistent Database.Persist.TH

    Prefix field names with the model name. Default: True. Note: this field is deprecated. Use the mpsFieldLabelModifier and mpsConstraintLabelModifier instead.

  9. mpsPrefixFields :: MkPersistSettings -> Bool

    persistent Database.Persist.TH.Internal

    Prefix field names with the model name. Default: True. Note: this field is deprecated. Use the mpsFieldLabelModifier and mpsConstraintLabelModifier instead.

  10. InfixConstructor :: ConstructorVariant

    th-abstraction Language.Haskell.TH.Datatype

    Constructor without field names that is declared infix

Page 94 of many | Previous | Next