Skip to content

Batch insert using map seems to still not work #701

@saantiaguilera

Description

@saantiaguilera

Hi, I'm using the master branch since it has the fix of batch inserts on named arguments. Still, when using a map it seems to still fail:

_, err := tx.NamedExec(
    "INSERT INTO state (state_id, name, created_at) VALUES (:id, :name, :time) ON DUPLICATE KEY UPDATE state_id=state_id",
    []map[string]interface{}{
        {"id": "MX-MEX", "name": "Ciudad de México", "time": time.Now()},
	{"id": "BR-SP", "name": "São Paulo", "time": time.Now()},
    },
)

Seems to fail with error: sql: expected 3 arguments, got 6

Any idea why?

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