sqlstruct
sqlstruct copied to clipboard
sqlstruct provides some convenience functions for using structs with go's database/sql package
This allows `sql:"..."` to recurse into the struct tagged.
(no text)
Hi, It seems it is pretty convinient for SELECT but how about the usage of UPDATE statement? I am thinking that something like loop over the colnames and set it...
One example of this package's documentation is somehow broken: Second one: https://godoc.org/github.com/kisielk/sqlstruct appears not in codetextbox: SELECT %s, %s FROM users AS u INNER JOIN address AS a ON a.id...
Hi there, i think there's a bug in here: https://github.com/kisielk/sqlstruct/blob/master/sqlstruct.go#L233 When you used aliasedColumn and than scanAliased. //edit: ok, i did a little debug and here's the final result is,...
Line `name = strings.Replace(name, alias+"_", "", 1)` in `doScan()` causes an issue if `alias+"_"` is part of the column name. Eg. column name: "order_id", alias "r" will produce "ordeid" and...
I believe its better to define the default NameMapper as: sqlstruct.NameMapper = func (a string) string { return a } since in most condition, users just want to use the...
Is there any way of getting the aliased column name for a given column? ie: ``` q := fmt.Sprintf(` SELECT %s FROM product p WHERE reference = ?`, sqlstruct.ColumnsAliased(p, "p"))...
I have a lot of cases where I have to run string functions or stored procedures during a query. So far I've still been able to use sqlstruct by adding...
``` go type User struct { Preferences *Preferences `sql:"-"` UpdatedAt time.Time } ``` When I perform ScanAliased(&preferences) after ScanAliased(&user) I get this error right after ScanAliased(&preferences) performed: sql: Scan error...