So I want to accept postgress function which takes an argument to determine what all features should user have access to.
In Javascript/Typescript I would ideally do something like this
const a = ['featureA', 'featureB', 'featureC'];
function unlockFeatures (abc) {
let unlock = ''
if (abc.includes('featureA')) {
unlock = 'somethingA'
}
else if (abc.includes('featureB')) {
unlock = 'somethingB'
}
else if (abc.includes('featureC')) {
unlock = 'somethingC'
}
return unock
}
unlockFeatures(a)
How can I write equivalent of this in postgres/sql function where I can pass array to function?