Skip to content

Instantly share code, notes, and snippets.

@vishalkanaujia
Created April 8, 2021 23:38
Show Gist options
  • Save vishalkanaujia/57a24458d41bc99af15b4bea6fb7f819 to your computer and use it in GitHub Desktop.
Save vishalkanaujia/57a24458d41bc99af15b4bea6fb7f819 to your computer and use it in GitHub Desktop.
package main
import "fmt"
import "strings"
func main() {
update("test-name", []{"OH", "CA"})
}
func update(name string, state []string) {
args := []interface{}{}
args = append(args, name)
for _, state := range states {
args = append(args, state)
}
query := `UPDATE students SET name = ? WHERE state in (?` + strings.Repeat(",?", len(currentState)-1) + `)`
fakeExec(args...)
}
func fakeExec(args ...interface{}) {
fmt.Println("Got:", args)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment