| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Ganeti.Query.Language
Description
Implementation of the Ganeti Query2 language.
Synopsis
- data Filter a
- = EmptyFilter
- | AndFilter [Filter a]
- | OrFilter [Filter a]
- | NotFilter (Filter a)
- | TrueFilter a
- | EQFilter a FilterValue
- | LTFilter a FilterValue
- | GTFilter a FilterValue
- | LEFilter a FilterValue
- | GEFilter a FilterValue
- | RegexpFilter a FilterRegex
- | ContainsFilter a FilterValue
- filterArguments :: Filter a -> [a]
- type FilterField = String
- data FilterValue
- = QuotedString String
- | NumericValue Integer
- data FilterRegex
- mkRegex :: MonadFail m => String -> m FilterRegex
- stringRegex :: FilterRegex -> String
- compiledRegex :: FilterRegex -> Regex
- showFilterValue :: FilterValue -> JSValue
- type Fields = [String]
- data Query = Query ItemType Fields (Filter FilterField)
- data QueryResult = QueryResult {
- qresFields :: [FieldDefinition]
- qresData :: [ResultRow]
- data QueryFields = QueryFields ItemType Fields
- data QueryFieldsResult = QueryFieldsResult {}
- type FieldName = String
- type FieldTitle = String
- data FieldType
- type FieldDoc = String
- data FieldDefinition = FieldDefinition {}
- data ResultEntry = ResultEntry {
- rentryStatus :: ResultStatus
- rentryValue :: Maybe ResultValue
- data ResultStatus
- type ResultValue = JSValue
- data ItemType
- data QueryTypeOp
- queryTypeOpToRaw :: QueryTypeOp -> String
- data QueryTypeLuxi
- checkRS :: MonadFail m => ResultStatus -> a -> m a
Documentation
Query2 filter expression. It's a parameteric type since we can filter different "things"; e.g. field names, or actual field getters, etc.
Constructors
| EmptyFilter | No filter at all |
| AndFilter [Filter a] |
|
| OrFilter [Filter a] |
|
| NotFilter (Filter a) |
|
| TrueFilter a |
|
| EQFilter a FilterValue |
|
| LTFilter a FilterValue |
|
| GTFilter a FilterValue |
|
| LEFilter a FilterValue |
|
| GEFilter a FilterValue |
|
| RegexpFilter a FilterRegex |
|
| ContainsFilter a FilterValue |
|
Instances
| Foldable Filter # | |
Defined in Ganeti.Query.Language Methods fold :: Monoid m => Filter m -> m foldMap :: Monoid m => (a -> m) -> Filter a -> m foldMap' :: Monoid m => (a -> m) -> Filter a -> m foldr :: (a -> b -> b) -> b -> Filter a -> b foldr' :: (a -> b -> b) -> b -> Filter a -> b foldl :: (b -> a -> b) -> b -> Filter a -> b foldl' :: (b -> a -> b) -> b -> Filter a -> b foldr1 :: (a -> a -> a) -> Filter a -> a foldl1 :: (a -> a -> a) -> Filter a -> a elem :: Eq a => a -> Filter a -> Bool maximum :: Ord a => Filter a -> a | |
| Traversable Filter # | |
| Functor Filter # | |
| Show a => Show (Filter a) # | |
| Eq a => Eq (Filter a) # | |
| Ord a => Ord (Filter a) # | |
Defined in Ganeti.Query.Language | |
| JSON a => JSON (Filter a) # | |
filterArguments :: Filter a -> [a] #
Get the "things" a filter talks about. This is useful, e.g., to decide which additional fields to fetch in a query depending on live data.
type FilterField = String #
Field name to filter on.
data FilterValue #
Value to compare the field value to, for filtering purposes.
Constructors
| QuotedString String | |
| NumericValue Integer |
Instances
| Show FilterValue # | |
Defined in Ganeti.Query.Language Methods showsPrec :: Int -> FilterValue -> ShowS show :: FilterValue -> String showList :: [FilterValue] -> ShowS | |
| Eq FilterValue # | |
Defined in Ganeti.Query.Language | |
| Ord FilterValue # | |
Defined in Ganeti.Query.Language Methods compare :: FilterValue -> FilterValue -> Ordering (<) :: FilterValue -> FilterValue -> Bool (<=) :: FilterValue -> FilterValue -> Bool (>) :: FilterValue -> FilterValue -> Bool (>=) :: FilterValue -> FilterValue -> Bool max :: FilterValue -> FilterValue -> FilterValue min :: FilterValue -> FilterValue -> FilterValue | |
| JSON FilterValue # | |
Defined in Ganeti.Query.Language Methods readJSON :: JSValue -> Result FilterValue showJSON :: FilterValue -> JSValue readJSONs :: JSValue -> Result [FilterValue] showJSONs :: [FilterValue] -> JSValue | |
data FilterRegex #
Regexp to apply to the filter value, for filtering purposes. It holds both the string format, and the "compiled" format, so that we don't re-compile the regex at each match attempt.
Instances
| Show FilterRegex # |
|
Defined in Ganeti.Query.Language Methods showsPrec :: Int -> FilterRegex -> ShowS show :: FilterRegex -> String showList :: [FilterRegex] -> ShowS | |
| Eq FilterRegex # |
|
Defined in Ganeti.Query.Language | |
| Ord FilterRegex # |
|
Defined in Ganeti.Query.Language Methods compare :: FilterRegex -> FilterRegex -> Ordering (<) :: FilterRegex -> FilterRegex -> Bool (<=) :: FilterRegex -> FilterRegex -> Bool (>) :: FilterRegex -> FilterRegex -> Bool (>=) :: FilterRegex -> FilterRegex -> Bool max :: FilterRegex -> FilterRegex -> FilterRegex min :: FilterRegex -> FilterRegex -> FilterRegex | |
| JSON FilterRegex # |
|
Defined in Ganeti.Query.Language Methods readJSON :: JSValue -> Result FilterRegex showJSON :: FilterRegex -> JSValue readJSONs :: JSValue -> Result [FilterRegex] showJSONs :: [FilterRegex] -> JSValue | |
mkRegex :: MonadFail m => String -> m FilterRegex #
Builder for FilterRegex. We always attempt to compile the
regular expression on the initialisation of the data structure;
this might fail, if the RE is not well-formed.
stringRegex :: FilterRegex -> String #
The string version of the regex
compiledRegex :: FilterRegex -> Regex #
The compiled regex
showFilterValue :: FilterValue -> JSValue #
Serialiser for FilterValue. The Python code just sends this to
JSON as-is, so we'll do the same.
data QueryResult #
Query2 result.
Constructors
| QueryResult | |
Fields
| |
Instances
| Show QueryResult # | |
Defined in Ganeti.Query.Language Methods showsPrec :: Int -> QueryResult -> ShowS show :: QueryResult -> String showList :: [QueryResult] -> ShowS | |
| ArrayObject QueryResult # | |
Defined in Ganeti.Query.Language | |
| DictObject QueryResult # | |
Defined in Ganeti.Query.Language Methods toDict :: QueryResult -> [(String, JSValue)] # fromDictWKeys :: [(String, JSValue)] -> WriterT UsedKeys Result QueryResult # fromDict :: [(String, JSValue)] -> Result QueryResult # | |
| Eq QueryResult # | |
Defined in Ganeti.Query.Language | |
| JSON QueryResult # | |
Defined in Ganeti.Query.Language Methods readJSON :: JSValue -> Result QueryResult showJSON :: QueryResult -> JSValue readJSONs :: JSValue -> Result [QueryResult] showJSONs :: [QueryResult] -> JSValue | |
data QueryFields #
Query2 Fields query. (to get supported fields names, descriptions, and types)
Constructors
| QueryFields ItemType Fields |
data QueryFieldsResult #
Query2 Fields result.
Constructors
| QueryFieldsResult | |
Fields | |
Instances
type FieldTitle = String #
Title of a field, when represented in tabular format.
Type of a query field.
Constructors
| QFTUnknown | |
| QFTText | |
| QFTBool | |
| QFTNumber | |
| QFTNumberFloat | |
| QFTUnit | |
| QFTTimestamp | |
| QFTOther |
Instances
| Bounded FieldType # | |
Defined in Ganeti.Query.Language | |
| Enum FieldType # | |
Defined in Ganeti.Query.Language | |
| Show FieldType # | |
| Eq FieldType # | |
| Ord FieldType # | |
Defined in Ganeti.Query.Language | |
| JSON FieldType # | |
data FieldDefinition #
Definition of a field.
Constructors
| FieldDefinition | |
Instances
data ResultEntry #
Constructors
| ResultEntry | |
Fields
| |
Instances
| Show ResultEntry # | |
Defined in Ganeti.Query.Language Methods showsPrec :: Int -> ResultEntry -> ShowS show :: ResultEntry -> String showList :: [ResultEntry] -> ShowS | |
| NFData ResultEntry # | |
Defined in Ganeti.Query.Language Methods rnf :: ResultEntry -> () | |
| Eq ResultEntry # | |
Defined in Ganeti.Query.Language | |
| JSON ResultEntry # | |
Defined in Ganeti.Query.Language Methods readJSON :: JSValue -> Result ResultEntry showJSON :: ResultEntry -> JSValue readJSONs :: JSValue -> Result [ResultEntry] showJSONs :: [ResultEntry] -> JSValue | |
data ResultStatus #
Status of a query field.
Instances
type ResultValue = JSValue #
Value of a field, in json encoding. (its type will be depending on ResultStatus and FieldType)
Overall query type.
Constructors
| ItemTypeLuxi QueryTypeLuxi | |
| ItemTypeOpCode QueryTypeOp |
data QueryTypeOp #
Supported items on which Qlang works.
Instances
queryTypeOpToRaw :: QueryTypeOp -> String #
data QueryTypeLuxi #
Supported items on which Qlang works.
Instances
checkRS :: MonadFail m => ResultStatus -> a -> m a #
Check that ResultStatus is success or fail with descriptive message.