Skip to content

Possible to bind arrays, for use in e.g. IN (?) queries? #102

@beaugunderson

Description

@beaugunderson

I'd like to do something like this and pass a list of strings to IN in my query:

	var callsInFile = []string{"N7YHF", "W0NY"}

	err = sqlitex.Execute(conn,
		`SELECT id, callsign FROM callsigns WHERE callsign IN (?)`,
		&sqlitex.ExecOptions{Args: []any{callsInFile},
			ResultFunc: func(stmt *sqlite.Stmt) error {
				fmt.Printf("%d\n", stmt.ColumnInt64(0))
				return nil
			}})
	if err != nil {
		panic(err)
	}

It doesn't work at the moment; am I missing a way to do it or is it simply not possible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions