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
+7.2k Golang : Check if one string(rune) is permutation of another string(rune)
+5.3k Golang : Pad file extension automagically
+87.8k Golang : How to convert character to ASCII and back
+29.4k Golang : JQuery AJAX post data to server and send data back to client example
+6.9k Golang : How to setup a disk space used monitoring service with Telegram bot
+13.9k Golang : Get current time
+18.4k Golang : Logging with logrus
+6.9k Golang : How to solve "too many .rsrc sections" error?
+7.3k Golang : How to iterate a slice without using for loop?
+16.6k Golang : Merge video(OpenCV) and audio(PortAudio) into a mp4 file
+6.4k PHP : Proper way to get UTF-8 character or string length
+36.5k Golang : Validate IP address