dev: more thorough Journal anonymisation, and a note (#1817)
This commit is contained in:
		
							parent
							
								
									3472c3cb6d
								
							
						
					
					
						commit
						248ddf9378
					
				| @ -530,6 +530,8 @@ data Journal = Journal { | ||||
|                                                                     --   TODO: FilePath is a sloppy type here, don't assume it's a | ||||
|                                                                     --   real file; values like "", "-", "(string)" can be seen | ||||
|   ,jlastreadtime          :: POSIXTime                              -- ^ when this journal was last read from its file(s) | ||||
|   -- NOTE: after adding new fields, eg involving account names, consider updating | ||||
|   -- the Anon instance in Hleger.Cli.Anon | ||||
|   } deriving (Eq, Generic) | ||||
| 
 | ||||
| -- | A journal in the process of being parsed, not yet finalised. | ||||
|  | ||||
| @ -19,6 +19,7 @@ import Numeric (showHex) | ||||
| import qualified Data.Text as T | ||||
| 
 | ||||
| import Hledger.Data | ||||
| import Data.Map (mapKeys) | ||||
| 
 | ||||
| class Anon a where | ||||
|     -- | Consistent converter to structure with sensitive data anonymized | ||||
| @ -30,6 +31,8 @@ instance Anon Journal where | ||||
|                , jparseparentaccounts  = map anonAccount $ jparseparentaccounts j | ||||
|                , jparsealiases         = []  -- already applied | ||||
|                , jdeclaredaccounts     = map (first anon) $ jdeclaredaccounts j | ||||
|                , jdeclaredaccounttags  = mapKeys anon $ jdeclaredaccounttags j | ||||
|                , jdeclaredaccounttypes = (map anon) <$> jdeclaredaccounttypes j | ||||
|                } | ||||
| 
 | ||||
| instance Anon Posting where | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user