Skip to content

Instantly share code, notes, and snippets.

@amy
amy / goQuestions.go
Last active September 25, 2016 16:57
/* 1 */
So I'm reading the documentation for database/sql for rows.Close():
"Close closes the Rows, preventing further enumeration. If Next returns false, the Rows are closed automatically
and it will suffice to check the result of Err. Close is idempotent and does not affect the result of Err.""
I still don't get what closing a row does. I get closing in the context of closing for like DB.close() since its a DB
connection. But what does closing a row mean. "Close closes the Rows". Its using the same word to describe itself.
Answer: DB Connection Pooling
Open is essentially only there to store credentials & never makes a connection.
Queries / Insert / etc. each create separate connections in the DB Connection Pool as they are independent of
@amy
amy / test.swift
Last active November 15, 2016 06:00
// creates a New Session
// returns Session ID
func createNewSession() ->String {
let urlString = "http://" + self.host + ":" + self.port + "/session"
guard let url = URL(string: urlString) else {
print("Error: cannot create URL")
return ""
}
var request = URLRequest(url: url)
version: '2'
services:
php:
image: php:7.1.3
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
# docker-compose.yml
version: '2'
services:
apache:
image: php:7.1.3-apache
volumes:
- content:/var/www/html/
apache-lb:
image: rancher/lb-service-haproxy:v0.6.4
ports:
#rancher-compose.yml
version: '2'
services:
apache:
scale: 1
apache-lb:
scale: 1
lb_config:
<?php
echo "Hello, world!";
# docker-compose.yml
version: '2'
services:
apache:
image: php:7.1.3-apache
volumes:
- content:/var/www/html/
apache-lb:
image: rancher/lb-service-haproxy:v0.6.4
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ServerName html.com
ServerAlias www.html.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
version: '2'
services:
apache:
image: php:7.1.3-apache
ports:
- "80:80"
@amy
amy / urg
Last active April 27, 2017 00:59
Goal: map result of query onto foo.
Issue: Only one of the structs is in the array.
I'm using gorm as an ORM.
type Bar struct {
test1 string
test2 string
}