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. mpsAvoidHsKeyword :: MkPersistSettings -> Text -> Text

    persistent Database.Persist.TH

    Customise function for field accessors applied only when the field name matches any of Haskell keywords. Default: suffix "_".

  2. setImplicitIdDef :: ImplicitIdDef -> MkPersistSettings -> MkPersistSettings

    persistent Database.Persist.TH

    Set the ImplicitIdDef in the given MkPersistSettings. The default value is autoIncrementingInteger.

  3. data ImplicitIdDef

    persistent Database.Persist.TH.Internal

    A specification for how the implied ID columns are created. By default, persistent will give each table a default column named id (customizable by PersistSettings), and the column type will be whatever you'd expect from BackendKey yourBackendType. For The SqlBackend type, this is an auto incrementing integer primary key. You might want to give a different example. A common use case in postgresql is to use the UUID type, and automatically generate them using a SQL function. Previously, you'd need to add a custom Id annotation for each model.

    User
    Id   UUID default="uuid_generate_v1mc()"
    name Text
    
    Dog
    Id   UUID default="uuid_generate_v1mc()"
    name Text
    user UserId
    
    Now, you can simply create an ImplicitIdDef that corresponds to this declaration.
    newtype UUID = UUID ByteString
    
    instance PersistField UUID where
    toPersistValue (UUID bs) =
    PersistLiteral_ Escaped bs
    fromPersistValue pv =
    case pv of
    PersistLiteral_ Escaped bs ->
    Right (UUID bs)
    _ ->
    Left "nope"
    
    instance PersistFieldSql UUID where
    sqlType _ = SqlOther UUID
    
    With this instance at the ready, we can now create our implicit definition:
    uuidDef :: ImplicitIdDef
    uuidDef = mkImplicitIdDef @UUID "uuid_generate_v1mc()"
    
    And we can use setImplicitIdDef to use this with the MkPersistSettings for our block.
    mkPersist (setImplicitIdDef uuidDef sqlSettings) [persistLowerCase| ... |]
    
    TODO: either explain interaction with mkMigrate or fix it. see issue #1249 for more details.

  4. mpsAvoidHsKeyword :: MkPersistSettings -> Text -> Text

    persistent Database.Persist.TH.Internal

    Customise function for field accessors applied only when the field name matches any of Haskell keywords. Default: suffix "_".

  5. setImplicitIdDef :: ImplicitIdDef -> MkPersistSettings -> MkPersistSettings

    persistent Database.Persist.TH.Internal

    Set the ImplicitIdDef in the given MkPersistSettings. The default value is autoIncrementingInteger.

  6. Divide :: PersistUpdate

    persistent Database.Persist.Types

    No documentation available.

  7. PersistInvalidField :: Text -> PersistException

    persistent Database.Persist.Types

    No documentation available.

  8. PersistObjectId :: ByteString -> PersistValue

    persistent Database.Persist.Types

    Intended especially for MongoDB backend

  9. fieldIsImplicitIdColumn :: FieldDef -> !Bool

    persistent Database.Persist.Types

    True if the field is an implicit ID column. False otherwise.

  10. isValidAbsDir :: PosixPath -> Bool

    path OsPath.Internal.Posix

    Is the PosixPath a valid absolute dir?

Page 600 of many | Previous | Next