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
+8.4k Golang : Ackermann function example
+17k Golang : Get input from keyboard
+31.1k Golang : Calculate percentage change of two values
+9.1k Golang : How to capture return values from goroutines?
+6.7k Golang : Derive cryptographic key from passwords with Argon2
+14.6k Golang : Convert(cast) int to float example
+9.1k Golang : Simple histogram example
+6.9k How to let Facebook Login button redirect to a particular URL ?
+5.5k Golang : If else example and common mistake
+19k Golang : Padding data for encryption and un-padding data for decryption
+43.5k Golang : Get hardware information such as disk, memory and CPU usage
+7k Golang : constant 20013 overflows byte error message