Created
April 8, 2021 23:38
-
-
Save vishalkanaujia/57a24458d41bc99af15b4bea6fb7f819 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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