hledger-* API docs

Safe HaskellSafe-Infered

Hledger.Data.Matching

Description

More generic matching, done in one step, unlike FilterSpec and filterJournal*. Currently used only by hledger-web.

Synopsis

Documentation

data Matcher Source

A matcher is a single, or boolean composition of, search criteria, which can be used to match postings, transactions, accounts and more. Currently used by hledger-web, will likely replace FilterSpec at some point.

Constructors

MatchAny

always match

MatchNone

never match

MatchNot Matcher

negate this match

MatchOr [Matcher]

match if any of these match

MatchAnd [Matcher]

match if all of these match

MatchDesc String

match if description matches this regexp

MatchAcct String

match postings whose account matches this regexp

MatchDate DateSpan

match if actual date in this date span

MatchEDate DateSpan

match if effective date in this date span

MatchStatus Bool

match if cleared status has this value

MatchReal Bool

match if realness (involves a real non-virtual account ?) has this value

MatchEmpty Bool

match if emptiness (from the --empty command-line flag) has this value. Currently this means a posting with zero amount.

MatchDepth Int

match if account depth is less than or equal to this value

Instances

Eq Matcher 
Show Matcher 

matcherIsNull :: Matcher -> BoolSource

Does this matcher match everything ?

matcherIsStartDateOnly :: Bool -> Matcher -> BoolSource

Does this matcher specify a start date and nothing else (that would filter postings prior to the date) ? When the flag is true, look for a starting effective date instead.

matcherStartDate :: Bool -> Matcher -> Maybe DaySource

What start date does this matcher specify, if any ? If the matcher is an OR expression, returns the earliest of the alternatives. When the flag is true, look for a starting effective date instead.

matchesTransaction :: Matcher -> Transaction -> BoolSource

Does the match expression match this transaction ?

matchesPosting :: Matcher -> Posting -> BoolSource

Does the match expression match this posting ?

inAccount :: [QueryOpt] -> Maybe (AccountName, Bool)Source

The account we are currently focussed on, if any, and whether subaccounts are included. Just looks at the first query option.

inAccountMatcher :: [QueryOpt] -> Maybe MatcherSource

A matcher for the account(s) we are currently focussed on, if any. Just looks at the first query option.