From 96341ed36f24d3b754964135a133f907f5d27f4a Mon Sep 17 00:00:00 2001
From: Carlos Nieto <jose.carlos@menteslibres.net>
Date: Tue, 5 Nov 2013 17:39:40 -0600
Subject: [PATCH] Removing old examples.

---
 _examples/mongo/main.go          | 93 --------------------------------
 _examples/mysql/Makefile         |  2 -
 _examples/mysql/example.sql      |  4 --
 _examples/mysql/main.go          | 93 --------------------------------
 _examples/postgresql/Makefile    |  2 -
 _examples/postgresql/example.sql |  4 --
 _examples/postgresql/main.go     | 93 --------------------------------
 _examples/sqlite/Makefile        |  2 -
 _examples/sqlite/example.sql     |  4 --
 _examples/sqlite/main.go         | 90 -------------------------------
 mongo/_examples/mongo.go         | 48 -----------------
 11 files changed, 435 deletions(-)
 delete mode 100644 _examples/mongo/main.go
 delete mode 100644 _examples/mysql/Makefile
 delete mode 100644 _examples/mysql/example.sql
 delete mode 100644 _examples/mysql/main.go
 delete mode 100644 _examples/postgresql/Makefile
 delete mode 100644 _examples/postgresql/example.sql
 delete mode 100644 _examples/postgresql/main.go
 delete mode 100644 _examples/sqlite/Makefile
 delete mode 100644 _examples/sqlite/example.sql
 delete mode 100644 _examples/sqlite/main.go
 delete mode 100644 mongo/_examples/mongo.go

