UNPKG

graphile-search-plugin

Version:

Generate search conditions for your tsvector columns (PostGraphile v5)

33 lines (32 loc) 858 B
"use strict"; /** * PostGraphile v5 Search Preset * * Provides a convenient preset for including search support in PostGraphile. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.PgSearchPreset = PgSearchPreset; const plugin_1 = require("./plugin"); const tsvector_codec_1 = require("./tsvector-codec"); /** * Creates a preset that includes the search plugin with the given options. * * @example * ```typescript * import { PgSearchPreset } from 'graphile-search-plugin'; * * const preset = { * extends: [ * PgSearchPreset({ * pgSearchPrefix: 'fullText', * }), * ], * }; * ``` */ function PgSearchPreset(options = {}) { return { plugins: [(0, tsvector_codec_1.createTsvectorCodecPlugin)(options), (0, plugin_1.createPgSearchPlugin)(options)], }; } exports.default = PgSearchPreset;