test1.ts 1.1 KB

123456789101112131415161718192021222324252627282930
  1. import { Observable } from "rxjs"
  2. import { queryService } from "../services/query.service"
  3. import { Conditions, Storage } from "../services/query.service"
  4. import { _, isObject } from 'lodash'
  5. let query = new queryService()
  6. let storageAddress: Storage = {
  7. type: "File",
  8. address: "payload.json"
  9. }
  10. let conditions: Conditions[] = [
  11. { 'msgTag': ['free'] }
  12. ]
  13. let conditions2: Conditions[] = [
  14. { "msgId": "4f710c4b-a258-4c7e-a4b6-6095bb7028e9" },
  15. { "msgLogDateTime": "2023-01-14T21:50:19.917Z" },
  16. ]
  17. let conditions3: Conditions[] = [
  18. { "regex": "cum incidunt maxime voluptatibus" }
  19. ]
  20. query.query(storageAddress, ...conditions3).subscribe((element) => { console.log(`${element.header.messageName} is matched`) })
  21. // query.query(storageAddress, ...conditions2).subscribe((element) => { console.log(`${element.header.messageName} is matched`) })
  22. // the key is to do it in one line. Client just pass 2 arguments, one is the location of the data, which could be file, sql or mongodb, and also
  23. // pass in the conditions of their search enquiries. We will aslo have to cater to different file storage location to determine how to prep the
  24. // data to be filtered