diff --git a/_examples/mongo/main.go b/_examples/mongo/main.go
deleted file mode 100644
index 72ed1564..00000000
--- a/_examples/mongo/main.go
+++ /dev/null
@@ -1,93 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"time"
-	"upper.io/db"
-	_ "upper.io/db/mongo"
-)
-
-var settings = db.Settings{
-	Database: `upperio_tests`,
-	Host:     `127.0.0.1`,
-}
-
-type Birthday struct {
-	Name string    `bson:"name"`
-	Born time.Time `bson:"born"`
-}
-
-func main() {
-
-	sess, err := db.Open("mongo", settings)
-
-	if err != nil {
-		fmt.Println("Unable to connect:", err.Error())
-		return
-	}
-
-	defer sess.Close()
-
-	birthdayCollection, err := sess.Collection("birthdays")
-
-	if err != nil {
-		if err != db.ErrCollectionDoesNotExists {
-			fmt.Println("Could not use collection:", err.Error())
-			return
-		}
-	} else {
-		err = birthdayCollection.Truncate()
-
-		if err != nil {
-			fmt.Println(err.Error())
-			return
-		}
-	}
-
-	birthdayCollection.Append(Birthday{
-		Name: "Hayao Miyazaki",
-		Born: time.Date(1941, time.January, 5, 0, 0, 0, 0, time.UTC),
-	})
-
-	birthdayCollection.Append(Birthday{
-		Name: "Nobuo Uematsu",
-		Born: time.Date(1959, time.March, 21, 0, 0, 0, 0, time.UTC),
-	})
-
-	birthdayCollection.Append(Birthday{
-		Name: "Hironobu Sakaguchi",
-		Born: time.Date(1962, time.November, 25, 0, 0, 0, 0, time.UTC),
-	})
-
-	var res db.Result
-
-	res = birthdayCollection.Find()
-
-	var birthdays []Birthday
-	var birthday Birthday
-
-	// Pulling all at once.
-	err = res.All(&birthdays)
-
-	if err != nil {
-		panic(err.Error())
-		return
-	}
-
-	for _, birthday = range birthdays {
-		fmt.Printf("%s was born in %s.\n", birthday.Name, birthday.Born.Format("January 2, 2006"))
-	}
-
-	// Pulling one by one
-	for {
-		err = res.Next(&birthday)
-		if err == nil {
-			fmt.Printf("%s was born in %s.\n", birthday.Name, birthday.Born.Format("January 2, 2006"))
-		} else if err == db.ErrNoMoreRows {
-			break
-		} else {
-			panic(err.Error())
-		}
-	}
-
-}
diff --git a/_examples/mysql/Makefile b/_examples/mysql/Makefile
deleted file mode 100644
index 7c96e037..00000000
--- a/_examples/mysql/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-all:
-	cat example.sql | mysql -uupperio -pupperio upperio_tests
diff --git a/_examples/mysql/example.sql b/_examples/mysql/example.sql
deleted file mode 100644
index b4d9cf76..00000000
--- a/_examples/mysql/example.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-CREATE TABLE birthdays (
-	`name` VARCHAR(50),
-	`born` DATE
-);
diff --git a/_examples/mysql/main.go b/_examples/mysql/main.go
deleted file mode 100644
index 28036d5d..00000000
--- a/_examples/mysql/main.go
+++ /dev/null
@@ -1,93 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"time"
-	"upper.io/db"
-	_ "upper.io/db/mysql"
-)
-
-var settings = db.Settings{
-	Database: `upperio_tests`,
-	Socket:   `/var/run/mysqld/mysqld.sock`,
-	User:     `upperio`,
-	Password: `upperio`,
-}
-
-type Birthday struct {
-	Name string    `field:"name"`
-	Born time.Time `field:"born"`
-}
-
-func main() {
-
-	sess, err := db.Open("mysql", settings)
-
-	if err != nil {
-		fmt.Println("Unable to connect:", err.Error())
-		return
-	}
-
-	defer sess.Close()
-
-	birthdayCollection, err := sess.Collection("birthdays")
-
-	if err != nil {
-		fmt.Println("Could not use collection:", err.Error())
-		return
-	}
-
-	err = birthdayCollection.Truncate()
-
-	if err != nil {
-		fmt.Println(err.Error())
-		return
-	}
-
-	birthdayCollection.Append(Birthday{
-		Name: "Hayao Miyazaki",
-		Born: time.Date(1941, time.January, 5, 0, 0, 0, 0, time.UTC),
-	})
-
-	birthdayCollection.Append(Birthday{
-		Name: "Nobuo Uematsu",
-		Born: time.Date(1959, time.March, 21, 0, 0, 0, 0, time.UTC),
-	})
-
-	birthdayCollection.Append(Birthday{
-		Name: "Hironobu Sakaguchi",
-		Born: time.Date(1962, time.November, 25, 0, 0, 0, 0, time.UTC),
-	})
-
-	var res db.Result
-
-	res = birthdayCollection.Find()
-
-	var birthdays []Birthday
-	var birthday Birthday
-
-	// Pulling all at once.
-	err = res.All(&birthdays)
-
-	if err != nil {
-		panic(err.Error())
-		return
-	}
-
-	for _, birthday = range birthdays {
-		fmt.Printf("%s was born in %s.\n", birthday.Name, birthday.Born.Format("January 2, 2006"))
-	}
-
-	// Pulling one by one
-	for {
-		err = res.Next(&birthday)
-		if err == nil {
-			fmt.Printf("%s was born in %s.\n", birthday.Name, birthday.Born.Format("January 2, 2006"))
-		} else if err == db.ErrNoMoreRows {
-			break
-		} else {
-			panic(err.Error())
-		}
-	}
-
-}
diff --git a/_examples/postgresql/Makefile b/_examples/postgresql/Makefile
deleted file mode 100644
index cfb21a65..00000000
--- a/_examples/postgresql/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-all:
-	cat example.sql | PGPASSWORD=upperio psql -Uupperio upperio_tests
diff --git a/_examples/postgresql/example.sql b/_examples/postgresql/example.sql
deleted file mode 100644
index 14101851..00000000
--- a/_examples/postgresql/example.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-CREATE TABLE "birthdays" (
-	"name" CHARACTER VARYING(50),
-	"born" TIMESTAMP
-);
diff --git a/_examples/postgresql/main.go b/_examples/postgresql/main.go
deleted file mode 100644
index 358cc46e..00000000
--- a/_examples/postgresql/main.go
+++ /dev/null
@@ -1,93 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"time"
-	"upper.io/db"
-	_ "upper.io/db/postgresql"
-)
-
-var settings = db.Settings{
-	Database: `upperio_tests`,
-	Socket:   `/var/run/postgresql/`,
-	User:     `upperio`,
-	Password: `upperio`,
-}
-
-type Birthday struct {
-	Name string    `field:"name"`
-	Born time.Time `field:"born"`
-}
-
-func main() {
-
-	sess, err := db.Open("postgresql", settings)
-
-	if err != nil {
-		fmt.Println("Unable to connect:", err.Error())
-		return
-	}
-
-	defer sess.Close()
-
-	birthdayCollection, err := sess.Collection("birthdays")
-
-	if err != nil {
-		fmt.Println("Could not use collection:", err.Error())
-		return
-	}
-
-	err = birthdayCollection.Truncate()
-
-	if err != nil {
-		fmt.Println(err.Error())
-		return
-	}
-
-	birthdayCollection.Append(Birthday{
-		Name: "Hayao Miyazaki",
-		Born: time.Date(1941, time.January, 5, 0, 0, 0, 0, time.UTC),
-	})
-
-	birthdayCollection.Append(Birthday{
-		Name: "Nobuo Uematsu",
-		Born: time.Date(1959, time.March, 21, 0, 0, 0, 0, time.UTC),
-	})
-
-	birthdayCollection.Append(Birthday{
-		Name: "Hironobu Sakaguchi",
-		Born: time.Date(1962, time.November, 25, 0, 0, 0, 0, time.UTC),
-	})
-
-	var res db.Result
-
-	res = birthdayCollection.Find()
-
-	var birthdays []Birthday
-	var birthday Birthday
-
-	// Pulling all at once.
-	err = res.All(&birthdays)
-
-	if err != nil {
-		panic(err.Error())
-		return
-	}
-
-	for _, birthday = range birthdays {
-		fmt.Printf("%s was born in %s.\n", birthday.Name, birthday.Born.Format("January 2, 2006"))
-	}
-
-	// Pulling one by one
-	for {
-		err = res.Next(&birthday)
-		if err == nil {
-			fmt.Printf("%s was born in %s.\n", birthday.Name, birthday.Born.Format("January 2, 2006"))
-		} else if err == db.ErrNoMoreRows {
-			break
-		} else {
-			panic(err.Error())
-		}
-	}
-
-}
diff --git a/_examples/sqlite/Makefile b/_examples/sqlite/Makefile
deleted file mode 100644
index 03dd503d..00000000
--- a/_examples/sqlite/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-all:
-	cat example.sql | sqlite3 example.db
diff --git a/_examples/sqlite/example.sql b/_examples/sqlite/example.sql
deleted file mode 100644
index 947974fe..00000000
--- a/_examples/sqlite/example.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-CREATE TABLE "birthdays" (
-  "name" varchar(50) DEFAULT NULL,
-  "born" varchar(12) DEFAULT NULL,
-);
diff --git a/_examples/sqlite/main.go b/_examples/sqlite/main.go
deleted file mode 100644
index e196ec46..00000000
--- a/_examples/sqlite/main.go
+++ /dev/null
@@ -1,90 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"time"
-	"upper.io/db"
-	_ "upper.io/db/sqlite"
-)
-
-var settings = db.Settings{
-	Database: `example.db`,
-}
-
-type Birthday struct {
-	Name string    `field:"name"`
-	Born time.Time `field:"born"`
-}
-
-func main() {
-
-	sess, err := db.Open("sqlite", settings)
-
-	if err != nil {
-		fmt.Println("Please create the `example.db` sqlite3 database.")
-		return
-	}
-
-	defer sess.Close()
-
-	birthdayCollection, err := sess.Collection("birthdays")
-
-	if err != nil {
-		fmt.Println(err.Error())
-		return
-	}
-
-	err = birthdayCollection.Truncate()
-
-	if err != nil {
-		fmt.Println(err.Error())
-		return
-	}
-
-	birthdayCollection.Append(Birthday{
-		Name: "Hayao Miyazaki",
-		Born: time.Date(1941, time.January, 5, 0, 0, 0, 0, time.UTC),
-	})
-
-	birthdayCollection.Append(Birthday{
-		Name: "Nobuo Uematsu",
-		Born: time.Date(1959, time.March, 21, 0, 0, 0, 0, time.UTC),
-	})
-
-	birthdayCollection.Append(Birthday{
-		Name: "Hironobu Sakaguchi",
-		Born: time.Date(1962, time.November, 25, 0, 0, 0, 0, time.UTC),
-	})
-
-	var res db.Result
-
-	res = birthdayCollection.Find()
-
-	var birthdays []Birthday
-	var birthday Birthday
-
-	// Pulling all at once.
-	err = res.All(&birthdays)
-
-	if err != nil {
-		panic(err.Error())
-		return
-	}
-
-	for _, birthday = range birthdays {
-		fmt.Printf("%s was born in %s.\n", birthday.Name, birthday.Born.Format("January 2, 2006"))
-	}
-
-	// Pulling one by one
-	for {
-		err = res.Next(&birthday)
-		if err == nil {
-			fmt.Printf("%s was born in %s.\n", birthday.Name, birthday.Born.Format("January 2, 2006"))
-		} else if err == db.ErrNoMoreRows {
-			break
-		} else {
-			panic(err.Error())
-		}
-	}
-
-}
diff --git a/mongo/_examples/mongo.go b/mongo/_examples/mongo.go
deleted file mode 100644
index 46bb6403..00000000
--- a/mongo/_examples/mongo.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"upper.io/db"
-	"upper.io/db/mongo"
-	"github.com/kr/pretty"
-)
-
-func main() {
-	sess := mongo.Session(db.DataSource{Host: "10.0.0.11", Database: "gotest"})
-
-	err := sess.Open()
-	defer sess.Close()
-
-	if err != nil {
-		panic(err)
-	}
-
-	col := sess.Collection("people")
-
-	result := col.FindAll(
-		db.Relate{
-			"lives_in": db.On{
-				sess.Collection("places"),
-				db.Cond{"code_id": "{place_code_id}"},
-			},
-		},
-		db.RelateAll{
-			"has_children": db.On{
-				sess.Collection("children"),
-				db.Cond{"parent_id": "{_id}"},
-			},
-			"has_visited": db.On{
-				sess.Collection("visits"),
-				db.Cond{"person_id": "{_id}"},
-				db.Relate{
-					"place": db.On{
-						sess.Collection("places"),
-						db.Cond{"_id": "{place_id}"},
-					},
-				},
-			},
-		},
-	)
-
-	fmt.Printf("%# v\n", pretty.Formatter(result))
-}
-- 
GitLab