Hoogle Search

Within LTS Haskell 24.38 (ghc-9.10.3)

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

  1. (=.) :: (PersistEntity val, PersistField typ) => EntityField val typ -> SqlExpr (Value typ) -> SqlExpr (Entity val) -> SqlExpr Update

    esqueleto Database.Esqueleto.Legacy

    No documentation available.

  2. (==.) :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool)

    esqueleto Database.Esqueleto.Legacy

    This operator produces the SQL operator =, which is used to compare values for equality. Example:

    query :: UserId -> SqlPersistT IO [Entity User]
    query userId = select $ do
    user <- from $ table @User
    where_ (user ^. UserId ==. val userId)
    pure user
    
    This would generate the following SQL:
    SELECT user.*
    FROM user
    WHERE user.id = ?
    

  3. (>.) :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool)

    esqueleto Database.Esqueleto.Legacy

    This operator translates to the SQL operator >. Example:

    where_ $ user ^. UserAge >. val 20
    

  4. (>=.) :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool)

    esqueleto Database.Esqueleto.Legacy

    This operator translates to the SQL operator >=. Example:

    where_ $ user ^. UserAge >=. val 21
    

  5. (?.) :: (PersistEntity val, PersistField typ) => SqlExpr (Maybe (Entity val)) -> EntityField val typ -> SqlExpr (Value (Maybe (Nullable typ)))

    esqueleto Database.Esqueleto.Legacy

    Project an EntityField of a nullable entity. The result type will be Nullable, meaning that nested Maybe won't be produced here. As of v3.6.0.0, this will attempt to combine nested Maybe. If you want to keep nested Maybe, then see ??..

  6. (^.) :: forall typ val . (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ)

    esqueleto Database.Esqueleto.Legacy

    Project a field of an entity.

  7. (||.) :: SqlExpr (Value Bool) -> SqlExpr (Value Bool) -> SqlExpr (Value Bool)

    esqueleto Database.Esqueleto.Legacy

    This operator translates to the SQL operator AND. Example:

    where_ $
    user ^. UserName ==. val Matt
    ||. user ^. UserName ==. val John
    

  8. ( #-. ) :: JSONBExpr a -> [Text] -> JSONBExpr b

    esqueleto Database.Esqueleto.PostgreSQL.JSON

    Requires PostgreSQL version >= 9.5 This operator can remove elements nested in an object. If a Text is not parsable as a number when selecting in an array (even when halfway through the selection) an exception will be thrown. Negative integers delete counting from the end of an array. (e.g. -1 being the last element, -2 being the second to last, etc.) CAUTION: THIS FUNCTION THROWS AN EXCEPTION WHEN USED ON ANYTHING OTHER THAN OBJECTS OR ARRAYS, AND WILL ALSO THROW WHEN TRYING TO SELECT AN ARRAY ELEMENT WITH A NON-INTEGER TEXT

    Objects

    {"a": 3.14, "b": null}        #- []        == {"a": 3.14, "b": null}
    {"a": 3.14, "b": null}        #- ["a"]     == {"b": null}
    {"a": 3.14, "b": null}        #- ["a","b"] == {"a": 3.14, "b": null}
    {"a": {"b":false}, "b": null} #- ["a","b"] == {"a": {}, "b": null}
    

    Arrays

    [true, {"b":null}, 5]       #- []            == [true, {"b":null}, 5]
    [true, {"b":null}, 5]       #- ["0"]         == [{"b":null}, 5]
    [true, {"b":null}, 5]       #- ["b"]         == ERROR: path element at position 1 is not an integer: "b"
    [true, {"b":null}, 5]       #- ["1","b"]     == [true, {}, 5]
    [true, {"b":null}, 5]       #- ["-2","b"]    == [true, {}, 5]
    {"a": {"b":[false,4,null]}} #- ["a","b","2"] == {"a": {"b":[false,4]}}
    {"a": {"b":[false,4,null]}} #- ["a","b","c"] == ERROR: path element at position 3 is not an integer: "c"
    

    Other values

    1    #- {anything} == ERROR: cannot delete from scalar
    "a"  #- {anything} == ERROR: cannot delete from scalar
    true #- {anything} == ERROR: cannot delete from scalar
    null #- {anything} == ERROR: cannot delete from scalar
    

    PostgreSQL Documentation

    | Type   | Description                                             |  Example
    ----+--------+---------------------------------------------------------+------------------------------------
    #- | text[] | Delete the field or element with specified path         | '["a", {"b":1}]'::jsonb #- '{1,b}'
    |        | (for JSON arrays, negative integers count from the end) |
    

  9. ( #>. ) :: JSONBExpr a -> [Text] -> JSONBExpr b

    esqueleto Database.Esqueleto.PostgreSQL.JSON

    Requires PostgreSQL version >= 9.3 This operator can be used to select a JSON value from deep inside another one. It only works on objects and arrays and will result in NULL (Nothing) when encountering any other JSON type. The Texts used in the right operand list will always select an object field, but can also select an index from a JSON array if that text is parsable as an integer. Consider the following:

    x ^. TestBody #>. ["0","1"]
    
    The following JSON values in the test table's body column will be affected:
    Values in column                     | Resulting value
    --------------------------------------+----------------------------
    {"0":{"1":"Got it!"}}                 | "Got it!"
    {"0":[null,["Got it!","Even here!"]]} | ["Got it!", "Even here!"]
    [{"1":"Got it again!"}]               | "Got it again!"
    [[null,{"Wow":"so deep!"}]]           | {"Wow": "so deep!"}
    false                                 | NULL
    "nope"                                | NULL
    3.14                                  | NULL
    

    PostgreSQL Documentation

    | Type   | Description                       |  Example                                   | Example Result
    -----+--------+-----------------------------------+--------------------------------------------+----------------
    #>  | text[] | Get JSON object at specified path | '{"a": {"b":{"c": "foo"}}}'::json#>'{a,b}' | {"c": "foo"}
    

  10. ( #>>. ) :: JSONBExpr a -> [Text] -> SqlExpr (Value (Maybe Text))

    esqueleto Database.Esqueleto.PostgreSQL.JSON

    Requires PostgreSQL version >= 9.3 This function is to #>. as ->>. is to ->. CAUTION: if the "scalar" JSON value null is the result of this function, PostgreSQL will interpret it as a PostgreSQL NULL value, and will therefore be Nothing instead of (Just "null")

    PostgreSQL Documentation

    | Type   | Description                               |  Example                                    | Example Result
    -----+--------+-------------------------------------------+---------------------------------------------+----------------
    #>> | text[] | Get JSON object at specified path as text | '{"a":[1,2,3],"b":[4,5,6]}'::json#>>'{a,2}' | 3
    

Page 123 of many | Previous | Next