I have an API where I send a parameter currentList: ["hey", "cool"]
type sentenceCreateReq struct {
CurrentList []string `json:"currentList"`
}
func (usr *SentenceResource) Create(c buffalo.Context) error {
req := sentenceCreateReq{}
parseReqBody(c.Request(), &req)
...
sentence := models.Sentence{}
err := tx.Limit(1).Where("word NOT IN (?)", c.Params("currentList")).First(&sentence)
...
}
How would I be able to join the array of strings to fit my requirement?
The SQL statement I want to run is
SELECT * FROM sentences WHERE word NOT IN ('hey', 'cool');