-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Types and functions for representing PostgreSQL's ltree -- -- Please see the README on GitHub at -- https://github.com/simspace/postgresql-ltree#readme @package postgresql-ltree @version 0.0.0.0 -- | This module provides types and functions for PostgreSQL's -- ltree -- https://www.postgresql.org/docs/current/ltree.html -- -- You will want to use a specific implementation, e.g. -- postgresql-simple-ltree. module Database.PostgreSQL.LTree -- | Wrapper for Postgres' ltree (label tree) type. newtype LTree LTree :: Seq Label -> LTree [unLTree] :: LTree -> Seq Label -- | Wrapper for a single label in an ltree. The constructor IS -- NOT exported to ensure we only construct valid labels. See -- mkLabel for constructing a Label. data Label -- | Produce a new LTree by applying the supplied function to each -- Label. map :: (Label -> Label) -> LTree -> LTree -- | Convert a list to an LTree. fromList :: [Label] -> LTree -- | Convert an LTree to a list. toList :: LTree -> [Label] -- | Get the first Label from an LTree if one exists. rootLabel :: LTree -> Maybe Label -- | Get the second-to-last Label in an LTree. parentLabel :: LTree -> Maybe Label -- | Get the parent path of an LTree. parent :: LTree -> Maybe LTree -- | Get the length of an LTree. numLabels :: LTree -> Int -- | Safely construct a Label from Text. If the supplied -- Text contains characters unsupported by ltree. On -- failure, returns Left with an error message. mkLabel :: Text -> Either String Label -- | Same as mkLabel except throws an error for an invalid -- Text input. unsafeMkLabel :: Text -> Label -- | A UUID can always be converted into a Label without -- error by dropping the hyphens. The resulting Label will only -- contain numbers and lower-case alpha characters. uuidToLabel :: UUID -> Label -- | An empty LTree. empty :: LTree -- | Test whether an LTree is empty. null :: LTree -> Bool -- | Construct an LTree from a single Label. singleton :: Label -> LTree -- | Append a single Label to the end of an LTree; should be -- O(1) since it's delegating to |> snoc :: LTree -> Label -> LTree -- | Render an ltree as it would appear in the database. render :: LTree -> Text -- | Unsafely parse an LTree from Text assuming each -- Label is valid. Use this only if you sure the input is a valid -- LTree; e.g. it was fetched from a field the database of type -- ltree. unsafeUncheckedParse :: Text -> LTree -- | Parse an LTree from Text. If any Label present is -- invalid, returns Left. parse :: Text -> Either String LTree -- | Test whether the first LTree is an immediate parent of the -- second; e.g. a.b is an immediate parent of a.b.c isImmediateParentOf :: LTree -> LTree -> Bool -- | Test whether the first LTree is an immediate child of the -- second; e.g. a.b.c is an immediate child of a.b isImmediateChildOf :: LTree -> LTree -> Bool -- | Attempt to parse a UUID from a Label. parseUUIDFromLabel :: Label -> Either String UUID -- | Test whether all labels in the LTree are unique. allLabelsUnique :: LTree -> Bool instance GHC.Classes.Ord Database.PostgreSQL.LTree.Label instance GHC.Classes.Eq Database.PostgreSQL.LTree.Label instance GHC.Show.Show Database.PostgreSQL.LTree.Label instance GHC.Classes.Ord Database.PostgreSQL.LTree.LTree instance GHC.Classes.Eq Database.PostgreSQL.LTree.LTree instance GHC.Show.Show Database.PostgreSQL.LTree.LTree instance Data.Aeson.Types.FromJSON.FromJSON Database.PostgreSQL.LTree.LTree instance Data.Aeson.Types.ToJSON.ToJSON Database.PostgreSQL.LTree.LTree instance Data.Aeson.Types.FromJSON.FromJSON Database.PostgreSQL.LTree.Label instance Data.Aeson.Types.ToJSON.ToJSON Database.PostgreSQL.LTree.Label -- | This module provides types and functions for PostgreSQL's -- lquery -- https://www.postgresql.org/docs/current/ltree.html -- -- You will want to use a specific implementation, e.g. -- postgresql-simple-ltree. module Database.PostgreSQL.LQuery -- | Wrapper for Postgres' lquery (label tree query) type. newtype LQuery LQuery :: Text -> LQuery [unLQuery] :: LQuery -> Text -- | Build an lquery expression which matches any ltree -- which contains the given label. contains :: Label -> LQuery instance GHC.Classes.Ord Database.PostgreSQL.LQuery.LQuery instance GHC.Classes.Eq Database.PostgreSQL.LQuery.LQuery instance GHC.Show.Show Database.PostgreSQL.LQuery.LQuery instance Data.Aeson.Types.FromJSON.FromJSON Database.PostgreSQL.LQuery.LQuery instance Data.Aeson.Types.ToJSON.ToJSON Database.PostgreSQL.LQuery.LQuery