crawshaw / sqlite

Go SQLite3 driver
ISC License
561 stars 67 forks source link

No way to write blob in custom function #124

Open BrannonKing opened 3 years ago

BrannonKing commented 3 years ago

I don't see any way to have blob result when using CreateFunction. I need a custom function that drops the last byte off a blob type. Example:

    v.db.CreateFunction("POPS", true, 1,
        func (c sqlite.Context, v ...sqlite.Value) {
            t := v[0].Blob()
            c.ResultBlob(t[:len(t)-1]) // no such thing (and what would be faster?)
        }, nil, nil)

I need a similar one that reverses all the bytes in a blob. Is there some way to do that in the current code?