Skip to content

Commit

Permalink
add more haddock comments
Browse files Browse the repository at this point in the history
  • Loading branch information
curranosaurus committed Dec 30, 2024
1 parent 8b6b752 commit 7f990da
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions persistent/Database/Persist/EntityDef.hs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ getEntityDBName = entityDB
getEntityExtra :: EntityDef -> Map Text [[Text]]
getEntityExtra = entityExtra

-- | Get the (optional) schema for an entity. Specified with the syntax
-- `schema=foo` on the Persistent model.
--
-- @since 2.14.7
getEntitySchema :: EntityDef -> Maybe SchemaNameDB
getEntitySchema = entitySchema

Expand Down Expand Up @@ -200,6 +204,9 @@ getEntityKeyFields = entityKeyFields
setEntityFields :: [FieldDef] -> EntityDef -> EntityDef
setEntityFields fd ed = ed { entityFields = fd }

-- | Update the entity schema.
--
-- @since 2.14.7
setEntitySchema :: Maybe SchemaNameDB -> EntityDef -> EntityDef
setEntitySchema sn ed = ed { entitySchema = sn }

Expand Down
4 changes: 4 additions & 0 deletions persistent/Database/Persist/Names.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ instance DatabaseName ConstraintNameDB where
newtype ConstraintNameHS = ConstraintNameHS { unConstraintNameHS :: Text }
deriving (Show, Eq, Read, Ord, Lift)

-- | The name of a database schema. Different backends vary in their
-- interpretation of this concept.
--
-- @since 2.14.7
newtype SchemaNameDB = SchemaNameDB { unSchemaNameDB :: Text }
deriving (Show, Eq, Read, Ord, Lift)

Expand Down
1 change: 1 addition & 0 deletions persistent/Database/Persist/Quasi/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ data ParsedEntityDef = ParsedEntityDef
{ parsedEntityDefComments :: [Text]
, parsedEntityDefEntityName :: EntityNameHS
, parsedEntityDefSchemaName :: Maybe SchemaNameDB
-- ^ @since 2.14.7
, parsedEntityDefIsSum :: Bool
, parsedEntityDefEntityAttributes :: [Attr]
, parsedEntityDefFieldAttributes :: [[Token]]
Expand Down
4 changes: 3 additions & 1 deletion persistent/Database/Persist/Types/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,12 @@ data EntityDef = EntityDef
-- ^ Whether or not this entity represents a sum type in the database.
, entityComments :: !(Maybe Text)
-- ^ Optional comments on the entity.
--
-- @since 2.10.0
, entitySchema :: !(Maybe SchemaNameDB)
-- ^ The schema the entity belongs to.
--
-- @since 2.10.0
-- @since 2.14.7
}
deriving (Show, Eq, Read, Ord, Lift)

Expand Down

0 comments on commit 7f990da

Please sign in to comment.