Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SqlExec ¶
Prepares the query string by inserting given parameters and then executes the query. For example used for SQL insert operations.
func SqlQuery ¶
Passes params into query string, executes the query and returns a slice of type rettype disguised as interface. This is useful when the real type of the slice isn't actually needed. For example passing the result into a json encoder works fine even with this interface slice. If need be, one can convert the results in 3 lines into a slice with correct type:
realslice := make([]REALTYPE, len(results)) for i, val := range results { realslice[i] = val.(REALTYPE) }
This is used for SQL select operations. rettype can not only be a struct, but also a simple type such as string or int.
Example usage:
var p Product result := sqlQueryStruct(&p, "...")
B E W A R E This uses reflect, thus is inefficient and purely for convenience.
Types ¶
This section is empty.