Guest User

Untitled

a guest
Aug 15th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. ```javascript
  2. // import or hard-code a whitelist of Postgres tables
  3. const whitelist = [
  4. 'posts',
  5. 'users'
  6. ]
  7.  
  8. function WhitelistTablesPlugin (builder) {
  9. builder.hook("build", build => {
  10. build.pgIntrospectionResultsByKind.class
  11. .filter(table => !whitelist.includes(table.name))
  12. .forEach(tableToOmit => {
  13. tableToOmit.tags.omit = true;
  14. });
  15. return build;
  16. });
  17. }
  18.  
  19. module.exports = WhitelistTablesPlugin;
  20. ```
  21.  
  22. Copyright (c) 2018 Brendan Brown
  23.  
  24. Permission is hereby granted, free of charge, to any person obtaining
  25. a copy of this software and associated documentation files (the
  26. "Software"), to deal in the Software without restriction, including
  27. without limitation the rights to use, copy, modify, merge, publish,
  28. distribute, sublicense, and/or sell copies of the Software, and to
  29. permit persons to whom the Software is furnished to do so, subject to
  30. the following conditions:
  31.  
  32. The above copyright notice and this permission notice shall be included
  33. in all copies or substantial portions of the Software.
  34.  
  35. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  36. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  37. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  38. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  39. CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  40. TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  41. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Add Comment
Please, Sign In to add comment