Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PutScanner ¶
func PutScanner(s *Scanner)
func ValueString ¶
ValueString is a type assertion function for a Scanner that receives untyped SQL parameter value and returns string representation of the SQL parameter appropriate for the substitution into the plain SQL query.
Types ¶
type AssertFunc ¶
AssertFunc is the signature of the function used to assert type of the parameter value. The argument are an untyped SQL parameter value. The return value are string representation of the SQL parameter appropriate for the substitution into the plain SQL query.
Scanning stops if the function returns an error.
type Scanner ¶
type Scanner struct { Values []driver.Value // Non named/non ordinal parameters in database/sql/driver representation. NamedValues []driver.NamedValue // Named or ordinal parameters in database/sql/driver representation. Assert AssertFunc // The function to get string representation of the SQL parameter. Reverse bool // Scans parameters from ending to beginning // contains filtered or unexported fields }
Scanner provides a convenient interface for getting string representation of the SQL parameters by slice of the parameters from database/sql/driver. Successive calls to the Scan method will step through the name and ordinal position of the parameter identifier and parameter value.
The specification of a parameter value is defined by a Assert function of type AssertFunc; the default Assert function provides access to an string representation of the SQL parameter.
Scanning stops unrecoverably at the first error.
func GetScanner ¶
func GetScanner() *Scanner
func (*Scanner) Param ¶
Param returns the most recent name and ordinal position of the parameter identifier and string representation of the SQL parameter value generated by a call to Scan.
If the name is not empty it should be used for the parameter identifier and not the ordinal position.
If name of the parameter identifier is empty and ordinal position is equal to zero therefore SQL query contains non named/non ordinal parameter identifiers (for example ? question characters).