You must provide a generated search function by using the `setGenerateSearch` method of the package. It must always have a default similar to the following. For your custom generation you can do as many things as you want.

Usage no npm install needed!

<script type="module">
  import npmMedgoQuery from '';


Important to do when using


You must provide a generated search function by using the setGenerateSearch method of the package. It must always have a default similar to the following. For your custom generation you can do as many things as you want.

function generateSearch(query: any, key: any): string {
    switch (key) {
        case "jobProfiles":
            return (
                "jobprofiles:" +
                    .map((e: any): string =>
                        e.job !== -1
                            ? e.specialtys.length > 0
                                ? e.specialtys
                                      .map((spec: any): string =>
                                          e.institutions && e.institutions.length > 0
                                              ? any): string =>
                                                    ("" + e.job).concat(
                                                        spec !== -1
                                                            ? "s" + spec + (i !== -1 ? "s" + i : "")
                                                            : i !== -1
                                                            ? "ss" + i
                                                            : ""
                                              : ("" + e.job).concat(spec !== -1 ? "s" + spec : "")
                                : e.institutions && e.institutions.length > 0
                                ? any): string => ("" + e.job).concat(i !== -1 ? "ss" + i : ""))
                                : ""
                            : ""
                    .filter((e: any): boolean => e !== "")
            return "" + key + ":" + query[key];


you can extend the formatters list with the extendFormatterslist method of the package. here's a quick example

// value will be the value of the variable isRadhiAGoodGuy in this example
// values are always string.
function booleanParser(value: string) {
    return value === "true";
const formatterslist = {
    isRadhiAGoodGuy: booleanParser
// Will do an object assign to add the new values you're using on top of the other parsers already defined in the package (check below for more)

List of formatters present in the module

let formatterslist = {
    statut: splitStringAndParseInt,
    job: splitStringAndParseInt,
    jobProfilesPending: jobProfileParser2,
    specialty: splitStringAndParseInt,
    institution: splitStringAndParseInt,
    admin: splitStringAndParseInt,
    missionmotifcreationcategory: splitStringAndParseInt,
    originInstitution: splitStringAndParseInt,
    mission: splitStringAndParseInt,
    id: splitStringAndParseInt,
    worker: splitStringAndParseInt,
    beginAt: unixRangeParser,
    endAt: operatorNumberParser,
    createdAt: operatorNumberParser,
    jobprofiles: jobProfileParser,
    searchname: searchNameParser,
    populate: splitString,
    isDeletedFromNetwork: booleanParser,
    isDeletedFromNetworkByInstitutions: isDeletedFromNetworkParser,
    isCanceled: booleanParser,
    isFullTime: booleanParser,
    isExpress: booleanParser,
    isLongMission: booleanParser,
    isPastMission: booleanParser,
    isPlanning: booleanParser,
    isValidated: booleanParser,
    isFilled: booleanParser,
    isNight: idBooleanParser,
    isDay: idBooleanParser,
    isDayRefused: idBooleanParser,
    isNightRefused: idBooleanParser,
    isSignedPerAdmin: booleanParser,
    isSignedPerWorker: booleanParser,
    isBlockedByAdmin: institutionServiceBooleanParser,
    isRefusedByWorker: institutionServiceBooleanParser,
    isWorkerNotified: idBooleanParser,
    isAllowedDay: idBooleanParser,
    isAllowedNight: idBooleanParser,
    isAllowedService: institutionServiceBooleanParser,
    service: splitStringAndParseInt,
    range: rangeParser,
    rangeBeginAt: rangeParser,
    nbPotentialWorkers: operatorNumberParser,
    isAccepted: booleanParser,
    isRefused: booleanParser,
    acceptedBy: splitStringAndParseInt,
    createdBy: splitStringAndParseInt,
    idInInstitution: splitString,
    isViaEmailCSVOption: booleanParser,
    isPoleCSVOption: booleanParser,
    isRecupCSVOption: booleanParser,
    isTwoLinesForMissionOnTwoDaysCSVOption: booleanParser,
    idInfoOnWorkersCSVOption: splitStringAndParseInt,
    inCluster: splitStringAndParseInt,
    didWorkerSignUp: booleanParser,
    contract: splitStringAndParseInt,
    isCancelled: booleanParser,
    isFused: booleanParser,
    isSigned: booleanParser,
    isCancelledOrFused: booleanParser,
    isSignedOrNew: booleanParser,
    isDayMission: booleanParser,
    isPublicHoliday: booleanParser,
    isSunday: booleanParser

For more information please check the source code to see how parsers work


there's also an express middlware to put the req.query request parameters in req.parameters after parse with your configuration.



  • Escape single quotes in search input in queries


  • Use "like" instead of "similar to". "Similar to" doesn't support comparing all characters.
  • Fix where clause, string was truncated


  • Add isDayMission, isPublicHoliday, isSunday


  • Add package pg to dependencies
  • Add package pg-native to dependencies


  • Add package pg-native


  • change paramParser for idInInstitution: expecting string instead of integer


  • new name the package changes its name to npm-medgo-query