Nanorm icon indicating copy to clipboard operation
Nanorm copied to clipboard

Add Execute/Query overloads that accept params in a non-boxing way without extension methods

Open DamianEdwards opened this issue 2 years ago • 0 comments

Enable passing parameter values without having to call an extension method on the value itself and without boxing the value, e.g.:

var createdTodo = await db.QuerySingleAsync<Todo>("""
        INSERT INTO Todos(Title, IsComplete)
        Values(@Title, @IsComplete)
        RETURNING *
        """,
        todo.Title,
        todo.IsComplete);

Overloads would accept params ParameterValue[] where ParameterValue is a custom struct that can store numerous different struct values in a fixed length (e.g. 64 bits) and fall back to boxing, e.g. https://github.com/JeremyKuhne/ValuePrototype. It would have implicit conversions for supported values and for the specific DbParameter type (including Npgsql's generic NpgsqlParameter<T>).

DamianEdwards avatar May 14 '23 15:05 DamianEdwards