Golang database/sql.RawBytes type examples
package database/sql
RawBytes is a byte slice that holds a reference to memory owned by the database itself. After a Scan into a RawBytes, the slice is only valid until the next call to Next, Scan, or Close.
Golang database/sql.RawBytes type usage examples
Example 1:
var result sql.RawBytes
rows.Scan(&result)
if expected != string(result) {
dbt.Error("result did not match expected value")
}
Example 2:
rows := dbt.mustQuery("SHOW STATUS LIKE 'Ssl_cipher'")
var variable, value *sql.RawBytes
for rows.Next() {
if err := rows.Scan(&variable, &value); err != nil {
dbt.Fatal(err.Error())
}
if value == nil {
dbt.Fatal("No Cipher")
}
}
Reference :
Advertisement
Something interesting
Tutorials
+13.5k Golang : How to get year, month and day?
+39k Golang : How to iterate over a []string(array)
+5k Golang : micron to centimeter example
+31.1k Golang : Calculate percentage change of two values
+12.3k Golang : List running EC2 instances and descriptions
+32.7k Golang : Regular Expression for alphanumeric and underscore
+7k Golang : constant 20013 overflows byte error message
+12.3k Golang : Print UTF-8 fonts on image example
+26.9k Golang : Force your program to run with root permissions
+8.8k Golang : Take screen shot of browser with JQuery example
+11.9k Golang : Convert decimal number(integer) to IPv4 address
+6.6k Golang : Warp text string by number of characters or runes example