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
+22.4k Golang : How to read JPG(JPEG), GIF and PNG files ?
+6.1k Fix ERROR 2003 (HY000): Can't connect to MySQL server on 'IP address' (111)
+6k Golang : Experimenting with the Rejang script
+8.8k Android Studio : Image button and button example
+5.3k PHP : Hide PHP version information from curl
+8.4k Your page has meta tags in the body instead of the head
+15k Golang : How do I get the local IP (non-loopback) address ?
+7.7k Golang : Mapping Iban to Dunging alphabets
+5.8k Golang : Launching your executable inside a console under Linux
+16.6k Golang : Merge video(OpenCV) and audio(PortAudio) into a mp4 file
+16.6k Golang : Generate QR codes for Google Authenticator App and fix "Cannot interpret QR code" error
+20.9k PHP : Convert(cast) int to double/float