aboutsummaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
authorFelix Hanley <felix@userspace.com.au>2018-01-03 13:21:23 +0000
committerFelix Hanley <felix@userspace.com.au>2018-01-03 13:21:23 +0000
commitc428d3bbcd66b64d55297a772cb71ed5e0767614 (patch)
tree5513824ce32bb59c9e0d786959de91d73c8a7e33 /vendor
parent9e19584ff19a9dbdf6c024e21ff29383400fa80f (diff)
downloaddhtsearch-c428d3bbcd66b64d55297a772cb71ed5e0767614.tar.gz
dhtsearch-c428d3bbcd66b64d55297a772cb71ed5e0767614.tar.bz2
Update deps
Diffstat (limited to 'vendor')
-rw-r--r--vendor/github.com/BurntSushi/toml/_examples/example.go61
-rw-r--r--vendor/github.com/BurntSushi/toml/_examples/example.toml35
-rw-r--r--vendor/github.com/BurntSushi/toml/_examples/hard.toml22
-rw-r--r--vendor/github.com/BurntSushi/toml/_examples/implicit.toml4
-rw-r--r--vendor/github.com/BurntSushi/toml/_examples/invalid-apples.toml6
-rw-r--r--vendor/github.com/BurntSushi/toml/_examples/invalid.toml35
-rw-r--r--vendor/github.com/BurntSushi/toml/_examples/readme1.toml5
-rw-r--r--vendor/github.com/BurntSushi/toml/_examples/readme2.toml1
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING14
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/README.md13
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/main.go90
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING14
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/README.md13
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/main.go131
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/tomlv/COPYING14
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/tomlv/README.md21
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/tomlv/main.go61
-rw-r--r--vendor/github.com/jackc/pgx/examples/README.md7
-rw-r--r--vendor/github.com/jackc/pgx/examples/chat/README.md25
-rw-r--r--vendor/github.com/jackc/pgx/examples/chat/main.go95
-rw-r--r--vendor/github.com/jackc/pgx/examples/todo/README.md72
-rw-r--r--vendor/github.com/jackc/pgx/examples/todo/main.go140
-rw-r--r--vendor/github.com/jackc/pgx/examples/todo/structure.sql4
-rw-r--r--vendor/github.com/jackc/pgx/examples/url_shortener/README.md25
-rw-r--r--vendor/github.com/jackc/pgx/examples/url_shortener/main.go128
-rw-r--r--vendor/github.com/jackc/pgx/examples/url_shortener/structure.sql4
-rw-r--r--vendor/github.com/jmoiron/sqlx/types/README.md5
-rw-r--r--vendor/github.com/jmoiron/sqlx/types/types.go172
-rw-r--r--vendor/github.com/jmoiron/sqlx/types/types_test.go127
29 files changed, 0 insertions, 1344 deletions
diff --git a/vendor/github.com/BurntSushi/toml/_examples/example.go b/vendor/github.com/BurntSushi/toml/_examples/example.go
deleted file mode 100644
index 79f31f2..0000000
--- a/vendor/github.com/BurntSushi/toml/_examples/example.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package main
-
-import (
- "fmt"
- "time"
-
- "github.com/BurntSushi/toml"
-)
-
-type tomlConfig struct {
- Title string
- Owner ownerInfo
- DB database `toml:"database"`
- Servers map[string]server
- Clients clients
-}
-
-type ownerInfo struct {
- Name string
- Org string `toml:"organization"`
- Bio string
- DOB time.Time
-}
-
-type database struct {
- Server string
- Ports []int
- ConnMax int `toml:"connection_max"`
- Enabled bool
-}
-
-type server struct {
- IP string
- DC string
-}
-
-type clients struct {
- Data [][]interface{}
- Hosts []string
-}
-
-func main() {
- var config tomlConfig
- if _, err := toml.DecodeFile("example.toml", &config); err != nil {
- fmt.Println(err)
- return
- }
-
- fmt.Printf("Title: %s\n", config.Title)
- fmt.Printf("Owner: %s (%s, %s), Born: %s\n",
- config.Owner.Name, config.Owner.Org, config.Owner.Bio,
- config.Owner.DOB)
- fmt.Printf("Database: %s %v (Max conn. %d), Enabled? %v\n",
- config.DB.Server, config.DB.Ports, config.DB.ConnMax,
- config.DB.Enabled)
- for serverName, server := range config.Servers {
- fmt.Printf("Server: %s (%s, %s)\n", serverName, server.IP, server.DC)
- }
- fmt.Printf("Client data: %v\n", config.Clients.Data)
- fmt.Printf("Client hosts: %v\n", config.Clients.Hosts)
-}
diff --git a/vendor/github.com/BurntSushi/toml/_examples/example.toml b/vendor/github.com/BurntSushi/toml/_examples/example.toml
deleted file mode 100644
index 32c7a4f..0000000
--- a/vendor/github.com/BurntSushi/toml/_examples/example.toml
+++ /dev/null
@@ -1,35 +0,0 @@
-# This is a TOML document. Boom.
-
-title = "TOML Example"
-
-[owner]
-name = "Tom Preston-Werner"
-organization = "GitHub"
-bio = "GitHub Cofounder & CEO\nLikes tater tots and beer."
-dob = 1979-05-27T07:32:00Z # First class dates? Why not?
-
-[database]
-server = "192.168.1.1"
-ports = [ 8001, 8001, 8002 ]
-connection_max = 5000
-enabled = true
-
-[servers]
-
- # You can indent as you please. Tabs or spaces. TOML don't care.
- [servers.alpha]
- ip = "10.0.0.1"
- dc = "eqdc10"
-
- [servers.beta]
- ip = "10.0.0.2"
- dc = "eqdc10"
-
-[clients]
-data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it
-
-# Line breaks are OK when inside arrays
-hosts = [
- "alpha",
- "omega"
-]
diff --git a/vendor/github.com/BurntSushi/toml/_examples/hard.toml b/vendor/github.com/BurntSushi/toml/_examples/hard.toml
deleted file mode 100644
index 26145d2..0000000
--- a/vendor/github.com/BurntSushi/toml/_examples/hard.toml
+++ /dev/null
@@ -1,22 +0,0 @@
-# Test file for TOML
-# Only this one tries to emulate a TOML file written by a user of the kind of parser writers probably hate
-# This part you'll really hate
-
-[the]
-test_string = "You'll hate me after this - #" # " Annoying, isn't it?
-
- [the.hard]
- test_array = [ "] ", " # "] # ] There you go, parse this!
- test_array2 = [ "Test #11 ]proved that", "Experiment #9 was a success" ]
- # You didn't think it'd as easy as chucking out the last #, did you?
- another_test_string = " Same thing, but with a string #"
- harder_test_string = " And when \"'s are in the string, along with # \"" # "and comments are there too"
- # Things will get harder
-
- [the.hard.bit#]
- what? = "You don't think some user won't do that?"
- multi_line_array = [
- "]",
- # ] Oh yes I did
- ]
-
diff --git a/vendor/github.com/BurntSushi/toml/_examples/implicit.toml b/vendor/github.com/BurntSushi/toml/_examples/implicit.toml
deleted file mode 100644
index 1dea5ce..0000000
--- a/vendor/github.com/BurntSushi/toml/_examples/implicit.toml
+++ /dev/null
@@ -1,4 +0,0 @@
-# [x] you
-# [x.y] don't
-# [x.y.z] need these
-[x.y.z.w] # for this to work
diff --git a/vendor/github.com/BurntSushi/toml/_examples/invalid-apples.toml b/vendor/github.com/BurntSushi/toml/_examples/invalid-apples.toml
deleted file mode 100644
index 74e9e33..0000000
--- a/vendor/github.com/BurntSushi/toml/_examples/invalid-apples.toml
+++ /dev/null
@@ -1,6 +0,0 @@
-# DO NOT WANT
-[fruit]
-type = "apple"
-
-[fruit.type]
-apple = "yes"
diff --git a/vendor/github.com/BurntSushi/toml/_examples/invalid.toml b/vendor/github.com/BurntSushi/toml/_examples/invalid.toml
deleted file mode 100644
index beb1dba..0000000
--- a/vendor/github.com/BurntSushi/toml/_examples/invalid.toml
+++ /dev/null
@@ -1,35 +0,0 @@
-# This is an INVALID TOML document. Boom.
-# Can you spot the error without help?
-
-title = "TOML Example"
-
-[owner]
-name = "Tom Preston-Werner"
-organization = "GitHub"
-bio = "GitHub Cofounder & CEO\nLikes tater tots and beer."
-dob = 1979-05-27T7:32:00Z # First class dates? Why not?
-
-[database]
-server = "192.168.1.1"
-ports = [ 8001, 8001, 8002 ]
-connection_max = 5000
-enabled = true
-
-[servers]
- # You can indent as you please. Tabs or spaces. TOML don't care.
- [servers.alpha]
- ip = "10.0.0.1"
- dc = "eqdc10"
-
- [servers.beta]
- ip = "10.0.0.2"
- dc = "eqdc10"
-
-[clients]
-data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it
-
-# Line breaks are OK when inside arrays
-hosts = [
- "alpha",
- "omega"
-]
diff --git a/vendor/github.com/BurntSushi/toml/_examples/readme1.toml b/vendor/github.com/BurntSushi/toml/_examples/readme1.toml
deleted file mode 100644
index 3e1261d..0000000
--- a/vendor/github.com/BurntSushi/toml/_examples/readme1.toml
+++ /dev/null
@@ -1,5 +0,0 @@
-Age = 25
-Cats = [ "Cauchy", "Plato" ]
-Pi = 3.14
-Perfection = [ 6, 28, 496, 8128 ]
-DOB = 1987-07-05T05:45:00Z
diff --git a/vendor/github.com/BurntSushi/toml/_examples/readme2.toml b/vendor/github.com/BurntSushi/toml/_examples/readme2.toml
deleted file mode 100644
index b51cd93..0000000
--- a/vendor/github.com/BurntSushi/toml/_examples/readme2.toml
+++ /dev/null
@@ -1 +0,0 @@
-some_key_NAME = "wat"
diff --git a/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING b/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING
deleted file mode 100644
index 5a8e332..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING
+++ /dev/null
@@ -1,14 +0,0 @@
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- Version 2, December 2004
-
- Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
-
- Everyone is permitted to copy and distribute verbatim or modified
- copies of this license document, and changing it is allowed as long
- as the name is changed.
-
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. You just DO WHAT THE FUCK YOU WANT TO.
-
diff --git a/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/README.md b/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/README.md
deleted file mode 100644
index 93f4e3a..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Implements the TOML test suite interface
-
-This is an implementation of the interface expected by
-[toml-test](https://github.com/BurntSushi/toml-test) for my
-[toml parser written in Go](https://github.com/BurntSushi/toml).
-In particular, it maps TOML data on `stdin` to a JSON format on `stdout`.
-
-
-Compatible with TOML version
-[v0.4.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md)
-
-Compatible with `toml-test` version
-[v0.2.0](https://github.com/BurntSushi/toml-test/tree/v0.2.0)
diff --git a/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/main.go b/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/main.go
deleted file mode 100644
index 14e7557..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/main.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// Command toml-test-decoder satisfies the toml-test interface for testing
-// TOML decoders. Namely, it accepts TOML on stdin and outputs JSON on stdout.
-package main
-
-import (
- "encoding/json"
- "flag"
- "fmt"
- "log"
- "os"
- "path"
- "time"
-
- "github.com/BurntSushi/toml"
-)
-
-func init() {
- log.SetFlags(0)
-
- flag.Usage = usage
- flag.Parse()
-}
-
-func usage() {
- log.Printf("Usage: %s < toml-file\n", path.Base(os.Args[0]))
- flag.PrintDefaults()
-
- os.Exit(1)
-}
-
-func main() {
- if flag.NArg() != 0 {
- flag.Usage()
- }
-
- var tmp interface{}
- if _, err := toml.DecodeReader(os.Stdin, &tmp); err != nil {
- log.Fatalf("Error decoding TOML: %s", err)
- }
-
- typedTmp := translate(tmp)
- if err := json.NewEncoder(os.Stdout).Encode(typedTmp); err != nil {
- log.Fatalf("Error encoding JSON: %s", err)
- }
-}
-
-func translate(tomlData interface{}) interface{} {
- switch orig := tomlData.(type) {
- case map[string]interface{}:
- typed := make(map[string]interface{}, len(orig))
- for k, v := range orig {
- typed[k] = translate(v)
- }
- return typed
- case []map[string]interface{}:
- typed := make([]map[string]interface{}, len(orig))
- for i, v := range orig {
- typed[i] = translate(v).(map[string]interface{})
- }
- return typed
- case []interface{}:
- typed := make([]interface{}, len(orig))
- for i, v := range orig {
- typed[i] = translate(v)
- }
-
- // We don't really need to tag arrays, but let's be future proof.
- // (If TOML ever supports tuples, we'll need this.)
- return tag("array", typed)
- case time.Time:
- return tag("datetime", orig.Format("2006-01-02T15:04:05Z"))
- case bool:
- return tag("bool", fmt.Sprintf("%v", orig))
- case int64:
- return tag("integer", fmt.Sprintf("%d", orig))
- case float64:
- return tag("float", fmt.Sprintf("%v", orig))
- case string:
- return tag("string", orig)
- }
-
- panic(fmt.Sprintf("Unknown type: %T", tomlData))
-}
-
-func tag(typeName string, data interface{}) map[string]interface{} {
- return map[string]interface{}{
- "type": typeName,
- "value": data,
- }
-}
diff --git a/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING b/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING
deleted file mode 100644
index 5a8e332..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING
+++ /dev/null
@@ -1,14 +0,0 @@
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- Version 2, December 2004
-
- Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
-
- Everyone is permitted to copy and distribute verbatim or modified
- copies of this license document, and changing it is allowed as long
- as the name is changed.
-
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. You just DO WHAT THE FUCK YOU WANT TO.
-
diff --git a/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/README.md b/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/README.md
deleted file mode 100644
index a45bd4d..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Implements the TOML test suite interface for TOML encoders
-
-This is an implementation of the interface expected by
-[toml-test](https://github.com/BurntSushi/toml-test) for the
-[TOML encoder](https://github.com/BurntSushi/toml).
-In particular, it maps JSON data on `stdin` to a TOML format on `stdout`.
-
-
-Compatible with TOML version
-[v0.4.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md)
-
-Compatible with `toml-test` version
-[v0.2.0](https://github.com/BurntSushi/toml-test/tree/v0.2.0)
diff --git a/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/main.go b/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/main.go
deleted file mode 100644
index 092cc68..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/main.go
+++ /dev/null
@@ -1,131 +0,0 @@
-// Command toml-test-encoder satisfies the toml-test interface for testing
-// TOML encoders. Namely, it accepts JSON on stdin and outputs TOML on stdout.
-package main
-
-import (
- "encoding/json"
- "flag"
- "log"
- "os"
- "path"
- "strconv"
- "time"
-
- "github.com/BurntSushi/toml"
-)
-
-func init() {
- log.SetFlags(0)
-
- flag.Usage = usage
- flag.Parse()
-}
-
-func usage() {
- log.Printf("Usage: %s < json-file\n", path.Base(os.Args[0]))
- flag.PrintDefaults()
-
- os.Exit(1)
-}
-
-func main() {
- if flag.NArg() != 0 {
- flag.Usage()
- }
-
- var tmp interface{}
- if err := json.NewDecoder(os.Stdin).Decode(&tmp); err != nil {
- log.Fatalf("Error decoding JSON: %s", err)
- }
-
- tomlData := translate(tmp)
- if err := toml.NewEncoder(os.Stdout).Encode(tomlData); err != nil {
- log.Fatalf("Error encoding TOML: %s", err)
- }
-}
-
-func translate(typedJson interface{}) interface{} {
- switch v := typedJson.(type) {
- case map[string]interface{}:
- if len(v) == 2 && in("type", v) && in("value", v) {
- return untag(v)
- }
- m := make(map[string]interface{}, len(v))
- for k, v2 := range v {
- m[k] = translate(v2)
- }
- return m
- case []interface{}:
- tabArray := make([]map[string]interface{}, len(v))
- for i := range v {
- if m, ok := translate(v[i]).(map[string]interface{}); ok {
- tabArray[i] = m
- } else {
- log.Fatalf("JSON arrays may only contain objects. This " +
- "corresponds to only tables being allowed in " +
- "TOML table arrays.")
- }
- }
- return tabArray
- }
- log.Fatalf("Unrecognized JSON format '%T'.", typedJson)
- panic("unreachable")
-}
-
-func untag(typed map[string]interface{}) interface{} {
- t := typed["type"].(string)
- v := typed["value"]
- switch t {
- case "string":
- return v.(string)
- case "integer":
- v := v.(string)
- n, err := strconv.Atoi(v)
- if err != nil {
- log.Fatalf("Could not parse '%s' as integer: %s", v, err)
- }
- return n
- case "float":
- v := v.(string)
- f, err := strconv.ParseFloat(v, 64)
- if err != nil {
- log.Fatalf("Could not parse '%s' as float64: %s", v, err)
- }
- return f
- case "datetime":
- v := v.(string)
- t, err := time.Parse("2006-01-02T15:04:05Z", v)
- if err != nil {
- log.Fatalf("Could not parse '%s' as a datetime: %s", v, err)
- }
- return t
- case "bool":
- v := v.(string)
- switch v {
- case "true":
- return true
- case "false":
- return false
- }
- log.Fatalf("Could not parse '%s' as a boolean.", v)
- case "array":
- v := v.([]interface{})
- array := make([]interface{}, len(v))
- for i := range v {
- if m, ok := v[i].(map[string]interface{}); ok {
- array[i] = untag(m)
- } else {
- log.Fatalf("Arrays may only contain other arrays or "+
- "primitive values, but found a '%T'.", m)
- }
- }
- return array
- }
- log.Fatalf("Unrecognized tag type '%s'.", t)
- panic("unreachable")
-}
-
-func in(key string, m map[string]interface{}) bool {
- _, ok := m[key]
- return ok
-}
diff --git a/vendor/github.com/BurntSushi/toml/cmd/tomlv/COPYING b/vendor/github.com/BurntSushi/toml/cmd/tomlv/COPYING
deleted file mode 100644
index 5a8e332..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/tomlv/COPYING
+++ /dev/null
@@ -1,14 +0,0 @@
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- Version 2, December 2004
-
- Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
-
- Everyone is permitted to copy and distribute verbatim or modified
- copies of this license document, and changing it is allowed as long
- as the name is changed.
-
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. You just DO WHAT THE FUCK YOU WANT TO.
-
diff --git a/vendor/github.com/BurntSushi/toml/cmd/tomlv/README.md b/vendor/github.com/BurntSushi/toml/cmd/tomlv/README.md
deleted file mode 100644
index 51231e2..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/tomlv/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# TOML Validator
-
-If Go is installed, it's simple to try it out:
-
-```bash
-go get github.com/BurntSushi/toml/cmd/tomlv
-tomlv some-toml-file.toml
-```
-
-You can see the types of every key in a TOML file with:
-
-```bash
-tomlv -types some-toml-file.toml
-```
-
-At the moment, only one error message is reported at a time. Error messages
-include line numbers. No output means that the files given are valid TOML, or
-there is a bug in `tomlv`.
-
-Compatible with TOML version
-[v0.4.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md)
diff --git a/vendor/github.com/BurntSushi/toml/cmd/tomlv/main.go b/vendor/github.com/BurntSushi/toml/cmd/tomlv/main.go
deleted file mode 100644
index c7d689a..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/tomlv/main.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Command tomlv validates TOML documents and prints each key's type.
-package main
-
-import (
- "flag"
- "fmt"
- "log"
- "os"
- "path"
- "strings"
- "text/tabwriter"
-
- "github.com/BurntSushi/toml"
-)
-
-var (
- flagTypes = false
-)
-
-func init() {
- log.SetFlags(0)
-
- flag.BoolVar(&flagTypes, "types", flagTypes,
- "When set, the types of every defined key will be shown.")
-
- flag.Usage = usage
- flag.Parse()
-}
-
-func usage() {
- log.Printf("Usage: %s toml-file [ toml-file ... ]\n",
- path.Base(os.Args[0]))
- flag.PrintDefaults()
-
- os.Exit(1)
-}
-
-func main() {
- if flag.NArg() < 1 {
- flag.Usage()
- }
- for _, f := range flag.Args() {
- var tmp interface{}
- md, err := toml.DecodeFile(f, &tmp)
- if err != nil {
- log.Fatalf("Error in '%s': %s", f, err)
- }
- if flagTypes {
- printTypes(md)
- }
- }
-}
-
-func printTypes(md toml.MetaData) {
- tabw := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- for _, key := range md.Keys() {
- fmt.Fprintf(tabw, "%s%s\t%s\n",
- strings.Repeat(" ", len(key)-1), key, md.Type(key...))
- }
- tabw.Flush()
-}
diff --git a/vendor/github.com/jackc/pgx/examples/README.md b/vendor/github.com/jackc/pgx/examples/README.md
deleted file mode 100644
index 6a97bc0..0000000
--- a/vendor/github.com/jackc/pgx/examples/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# Examples
-
-* chat is a command line chat program using listen/notify.
-* todo is a command line todo list that demonstrates basic CRUD actions.
-* url_shortener contains a simple example of using pgx in a web context.
-* [Tern](https://github.com/jackc/tern) is a migration tool that uses pgx (uses v1 of pgx).
-* [The Pithy Reader](https://github.com/jackc/tpr) is a RSS aggregator that uses pgx.
diff --git a/vendor/github.com/jackc/pgx/examples/chat/README.md b/vendor/github.com/jackc/pgx/examples/chat/README.md
deleted file mode 100644
index a093525..0000000
--- a/vendor/github.com/jackc/pgx/examples/chat/README.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# Description
-
-This is a sample chat program implemented using PostgreSQL's listen/notify
-functionality with pgx.
-
-Start multiple instances of this program connected to the same database to chat
-between them.
-
-## Connection configuration
-
-The database connection is configured via enviroment variables.
-
-* CHAT_DB_HOST - defaults to localhost
-* CHAT_DB_USER - defaults to current OS user
-* CHAT_DB_PASSWORD - defaults to empty string
-* CHAT_DB_DATABASE - defaults to postgres
-
-You can either export them then run chat:
-
- export CHAT_DB_HOST=/private/tmp
- ./chat
-
-Or you can prefix the chat execution with the environment variables:
-
- CHAT_DB_HOST=/private/tmp ./chat
diff --git a/vendor/github.com/jackc/pgx/examples/chat/main.go b/vendor/github.com/jackc/pgx/examples/chat/main.go
deleted file mode 100644
index 517508c..0000000
--- a/vendor/github.com/jackc/pgx/examples/chat/main.go
+++ /dev/null
@@ -1,95 +0,0 @@
-package main
-
-import (
- "bufio"
- "fmt"
- "github.com/jackc/pgx"
- "os"
- "time"
-)
-
-var pool *pgx.ConnPool
-
-func main() {
- var err error
- pool, err = pgx.NewConnPool(extractConfig())
- if err != nil {
- fmt.Fprintln(os.Stderr, "Unable to connect to database:", err)
- os.Exit(1)
- }
-
- go listen()
-
- fmt.Println(`Type a message and press enter.
-
-This message should appear in any other chat instances connected to the same
-database.
-
-Type "exit" to quit.
-`)
-
- scanner := bufio.NewScanner(os.Stdin)
- for scanner.Scan() {
- msg := scanner.Text()
- if msg == "exit" {
- os.Exit(0)
- }
-
- _, err = pool.Exec("select pg_notify('chat', $1)", msg)
- if err != nil {
- fmt.Fprintln(os.Stderr, "Error sending notification:", err)
- os.Exit(1)
- }
- }
- if err := scanner.Err(); err != nil {
- fmt.Fprintln(os.Stderr, "Error scanning from stdin:", err)
- os.Exit(1)
- }
-}
-
-func listen() {
- conn, err := pool.Acquire()
- if err != nil {
- fmt.Fprintln(os.Stderr, "Error acquiring connection:", err)
- os.Exit(1)
- }
- defer pool.Release(conn)
-
- conn.Listen("chat")
-
- for {
- notification, err := conn.WaitForNotification(time.Second)
- if err == pgx.ErrNotificationTimeout {
- continue
- }
- if err != nil {
- fmt.Fprintln(os.Stderr, "Error waiting for notification:", err)
- os.Exit(1)
- }
-
- fmt.Println("PID:", notification.Pid, "Channel:", notification.Channel, "Payload:", notification.Payload)
- }
-}
-
-func extractConfig() pgx.ConnPoolConfig {
- var config pgx.ConnPoolConfig
-
- config.Host = os.Getenv("CHAT_DB_HOST")
- if config.Host == "" {
- config.Host = "localhost"
- }
-
- config.User = os.Getenv("CHAT_DB_USER")
- if config.User == "" {
- config.User = os.Getenv("USER")
- }
-
- config.Password = os.Getenv("CHAT_DB_PASSWORD")
-
- config.Database = os.Getenv("CHAT_DB_DATABASE")
- if config.Database == "" {
- config.Database = "postgres"
- }
-
- return config
-}
diff --git a/vendor/github.com/jackc/pgx/examples/todo/README.md b/vendor/github.com/jackc/pgx/examples/todo/README.md
deleted file mode 100644
index eb3d95b..0000000
--- a/vendor/github.com/jackc/pgx/examples/todo/README.md
+++ /dev/null
@@ -1,72 +0,0 @@
-# Description
-
-This is a sample todo list implemented using pgx as the connector to a
-PostgreSQL data store.
-
-# Usage
-
-Create a PostgreSQL database and run structure.sql into it to create the
-necessary data schema.
-
-Example:
-
- createdb todo
- psql todo < structure.sql
-
-Build todo:
-
- go build
-
-## Connection configuration
-
-The database connection is configured via enviroment variables.
-
-* TODO_DB_HOST - defaults to localhost
-* TODO_DB_USER - defaults to current OS user
-* TODO_DB_PASSWORD - defaults to empty string
-* TODO_DB_DATABASE - defaults to todo
-
-You can either export them then run todo:
-
- export TODO_DB_HOST=/private/tmp
- ./todo list
-
-Or you can prefix the todo execution with the environment variables:
-
- TODO_DB_HOST=/private/tmp ./todo list
-
-## Add a todo item
-
- ./todo add 'Learn go'
-
-## List tasks
-
- ./todo list
-
-## Update a task
-
- ./todo add 1 'Learn more go'
-
-## Delete a task
-
- ./todo remove 1
-
-# Example Setup and Execution
-
- jack@hk-47~/dev/go/src/github.com/jackc/pgx/examples/todo$ createdb todo
- jack@hk-47~/dev/go/src/github.com/jackc/pgx/examples/todo$ psql todo < structure.sql
- Expanded display is used automatically.
- Timing is on.
- CREATE TABLE
- Time: 6.363 ms
- jack@hk-47~/dev/go/src/github.com/jackc/pgx/examples/todo$ go build
- jack@hk-47~/dev/go/src/github.com/jackc/pgx/examples/todo$ export TODO_DB_HOST=/private/tmp
- jack@hk-47~/dev/go/src/github.com/jackc/pgx/examples/todo$ ./todo list
- jack@hk-47~/dev/go/src/github.com/jackc/pgx/examples/todo$ ./todo add 'Learn Go'
- jack@hk-47~/dev/go/src/github.com/jackc/pgx/examples/todo$ ./todo list
- 1. Learn Go
- jack@hk-47~/dev/go/src/github.com/jackc/pgx/examples/todo$ ./todo update 1 'Learn more Go'
- jack@hk-47~/dev/go/src/github.com/jackc/pgx/examples/todo$ ./todo list
- 1. Learn more Go
- jack@hk-47~/dev/go/src/github.com/jackc/pgx/examples/todo$ ./todo remove 1
- jack@hk-47~/dev/go/src/github.com/jackc/pgx/examples/todo$ ./todo list
diff --git a/vendor/github.com/jackc/pgx/examples/todo/main.go b/vendor/github.com/jackc/pgx/examples/todo/main.go
deleted file mode 100644
index bacdf24..0000000
--- a/vendor/github.com/jackc/pgx/examples/todo/main.go
+++ /dev/null
@@ -1,140 +0,0 @@
-package main
-
-import (
- "fmt"
- "github.com/jackc/pgx"
- "os"
- "strconv"
-)
-
-var conn *pgx.Conn
-
-func main() {
- var err error
- conn, err = pgx.Connect(extractConfig())
- if err != nil {
- fmt.Fprintf(os.Stderr, "Unable to connection to database: %v\n", err)
- os.Exit(1)
- }
-
- if len(os.Args) == 1 {
- printHelp()
- os.Exit(0)
- }
-
- switch os.Args[1] {
- case "list":
- err = listTasks()
- if err != nil {
- fmt.Fprintf(os.Stderr, "Unable to list tasks: %v\n", err)
- os.Exit(1)
- }
-
- case "add":
- err = addTask(os.Args[2])
- if err != nil {
- fmt.Fprintf(os.Stderr, "Unable to add task: %v\n", err)
- os.Exit(1)
- }
-
- case "update":
- n, err := strconv.ParseInt(os.Args[2], 10, 32)
- if err != nil {
- fmt.Fprintf(os.Stderr, "Unable convert task_num into int32: %v\n", err)
- os.Exit(1)
- }
- err = updateTask(int32(n), os.Args[3])
- if err != nil {
- fmt.Fprintf(os.Stderr, "Unable to update task: %v\n", err)
- os.Exit(1)
- }
-
- case "remove":
- n, err := strconv.ParseInt(os.Args[2], 10, 32)
- if err != nil {
- fmt.Fprintf(os.Stderr, "Unable convert task_num into int32: %v\n", err)
- os.Exit(1)
- }
- err = removeTask(int32(n))
- if err != nil {
- fmt.Fprintf(os.Stderr, "Unable to remove task: %v\n", err)
- os.Exit(1)
- }
-
- default:
- fmt.Fprintln(os.Stderr, "Invalid command")
- printHelp()
- os.Exit(1)
- }
-}
-
-func listTasks() error {
- rows, _ := conn.Query("select * from tasks")
-
- for rows.Next() {
- var id int32
- var description string
- err := rows.Scan(&id, &description)
- if err != nil {
- return err
- }
- fmt.Printf("%d. %s\n", id, description)
- }
-
- return rows.Err()
-}
-
-func addTask(description string) error {
- _, err := conn.Exec("insert into tasks(description) values($1)", description)
- return err
-}
-
-func updateTask(itemNum int32, description string) error {
- _, err := conn.Exec("update tasks set description=$1 where id=$2", description, itemNum)
- return err
-}
-
-func removeTask(itemNum int32) error {
- _, err := conn.Exec("delete from tasks where id=$1", itemNum)
- return err
-}
-
-func printHelp() {
- fmt.Print(`Todo pgx demo
-
-Usage:
-
- todo list
- todo add task
- todo update task_num item
- todo remove task_num
-
-Example:
-
- todo add 'Learn Go'
- todo list
-`)
-}
-
-func extractConfig() pgx.ConnConfig {
- var config pgx.ConnConfig
-
- config.Host = os.Getenv("TODO_DB_HOST")
- if config.Host == "" {
- config.Host = "localhost"
- }
-
- config.User = os.Getenv("TODO_DB_USER")
- if config.User == "" {
- config.User = os.Getenv("USER")
- }
-
- config.Password = os.Getenv("TODO_DB_PASSWORD")
-
- config.Database = os.Getenv("TODO_DB_DATABASE")
- if config.Database == "" {
- config.Database = "todo"
- }
-
- return config
-}
diff --git a/vendor/github.com/jackc/pgx/examples/todo/structure.sql b/vendor/github.com/jackc/pgx/examples/todo/structure.sql
deleted file mode 100644
index 567685d..0000000
--- a/vendor/github.com/jackc/pgx/examples/todo/structure.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-create table tasks (
- id serial primary key,
- description text not null
-);
diff --git a/vendor/github.com/jackc/pgx/examples/url_shortener/README.md b/vendor/github.com/jackc/pgx/examples/url_shortener/README.md
deleted file mode 100644
index cc04d60..0000000
--- a/vendor/github.com/jackc/pgx/examples/url_shortener/README.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# Description
-
-This is a sample REST URL shortener service implemented using pgx as the connector to a PostgreSQL data store.
-
-# Usage
-
-Create a PostgreSQL database and run structure.sql into it to create the necessary data schema.
-
-Edit connectionOptions in main.go with the location and credentials for your database.
-
-Run main.go:
-
- go run main.go
-
-## Create or Update a Shortened URL
-
- curl -X PUT -d 'http://www.google.com' http://localhost:8080/google
-
-## Get a Shortened URL
-
- curl http://localhost:8080/google
-
-## Delete a Shortened URL
-
- curl -X DELETE http://localhost:8080/google
diff --git a/vendor/github.com/jackc/pgx/examples/url_shortener/main.go b/vendor/github.com/jackc/pgx/examples/url_shortener/main.go
deleted file mode 100644
index f6a22c3..0000000
--- a/vendor/github.com/jackc/pgx/examples/url_shortener/main.go
+++ /dev/null
@@ -1,128 +0,0 @@
-package main
-
-import (
- "github.com/jackc/pgx"
- log "gopkg.in/inconshreveable/log15.v2"
- "io/ioutil"
- "net/http"
- "os"
-)
-
-var pool *pgx.ConnPool
-
-// afterConnect creates the prepared statements that this application uses
-func afterConnect(conn *pgx.Conn) (err error) {
- _, err = conn.Prepare("getUrl", `
- select url from shortened_urls where id=$1
- `)
- if err != nil {
- return
- }
-
- _, err = conn.Prepare("deleteUrl", `
- delete from shortened_urls where id=$1
- `)
- if err != nil {
- return
- }
-
- // There technically is a small race condition in doing an upsert with a CTE
- // where one of two simultaneous requests to the shortened URL would fail
- // with a unique index violation. As the point of this demo is pgx usage and
- // not how to perfectly upsert in PostgreSQL it is deemed acceptable.
- _, err = conn.Prepare("putUrl", `
- with upsert as (
- update shortened_urls
- set url=$2
- where id=$1
- returning *
- )
- insert into shortened_urls(id, url)
- select $1, $2 where not exists(select 1 from upsert)
- `)
- return
-}
-
-func getUrlHandler(w http.ResponseWriter, req *http.Request) {
- var url string
- err := pool.QueryRow("getUrl", req.URL.Path).Scan(&url)
- switch err {
- case nil:
- http.Redirect(w, req, url, http.StatusSeeOther)
- case pgx.ErrNoRows:
- http.NotFound(w, req)
- default:
- http.Error(w, "Internal server error", http.StatusInternalServerError)
- }
-}
-
-func putUrlHandler(w http.ResponseWriter, req *http.Request) {
- id := req.URL.Path
- var url string
- if body, err := ioutil.ReadAll(req.Body); err == nil {
- url = string(body)
- } else {
- http.Error(w, "Internal server error", http.StatusInternalServerError)
- return
- }
-
- if _, err := pool.Exec("putUrl", id, url); err == nil {
- w.WriteHeader(http.StatusOK)
- } else {
- http.Error(w, "Internal server error", http.StatusInternalServerError)
- }
-}
-
-func deleteUrlHandler(w http.ResponseWriter, req *http.Request) {
- if _, err := pool.Exec("deleteUrl", req.URL.Path); err == nil {
- w.WriteHeader(http.StatusOK)
- } else {
- http.Error(w, "Internal server error", http.StatusInternalServerError)
- }
-}
-
-func urlHandler(w http.ResponseWriter, req *http.Request) {
- switch req.Method {
- case "GET":
- getUrlHandler(w, req)
-
- case "PUT":
- putUrlHandler(w, req)
-
- case "DELETE":
- deleteUrlHandler(w, req)
-
- default:
- w.Header().Add("Allow", "GET, PUT, DELETE")
- w.WriteHeader(http.StatusMethodNotAllowed)
- }
-}
-
-func main() {
- var err error
- connPoolConfig := pgx.ConnPoolConfig{
- ConnConfig: pgx.ConnConfig{
- Host: "127.0.0.1",
- User: "jack",
- Password: "jack",
- Database: "url_shortener",
- Logger: log.New("module", "pgx"),
- },
- MaxConnections: 5,
- AfterConnect: afterConnect,
- }
- pool, err = pgx.NewConnPool(connPoolConfig)
- if err != nil {
- log.Crit("Unable to create connection pool", "error", err)
- os.Exit(1)
- }
-
- http.HandleFunc("/", urlHandler)
-
- log.Info("Starting URL shortener on localhost:8080")
- err = http.ListenAndServe("localhost:8080", nil)
- if err != nil {
- log.Crit("Unable to start web server", "error", err)
- os.Exit(1)
- }
-}
diff --git a/vendor/github.com/jackc/pgx/examples/url_shortener/structure.sql b/vendor/github.com/jackc/pgx/examples/url_shortener/structure.sql
deleted file mode 100644
index 0b9de25..0000000
--- a/vendor/github.com/jackc/pgx/examples/url_shortener/structure.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-create table shortened_urls (
- id text primary key,
- url text not null
-); \ No newline at end of file
diff --git a/vendor/github.com/jmoiron/sqlx/types/README.md b/vendor/github.com/jmoiron/sqlx/types/README.md
deleted file mode 100644
index 713abe5..0000000
--- a/vendor/github.com/jmoiron/sqlx/types/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# types
-
-The types package provides some useful types which implement the `sql.Scanner`
-and `driver.Valuer` interfaces, suitable for use as scan and value targets with
-database/sql.
diff --git a/vendor/github.com/jmoiron/sqlx/types/types.go b/vendor/github.com/jmoiron/sqlx/types/types.go
deleted file mode 100644
index 7b014c1..0000000
--- a/vendor/github.com/jmoiron/sqlx/types/types.go
+++ /dev/null
@@ -1,172 +0,0 @@
-package types
-
-import (
- "bytes"
- "compress/gzip"
- "database/sql/driver"
- "encoding/json"
- "errors"
-
- "io/ioutil"
-)
-
-// GzippedText is a []byte which transparently gzips data being submitted to
-// a database and ungzips data being Scanned from a database.
-type GzippedText []byte
-
-// Value implements the driver.Valuer interface, gzipping the raw value of
-// this GzippedText.
-func (g GzippedText) Value() (driver.Value, error) {
- b := make([]byte, 0, len(g))
- buf := bytes.NewBuffer(b)
- w := gzip.NewWriter(buf)
- w.Write(g)
- w.Close()
- return buf.Bytes(), nil
-
-}
-
-// Scan implements the sql.Scanner interface, ungzipping the value coming off
-// the wire and storing the raw result in the GzippedText.
-func (g *GzippedText) Scan(src interface{}) error {
- var source []byte
- switch src.(type) {
- case string:
- source = []byte(src.(string))
- case []byte:
- source = src.([]byte)
- default:
- return errors.New("Incompatible type for GzippedText")
- }
- reader, err := gzip.NewReader(bytes.NewReader(source))
- if err != nil {
- return err
- }
- defer reader.Close()
- b, err := ioutil.ReadAll(reader)
- if err != nil {
- return err
- }
- *g = GzippedText(b)
- return nil
-}
-
-// JSONText is a json.RawMessage, which is a []byte underneath.
-// Value() validates the json format in the source, and returns an error if
-// the json is not valid. Scan does no validation. JSONText additionally
-// implements `Unmarshal`, which unmarshals the json within to an interface{}
-type JSONText json.RawMessage
-
-var emptyJSON = JSONText("{}")
-
-// MarshalJSON returns the *j as the JSON encoding of j.
-func (j JSONText) MarshalJSON() ([]byte, error) {
- if len(j) == 0 {
- return emptyJSON, nil
- }
- return j, nil
-}
-
-// UnmarshalJSON sets *j to a copy of data
-func (j *JSONText) UnmarshalJSON(data []byte) error {
- if j == nil {
- return errors.New("JSONText: UnmarshalJSON on nil pointer")
- }
- *j = append((*j)[0:0], data...)
- return nil
-}
-
-// Value returns j as a value. This does a validating unmarshal into another
-// RawMessage. If j is invalid json, it returns an error.
-func (j JSONText) Value() (driver.Value, error) {
- var m json.RawMessage
- var err = j.Unmarshal(&m)
- if err != nil {
- return []byte{}, err
- }
- return []byte(j), nil
-}
-
-// Scan stores the src in *j. No validation is done.
-func (j *JSONText) Scan(src interface{}) error {
- var source []byte
- switch t := src.(type) {
- case string:
- source = []byte(t)
- case []byte:
- if len(t) == 0 {
- source = emptyJSON
- } else {
- source = t
- }
- case nil:
- *j = emptyJSON
- default:
- return errors.New("Incompatible type for JSONText")
- }
- *j = JSONText(append((*j)[0:0], source...))
- return nil
-}
-
-// Unmarshal unmarshal's the json in j to v, as in json.Unmarshal.
-func (j *JSONText) Unmarshal(v interface{}) error {
- if len(*j) == 0 {
- *j = emptyJSON
- }
- return json.Unmarshal([]byte(*j), v)
-}
-
-// String supports pretty printing for JSONText types.
-func (j JSONText) String() string {
- return string(j)
-}
-
-// NullJSONText represents a JSONText that may be null.
-// NullJSONText implements the scanner interface so
-// it can be used as a scan destination, similar to NullString.
-type NullJSONText struct {
- JSONText
- Valid bool // Valid is true if JSONText is not NULL
-}
-
-// Scan implements the Scanner interface.
-func (n *NullJSONText) Scan(value interface{}) error {
- if value == nil {
- n.JSONText, n.Valid = emptyJSON, false
- return nil
- }
- n.Valid = true
- return n.JSONText.Scan(value)
-}
-
-// Value implements the driver Valuer interface.
-func (n NullJSONText) Value() (driver.Value, error) {
- if !n.Valid {
- return nil, nil
- }
- return n.JSONText.Value()
-}
-
-// BitBool is an implementation of a bool for the MySQL type BIT(1).
-// This type allows you to avoid wasting an entire byte for MySQL's boolean type TINYINT.
-type BitBool bool
-
-// Value implements the driver.Valuer interface,
-// and turns the BitBool into a bitfield (BIT(1)) for MySQL storage.
-func (b BitBool) Value() (driver.Value, error) {
- if b {
- return []byte{1}, nil
- }
- return []byte{0}, nil
-}
-
-// Scan implements the sql.Scanner interface,
-// and turns the bitfield incoming from MySQL into a BitBool
-func (b *BitBool) Scan(src interface{}) error {
- v, ok := src.([]byte)
- if !ok {
- return errors.New("bad []byte type assertion")
- }
- *b = v[0] == 1
- return nil
-}
diff --git a/vendor/github.com/jmoiron/sqlx/types/types_test.go b/vendor/github.com/jmoiron/sqlx/types/types_test.go
deleted file mode 100644
index 29813d1..0000000
--- a/vendor/github.com/jmoiron/sqlx/types/types_test.go
+++ /dev/null
@@ -1,127 +0,0 @@
-package types
-
-import "testing"
-
-func TestGzipText(t *testing.T) {
- g := GzippedText("Hello, world")
- v, err := g.Value()
- if err != nil {
- t.Errorf("Was not expecting an error")
- }
- err = (&g).Scan(v)
- if err != nil {
- t.Errorf("Was not expecting an error")
- }
- if string(g) != "Hello, world" {
- t.Errorf("Was expecting the string we sent in (Hello World), got %s", string(g))
- }
-}
-
-func TestJSONText(t *testing.T) {
- j := JSONText(`{"foo": 1, "bar": 2}`)
- v, err := j.Value()
- if err != nil {
- t.Errorf("Was not expecting an error")
- }
- err = (&j).Scan(v)
- if err != nil {
- t.Errorf("Was not expecting an error")
- }
- m := map[string]interface{}{}
- j.Unmarshal(&m)
-
- if m["foo"].(float64) != 1 || m["bar"].(float64) != 2 {
- t.Errorf("Expected valid json but got some garbage instead? %#v", m)
- }
-
- j = JSONText(`{"foo": 1, invalid, false}`)
- v, err = j.Value()
- if err == nil {
- t.Errorf("Was expecting invalid json to fail!")
- }
-
- j = JSONText("")
- v, err = j.Value()
- if err != nil {
- t.Errorf("Was not expecting an error")
- }
-
- err = (&j).Scan(v)
- if err != nil {
- t.Errorf("Was not expecting an error")
- }
-
- j = JSONText(nil)
- v, err = j.Value()
- if err != nil {
- t.Errorf("Was not expecting an error")
- }
-
- err = (&j).Scan(v)
- if err != nil {
- t.Errorf("Was not expecting an error")
- }
-}
-
-func TestNullJSONText(t *testing.T) {
- j := NullJSONText{}
- err := j.Scan(`{"foo": 1, "bar": 2}`)
- if err != nil {
- t.Errorf("Was not expecting an error")
- }
- v, err := j.Value()
- if err != nil {
- t.Errorf("Was not expecting an error")
- }
- err = (&j).Scan(v)
- if err != nil {
- t.Errorf("Was not expecting an error")
- }
- m := map[string]interface{}{}
- j.Unmarshal(&m)
-
- if m["foo"].(float64) != 1 || m["bar"].(float64) != 2 {
- t.Errorf("Expected valid json but got some garbage instead? %#v", m)
- }
-
- j = NullJSONText{}
- err = j.Scan(nil)
- if err != nil {
- t.Errorf("Was not expecting an error")
- }
- if j.Valid != false {
- t.Errorf("Expected valid to be false, but got true")
- }
-}
-
-func TestBitBool(t *testing.T) {
- // Test true value
- var b BitBool = true
-
- v, err := b.Value()
- if err != nil {
- t.Errorf("Cannot return error")
- }
- err = (&b).Scan(v)
- if err != nil {
- t.Errorf("Was not expecting an error")
- }
- if !b {
- t.Errorf("Was expecting the bool we sent in (true), got %v", b)
- }
-
- // Test false value
- b = false
-
- v, err = b.Value()
- if err != nil {
- t.Errorf("Cannot return error")
- }
- err = (&b).Scan(v)
- if err != nil {
- t.Errorf("Was not expecting an error")
- }
- if b {
- t.Errorf("Was expecting the bool we sent in (false), got %v", b)
- }
-}