remove postgres
This commit is contained in:
parent
12e7f0c3cc
commit
681f335d2e
|
@ -1,373 +0,0 @@
|
||||||
// Code generated by go-bindata.
|
|
||||||
// sources:
|
|
||||||
// 1513981282_certificates.down.sql
|
|
||||||
// 1513981282_certificates.up.sql
|
|
||||||
// 1513981599_routes.down.sql
|
|
||||||
// 1513981599_routes.up.sql
|
|
||||||
// 1513982254_tokens.down.sql
|
|
||||||
// 1513982254_tokens.up.sql
|
|
||||||
// postgres.sql
|
|
||||||
// DO NOT EDIT!
|
|
||||||
|
|
||||||
package dmigrations
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"compress/gzip"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
func bindataRead(data []byte, name string) ([]byte, error) {
|
|
||||||
gz, err := gzip.NewReader(bytes.NewBuffer(data))
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("Read %q: %v", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
var buf bytes.Buffer
|
|
||||||
_, err = io.Copy(&buf, gz)
|
|
||||||
clErr := gz.Close()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("Read %q: %v", name, err)
|
|
||||||
}
|
|
||||||
if clErr != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf.Bytes(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type asset struct {
|
|
||||||
bytes []byte
|
|
||||||
info os.FileInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
type bindataFileInfo struct {
|
|
||||||
name string
|
|
||||||
size int64
|
|
||||||
mode os.FileMode
|
|
||||||
modTime time.Time
|
|
||||||
}
|
|
||||||
|
|
||||||
func (fi bindataFileInfo) Name() string {
|
|
||||||
return fi.name
|
|
||||||
}
|
|
||||||
func (fi bindataFileInfo) Size() int64 {
|
|
||||||
return fi.size
|
|
||||||
}
|
|
||||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
|
||||||
return fi.mode
|
|
||||||
}
|
|
||||||
func (fi bindataFileInfo) ModTime() time.Time {
|
|
||||||
return fi.modTime
|
|
||||||
}
|
|
||||||
func (fi bindataFileInfo) IsDir() bool {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
func (fi bindataFileInfo) Sys() interface{} {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var __1513981282_certificatesDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\x09\xf2\x0f\x50\xf0\xf4\x73\x71\x8d\x50\x70\x4e\x2d\x2a\xc9\x4c\xcb\x4c\x4e\x2c\x49\x2d\x8e\x4f\xc9\xcf\x4d\xcc\xcc\xb3\xe6\x02\xcb\x87\x38\x3a\xf9\xb8\xa2\xc8\x5b\x73\x01\x02\x00\x00\xff\xff\xb8\xef\x1e\x9f\x39\x00\x00\x00")
|
|
||||||
|
|
||||||
func _1513981282_certificatesDownSqlBytes() ([]byte, error) {
|
|
||||||
return bindataRead(
|
|
||||||
__1513981282_certificatesDownSql,
|
|
||||||
"1513981282_certificates.down.sql",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _1513981282_certificatesDownSql() (*asset, error) {
|
|
||||||
bytes, err := _1513981282_certificatesDownSqlBytes()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
info := bindataFileInfo{name: "1513981282_certificates.down.sql", size: 57, mode: os.FileMode(420), modTime: time.Unix(1516564385, 0)}
|
|
||||||
a := &asset{bytes: bytes, info: info}
|
|
||||||
return a, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var __1513981282_certificatesUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x90\x31\x4f\xc3\x30\x10\x85\x77\xff\x8a\xa7\x4e\x89\x04\x03\x48\xb0\x74\x72\x93\xab\xb0\x48\xec\x92\xd8\x90\x4e\x91\x95\x18\xe4\xa1\x2d\x4a\x9c\xfe\x7e\x44\x1a\x02\x61\x40\x78\xf3\xe9\x7b\xf7\x9d\x5e\x52\x10\xd7\x04\xaa\x34\xc9\x52\x28\x09\xb1\x85\x54\x1a\x54\x89\x52\x97\x58\x0d\x83\x6f\xaf\x4f\x7d\xff\xbe\x5a\x33\x36\xc1\x9a\x6f\x32\xfa\x05\x26\xae\x0b\xfe\xd5\x37\x36\xb8\x9e\x01\x11\x7c\x8b\xaf\x67\x8c\x48\xe7\xcf\xae\x10\x39\x2f\xf6\x78\xa4\x3d\x52\xda\x72\x93\x69\x7c\x4a\xea\x37\x77\x74\x9d\x0d\xae\x3e\xdf\x1c\x9a\x28\x66\xc0\x15\xda\xd3\xc1\xfa\xe3\x98\x7b\xe6\x45\xf2\xc0\x8b\xe8\xf6\xee\x3e\x1e\xc5\xd2\x64\xd9\x05\xb2\xc1\x4e\xcb\x35\x55\x7a\x36\x2d\xa0\xa6\x73\x36\xb8\xb6\xb6\x01\x5a\xe4\x54\x6a\x9e\xef\x7e\x42\xf3\x2d\x52\xbd\x4c\x72\xd7\xfa\x29\xf1\xef\x88\x6d\x82\x3f\xbb\xd1\xbe\x51\x2a\x23\x2e\x97\xa7\xcc\x91\xd0\x0d\x8e\x01\xf1\x77\xa9\x46\x8a\x27\x43\x10\x32\xa5\xea\x8f\x6e\xeb\xa9\x12\x25\x17\x63\x44\x97\x79\xbc\x66\x1f\x01\x00\x00\xff\xff\xcf\x95\x0a\x45\xd2\x01\x00\x00")
|
|
||||||
|
|
||||||
func _1513981282_certificatesUpSqlBytes() ([]byte, error) {
|
|
||||||
return bindataRead(
|
|
||||||
__1513981282_certificatesUpSql,
|
|
||||||
"1513981282_certificates.up.sql",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _1513981282_certificatesUpSql() (*asset, error) {
|
|
||||||
bytes, err := _1513981282_certificatesUpSqlBytes()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
info := bindataFileInfo{name: "1513981282_certificates.up.sql", size: 466, mode: os.FileMode(420), modTime: time.Unix(1516564385, 0)}
|
|
||||||
a := &asset{bytes: bytes, info: info}
|
|
||||||
return a, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var __1513981599_routesDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\x09\xf2\x0f\x50\x08\x71\x74\xf2\x71\x55\x08\xca\x2f\x2d\x49\x2d\xb6\xe6\x02\x04\x00\x00\xff\xff\xf9\xea\x76\x2b\x13\x00\x00\x00")
|
|
||||||
|
|
||||||
func _1513981599_routesDownSqlBytes() ([]byte, error) {
|
|
||||||
return bindataRead(
|
|
||||||
__1513981599_routesDownSql,
|
|
||||||
"1513981599_routes.down.sql",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _1513981599_routesDownSql() (*asset, error) {
|
|
||||||
bytes, err := _1513981599_routesDownSqlBytes()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
info := bindataFileInfo{name: "1513981599_routes.down.sql", size: 19, mode: os.FileMode(420), modTime: time.Unix(1516564385, 0)}
|
|
||||||
a := &asset{bytes: bytes, info: info}
|
|
||||||
return a, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var __1513981599_routesUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x90\x3f\x6f\x83\x30\x14\xc4\x77\x7f\x8a\x53\x26\x90\xda\xa1\xa9\xda\x25\x93\x13\x5e\x54\xab\x60\x52\x63\xb7\x64\x42\x08\xac\x96\x21\x50\x81\xc9\xe7\xaf\xa0\x40\xff\x0e\xf1\xe6\xa7\xdf\xdd\x7b\x77\x3b\x45\x5c\x13\x28\xd5\x24\x13\x11\x4b\x88\x3d\x64\xac\x41\xa9\x48\x74\x82\x55\xdf\x57\xe5\x75\xd3\x75\xef\xab\x0d\x63\x13\xac\xf9\x36\xa4\x5f\xa0\x6a\x7a\x67\x3b\x06\x78\xa8\x4a\xcc\xcf\x18\x11\x2c\x9f\x83\x12\x11\x57\x47\x3c\xd2\x11\x01\xed\xb9\x09\x35\x06\xfb\xec\xd5\xd6\xb6\xcd\x9d\xcd\xce\x37\xa7\xc2\xf3\x19\x70\x85\xa2\xb5\xb9\x6b\xda\x41\xf7\xcc\xd5\xee\x81\x2b\xef\x76\xed\x63\x5c\x29\x4d\x18\x8e\xd0\x5b\xd3\xb9\x3a\x3f\xd9\x6f\xd0\xfa\xee\xde\xff\x09\x8d\x4e\xb6\xcc\x72\x07\x2d\x22\x4a\x34\x8f\x0e\x83\xed\x0c\x2d\xb7\xc8\xf8\x65\x5a\x6e\xcb\x6a\x52\x5c\x2c\xc9\x0b\x57\x9d\xed\x98\x73\x1b\xc7\x21\x71\xf9\x19\xfa\x8f\xc4\xb5\xbd\x65\x80\xff\x55\xa7\x91\xe2\xc9\x10\x84\x0c\x28\xfd\xb7\xd5\x6c\xc9\xd9\xd4\xd3\x08\xde\x3c\xf3\x37\xec\x23\x00\x00\xff\xff\x28\x30\xd1\x48\xc4\x01\x00\x00")
|
|
||||||
|
|
||||||
func _1513981599_routesUpSqlBytes() ([]byte, error) {
|
|
||||||
return bindataRead(
|
|
||||||
__1513981599_routesUpSql,
|
|
||||||
"1513981599_routes.up.sql",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _1513981599_routesUpSql() (*asset, error) {
|
|
||||||
bytes, err := _1513981599_routesUpSqlBytes()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
info := bindataFileInfo{name: "1513981599_routes.up.sql", size: 452, mode: os.FileMode(420), modTime: time.Unix(1516564385, 0)}
|
|
||||||
a := &asset{bytes: bytes, info: info}
|
|
||||||
return a, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var __1513982254_tokensDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\x09\xf2\x0f\x50\xf0\xf4\x73\x71\x8d\x50\x08\xc9\xcf\x4e\xcd\x2b\x8e\x4f\xca\x4f\xa9\xb4\xe6\xe2\x02\x4b\x84\x38\x3a\xf9\xb8\x42\x25\xac\xb9\x00\x01\x00\x00\xff\xff\x35\x06\x52\x0d\x2c\x00\x00\x00")
|
|
||||||
|
|
||||||
func _1513982254_tokensDownSqlBytes() ([]byte, error) {
|
|
||||||
return bindataRead(
|
|
||||||
__1513982254_tokensDownSql,
|
|
||||||
"1513982254_tokens.down.sql",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _1513982254_tokensDownSql() (*asset, error) {
|
|
||||||
bytes, err := _1513982254_tokensDownSqlBytes()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
info := bindataFileInfo{name: "1513982254_tokens.down.sql", size: 44, mode: os.FileMode(420), modTime: time.Unix(1516564385, 0)}
|
|
||||||
a := &asset{bytes: bytes, info: info}
|
|
||||||
return a, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var __1513982254_tokensUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x90\x4f\x4b\xc3\x40\x10\xc5\xef\xfb\x29\x86\x9e\x12\xd0\x83\x15\xbd\xf4\xb4\x6d\xa7\xb8\x98\x6e\x6a\x32\xab\x29\x22\x21\x26\x83\x04\xb1\x1b\xb2\x49\xd1\x6f\x2f\x5d\x62\x6c\xfd\xb3\xb7\x07\xbf\xfd\xbd\xe1\x2d\x12\x94\x84\x80\x19\xa1\x4e\x55\xac\x41\xad\x40\xc7\x04\x98\xa9\x94\x52\x98\xf4\x7d\x5d\x9d\x5b\xe7\x9a\xc9\x4c\x88\x01\x26\x39\x8f\xf0\x07\x48\xf6\x95\x77\x4e\x00\x04\x50\x57\xf0\xf5\x8c\x51\xcb\x31\x6c\x12\xb5\x96\xc9\x16\x6e\x71\x0b\x4b\x5c\x49\x13\x11\x1c\xf4\xf9\x0b\xef\xb8\x2d\x3a\xce\xf7\x17\x6f\x65\x10\x0a\x80\x33\x78\xb6\xd5\xc7\xf0\xef\x5e\x26\x8b\x1b\x99\x04\xd3\xab\xeb\xd0\x57\x6a\x13\x45\x1e\x2a\x5b\x2e\x3a\xdb\x1e\x43\x97\xd3\x10\x4e\x21\x57\xda\x86\x9d\x37\x11\x66\xf4\xf8\x34\x68\x7f\x9b\xb8\xca\x8b\x0e\x48\xad\x31\x25\xb9\xde\x1c\x43\xe3\xc1\x3a\x7e\x18\x2e\xe4\xf7\xa6\x6e\xd9\xfd\xfb\xc5\x43\x45\xd9\xd5\x7b\xf6\x7d\xf3\x38\x8e\x50\xea\xd3\xf2\xd1\xdb\xb5\x3d\x0b\x80\xf0\x7b\x65\xa3\xd5\x9d\x41\x50\x7a\x89\xd9\x9f\x63\xe7\x7e\x23\xbb\x1b\x22\x04\x87\x1c\xce\xc4\x67\x00\x00\x00\xff\xff\x43\x54\xbb\x34\xd3\x01\x00\x00")
|
|
||||||
|
|
||||||
func _1513982254_tokensUpSqlBytes() ([]byte, error) {
|
|
||||||
return bindataRead(
|
|
||||||
__1513982254_tokensUpSql,
|
|
||||||
"1513982254_tokens.up.sql",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _1513982254_tokensUpSql() (*asset, error) {
|
|
||||||
bytes, err := _1513982254_tokensUpSqlBytes()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
info := bindataFileInfo{name: "1513982254_tokens.up.sql", size: 467, mode: os.FileMode(420), modTime: time.Unix(1516564385, 0)}
|
|
||||||
a := &asset{bytes: bytes, info: info}
|
|
||||||
return a, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var _postgresSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x94\x4f\x8b\xea\x30\x14\xc5\xf7\xfd\x14\x77\x67\x85\x66\xf1\x56\x0f\xde\xe3\x21\xa2\x79\x4c\xa1\x2a\xd4\xce\xcc\x52\x62\x73\x9d\x09\x53\x1b\x49\xa2\x8c\xdf\x7e\x48\x5b\x35\xd1\xfa\x87\xa1\x03\x5d\x94\x40\xce\xf9\xdd\x73\x4f\x4b\x08\x94\x6c\x8d\x7f\x40\x94\x1a\x95\x21\x39\x2a\x23\x56\x22\x67\x06\x83\x78\x3a\xa7\x69\x06\xf1\x34\x9b\xc1\xe8\x74\xae\x43\x2e\xd7\x4c\x94\x11\x70\x66\x58\x1f\x5e\x86\xc9\x33\x9d\x43\x38\x88\x60\xd0\xff\x1b\x04\x47\xc9\x95\x28\x39\x91\x25\x7a\xa2\x73\x9a\xd0\x51\x06\x82\x47\xe0\xca\x44\x90\x2b\x64\x06\xf9\x82\x99\x08\x90\x8b\xc3\x2b\xcb\x8d\xd8\x21\xfc\x4f\x67\x13\x0f\x02\x5e\x9f\x68\x4a\x1b\x0d\xf8\x07\x03\x48\xe2\x49\x9c\xc1\x2f\x07\x40\xe1\x5a\xee\xf0\x02\x61\x4c\x13\x9a\xd1\xef\x49\xbe\xa1\x21\xac\x28\x5c\x3d\xdd\xd9\x4c\x8e\x4f\xb3\x0e\x25\xb7\x67\x8b\x48\xed\x89\x0e\x2b\x65\xa9\x22\x78\x97\xda\xd8\x2b\x67\x7b\x68\x5b\x43\x25\x46\x96\x7b\x22\xb8\x8b\x7c\x21\xf5\x10\x77\xcd\xd1\x44\x26\xf8\x95\xb8\x2e\xbd\xad\x49\xc7\xee\x87\x9b\xb7\x18\xec\xce\x2a\x06\x4d\x56\x52\x91\xad\x46\xd5\x31\x45\x23\x61\x21\x1c\x73\x8e\x05\x1a\x3c\x45\xe0\x95\xaf\x2d\xc3\xe1\x74\x7c\xbb\x81\x4d\x33\x8c\xfc\xc0\xd2\x6b\x46\x66\x4f\x74\xb8\x94\x7c\xef\x0c\xa4\x73\xb9\x41\x1d\x01\x7e\x6e\x84\x42\xbd\x60\xc6\x6f\x4a\xfd\xf4\xcf\x2a\x6e\x79\x6b\x07\x27\xa4\x2b\xca\x5e\x50\x47\x17\x3f\xa9\x9a\xed\x5e\x5b\x3c\x67\x5b\x16\xeb\xf8\x13\x04\x56\xe7\xce\x07\x5e\x31\xb4\x97\xa5\x2b\x8a\xf6\xc6\x38\x3f\xad\x7a\x03\x6e\x63\x1e\xcb\xb1\x91\xa8\x21\x78\x33\xca\x75\x9d\x13\x2c\x10\x10\xa5\x41\xb5\x63\x05\xf4\x7e\x03\x67\x7b\xdd\x0b\xbe\x02\x00\x00\xff\xff\x49\x2d\x7b\x8a\x23\x06\x00\x00")
|
|
||||||
|
|
||||||
func postgresSqlBytes() ([]byte, error) {
|
|
||||||
return bindataRead(
|
|
||||||
_postgresSql,
|
|
||||||
"postgres.sql",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func postgresSql() (*asset, error) {
|
|
||||||
bytes, err := postgresSqlBytes()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
info := bindataFileInfo{name: "postgres.sql", size: 1571, mode: os.FileMode(420), modTime: time.Unix(1516571679, 0)}
|
|
||||||
a := &asset{bytes: bytes, info: info}
|
|
||||||
return a, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Asset loads and returns the asset for the given name.
|
|
||||||
// It returns an error if the asset could not be found or
|
|
||||||
// could not be loaded.
|
|
||||||
func Asset(name string) ([]byte, error) {
|
|
||||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
|
||||||
if f, ok := _bindata[cannonicalName]; ok {
|
|
||||||
a, err := f()
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
|
||||||
}
|
|
||||||
return a.bytes, nil
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("Asset %s not found", name)
|
|
||||||
}
|
|
||||||
|
|
||||||
// MustAsset is like Asset but panics when Asset would return an error.
|
|
||||||
// It simplifies safe initialization of global variables.
|
|
||||||
func MustAsset(name string) []byte {
|
|
||||||
a, err := Asset(name)
|
|
||||||
if err != nil {
|
|
||||||
panic("asset: Asset(" + name + "): " + err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
|
|
||||||
// AssetInfo loads and returns the asset info for the given name.
|
|
||||||
// It returns an error if the asset could not be found or
|
|
||||||
// could not be loaded.
|
|
||||||
func AssetInfo(name string) (os.FileInfo, error) {
|
|
||||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
|
||||||
if f, ok := _bindata[cannonicalName]; ok {
|
|
||||||
a, err := f()
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
|
||||||
}
|
|
||||||
return a.info, nil
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
|
||||||
}
|
|
||||||
|
|
||||||
// AssetNames returns the names of the assets.
|
|
||||||
func AssetNames() []string {
|
|
||||||
names := make([]string, 0, len(_bindata))
|
|
||||||
for name := range _bindata {
|
|
||||||
names = append(names, name)
|
|
||||||
}
|
|
||||||
return names
|
|
||||||
}
|
|
||||||
|
|
||||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
|
||||||
var _bindata = map[string]func() (*asset, error){
|
|
||||||
"1513981282_certificates.down.sql": _1513981282_certificatesDownSql,
|
|
||||||
"1513981282_certificates.up.sql": _1513981282_certificatesUpSql,
|
|
||||||
"1513981599_routes.down.sql": _1513981599_routesDownSql,
|
|
||||||
"1513981599_routes.up.sql": _1513981599_routesUpSql,
|
|
||||||
"1513982254_tokens.down.sql": _1513982254_tokensDownSql,
|
|
||||||
"1513982254_tokens.up.sql": _1513982254_tokensUpSql,
|
|
||||||
"postgres.sql": postgresSql,
|
|
||||||
}
|
|
||||||
|
|
||||||
// AssetDir returns the file names below a certain
|
|
||||||
// directory embedded in the file by go-bindata.
|
|
||||||
// For example if you run go-bindata on data/... and data contains the
|
|
||||||
// following hierarchy:
|
|
||||||
// data/
|
|
||||||
// foo.txt
|
|
||||||
// img/
|
|
||||||
// a.png
|
|
||||||
// b.png
|
|
||||||
// then AssetDir("data") would return []string{"foo.txt", "img"}
|
|
||||||
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
|
||||||
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
|
||||||
// AssetDir("") will return []string{"data"}.
|
|
||||||
func AssetDir(name string) ([]string, error) {
|
|
||||||
node := _bintree
|
|
||||||
if len(name) != 0 {
|
|
||||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
|
||||||
pathList := strings.Split(cannonicalName, "/")
|
|
||||||
for _, p := range pathList {
|
|
||||||
node = node.Children[p]
|
|
||||||
if node == nil {
|
|
||||||
return nil, fmt.Errorf("Asset %s not found", name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if node.Func != nil {
|
|
||||||
return nil, fmt.Errorf("Asset %s not found", name)
|
|
||||||
}
|
|
||||||
rv := make([]string, 0, len(node.Children))
|
|
||||||
for childName := range node.Children {
|
|
||||||
rv = append(rv, childName)
|
|
||||||
}
|
|
||||||
return rv, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type bintree struct {
|
|
||||||
Func func() (*asset, error)
|
|
||||||
Children map[string]*bintree
|
|
||||||
}
|
|
||||||
var _bintree = &bintree{nil, map[string]*bintree{
|
|
||||||
"1513981282_certificates.down.sql": &bintree{_1513981282_certificatesDownSql, map[string]*bintree{}},
|
|
||||||
"1513981282_certificates.up.sql": &bintree{_1513981282_certificatesUpSql, map[string]*bintree{}},
|
|
||||||
"1513981599_routes.down.sql": &bintree{_1513981599_routesDownSql, map[string]*bintree{}},
|
|
||||||
"1513981599_routes.up.sql": &bintree{_1513981599_routesUpSql, map[string]*bintree{}},
|
|
||||||
"1513982254_tokens.down.sql": &bintree{_1513982254_tokensDownSql, map[string]*bintree{}},
|
|
||||||
"1513982254_tokens.up.sql": &bintree{_1513982254_tokensUpSql, map[string]*bintree{}},
|
|
||||||
"postgres.sql": &bintree{postgresSql, map[string]*bintree{}},
|
|
||||||
}}
|
|
||||||
|
|
||||||
// RestoreAsset restores an asset under the given directory
|
|
||||||
func RestoreAsset(dir, name string) error {
|
|
||||||
data, err := Asset(name)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
info, err := AssetInfo(name)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RestoreAssets restores an asset under the given directory recursively
|
|
||||||
func RestoreAssets(dir, name string) error {
|
|
||||||
children, err := AssetDir(name)
|
|
||||||
// File
|
|
||||||
if err != nil {
|
|
||||||
return RestoreAsset(dir, name)
|
|
||||||
}
|
|
||||||
// Dir
|
|
||||||
for _, child := range children {
|
|
||||||
err = RestoreAssets(dir, filepath.Join(name, child))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func _filePath(dir, name string) string {
|
|
||||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
|
||||||
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
DROP INDEX Certificates_domain;
|
|
||||||
DROP TABLE Certificates;
|
|
|
@ -1,12 +0,0 @@
|
||||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Certificates
|
|
||||||
( id UUID PRIMARY KEY DEFAULT uuid_generate_v1mc()
|
|
||||||
, domain VARCHAR(256) NOT NULL
|
|
||||||
, data TEXT NOT NULL
|
|
||||||
, created_at TIMESTAMP NOT NULL DEFAULT NOW()
|
|
||||||
, edited_at TIMESTAMP NOT NULL DEFAULT NOW()
|
|
||||||
, active BOOLEAN NOT NULL DEFAULT true
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE UNIQUE INDEX IF NOT EXISTS Certificates_domain ON Certificates (domain);
|
|
|
@ -1 +0,0 @@
|
||||||
DROP TABLE Routes;
|
|
|
@ -1,12 +0,0 @@
|
||||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Routes
|
|
||||||
( id UUID PRIMARY KEY DEFAULT uuid_generate_v1mc()
|
|
||||||
, creator VARCHAR(32) NOT NULL
|
|
||||||
, hostname VARCHAR(256) NOT NULL
|
|
||||||
, created_at TIMESTAMP NOT NULL DEFAULT NOW()
|
|
||||||
, edited_at TIMESTAMP NOT NULL DEFAULT NOW()
|
|
||||||
, active BOOLEAN NOT NULL DEFAULT true
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE UNIQUE INDEX IF NOT EXISTS Routes_hostname on Routes (hostname);
|
|
|
@ -1,3 +0,0 @@
|
||||||
DROP INDEX Tokens_body;
|
|
||||||
|
|
||||||
DROP TABLE Tokens;
|
|
|
@ -1,13 +0,0 @@
|
||||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Tokens
|
|
||||||
( id UUID PRIMARY KEY DEFAULT uuid_generate_v1mc()
|
|
||||||
, body VARCHAR(256) NOT NULL
|
|
||||||
, creator VARCHAR(32) NOT NULL
|
|
||||||
, scopes TEXT[] NOT NULL
|
|
||||||
, created_at TIMESTAMP NOT NULL DEFAULT NOW()
|
|
||||||
, expires_at TIMESTAMP NOT NULL
|
|
||||||
, active BOOLEAN NOT NULL DEFAULT true
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE UNIQUE INDEX IF NOT EXISTS Tokens_body on Tokens (body);
|
|
|
@ -1,42 +0,0 @@
|
||||||
-- name: insert-certificate
|
|
||||||
INSERT INTO Certificates(domain, data) VALUES ($1, $2);
|
|
||||||
|
|
||||||
-- name: find-one-certificate
|
|
||||||
SELECT id, domain, data, created_at, edited_at, active FROM Certificates WHERE domain = $1 LIMIT 1;
|
|
||||||
|
|
||||||
-- name: remove-one-certificate
|
|
||||||
DELETE FROM Certificates WHERE domain = $1 LIMIT 1;
|
|
||||||
|
|
||||||
-- name: get-all-certificates
|
|
||||||
SELECT id, domain, data, created_at, edited_at, active FROM Certificates;
|
|
||||||
|
|
||||||
-- name: insert-route
|
|
||||||
INSERT INTO Routes(creator, hostname) VALUES ($1, $2);
|
|
||||||
|
|
||||||
-- name: find-one-route-by-id
|
|
||||||
SELECT id, creator, hostname, created_at, edited_at, active FROM Routes WHERE id = $1 LIMIT 1;
|
|
||||||
|
|
||||||
-- name: find-one-route-by-host
|
|
||||||
SELECT id, creator, hostname, created_at, edited_at, active FROM Routes WHERE hostname = $1 LIMIT 1;
|
|
||||||
|
|
||||||
-- name: find-all-routes-for-user
|
|
||||||
SELECT id, creator, hostname, created_at, edited_at, active FROM Routes WHERE creator = $1;
|
|
||||||
|
|
||||||
-- name: delete-one-route
|
|
||||||
DELETE FROM Routes WHERE id = $1 AND domain = $2 LIMIT 1;
|
|
||||||
|
|
||||||
-- name: insert-token
|
|
||||||
INSERT INTO Tokens(body, creator, scopes, expires_at) VALUES ($1, $2, $3, $4);
|
|
||||||
|
|
||||||
-- name: get-one-token
|
|
||||||
SELECT id, body, creator, scopes, created_at, expires_at, active FROM Tokens WHERE id = $1 LIMIT 1;
|
|
||||||
|
|
||||||
-- name: get-one-token-by-body
|
|
||||||
SELECT id, body, creator, scopes, created_at, expires_at, active FROM Tokens WHERE body = $1 LIMIT 1;
|
|
||||||
|
|
||||||
-- name: get-all-tokens-for-user
|
|
||||||
SELECT id, body, creator, scopes, created_at, expires_at, active FROM Tokens WHERE creator = $1;
|
|
||||||
|
|
||||||
-- name: remove-one-token
|
|
||||||
DELETE FROM Tokens WHERE id = $1 LIMIT 1;
|
|
||||||
|
|
|
@ -1,178 +0,0 @@
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
package database
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"database/sql"
|
|
||||||
"log"
|
|
||||||
|
|
||||||
"git.xeserv.us/xena/route/internal/database/dmigrations"
|
|
||||||
"github.com/Xe/uuid"
|
|
||||||
"github.com/brandur/simplebox"
|
|
||||||
"github.com/gchaincl/dotsql"
|
|
||||||
_ "github.com/lib/pq"
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
|
||||||
|
|
||||||
type PostgresStorage struct {
|
|
||||||
ds *dotsql.DotSql
|
|
||||||
db *sql.DB
|
|
||||||
sb *simplebox.SimpleBox
|
|
||||||
|
|
||||||
//cs *postgresCertificateStorage
|
|
||||||
rs *postgresRouteStorage
|
|
||||||
//ts *postgresTokenStorage
|
|
||||||
}
|
|
||||||
|
|
||||||
type postgresCertificateStorage struct {
|
|
||||||
*PostgresStorage
|
|
||||||
}
|
|
||||||
|
|
||||||
type postgresRouteStorage struct {
|
|
||||||
*PostgresStorage
|
|
||||||
}
|
|
||||||
|
|
||||||
type postgresTokenStorage struct {
|
|
||||||
*PostgresStorage
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewPostgresStorage creates a new Storage instance backed by postgres at the
|
|
||||||
// given URL.
|
|
||||||
func NewPostgresStorage(url string, key *[32]byte) (Storage, error) {
|
|
||||||
db, err := sql.Open("postgres", url)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
data, err := dmigrations.Asset("postgres.sql")
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
buf := bytes.NewBuffer(data)
|
|
||||||
|
|
||||||
ds, err := dotsql.Load(buf)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
for k := range ds.QueryMap() {
|
|
||||||
log.Printf("preparing %s", k)
|
|
||||||
stmt, err := ds.Prepare(db, k)
|
|
||||||
if err != nil {
|
|
||||||
db.Close()
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer stmt.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
p := &PostgresStorage{
|
|
||||||
db: db,
|
|
||||||
ds: ds,
|
|
||||||
sb: simplebox.NewFromSecretKey(key),
|
|
||||||
}
|
|
||||||
|
|
||||||
//p.cs = &postgresCertificateStorage{p}
|
|
||||||
p.rs = &postgresRouteStorage{p}
|
|
||||||
//p.ts = &postgresTokenStorage{p}
|
|
||||||
|
|
||||||
return p, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Certs gets the certificate storage interface.
|
|
||||||
func (p *PostgresStorage) Certs() Certs { return nil }
|
|
||||||
|
|
||||||
// Routes gets the route storage interface.
|
|
||||||
func (p *PostgresStorage) Routes() Routes { return p.rs }
|
|
||||||
|
|
||||||
// Tokens gets the token storage interface.
|
|
||||||
func (p *PostgresStorage) Tokens() Tokens { return nil }
|
|
||||||
|
|
||||||
// Close cleans up resources for this Storage.
|
|
||||||
func (p *PostgresStorage) Close() error { return p.db.Close() }
|
|
||||||
|
|
||||||
// interface compliance
|
|
||||||
var (
|
|
||||||
_ Storage = &PostgresStorage{}
|
|
||||||
//_ Certs = &postgresCertificateStorage{}
|
|
||||||
_ Routes = &postgresRouteStorage{}
|
|
||||||
//_ Tokens = &postgresTokenStorage{}
|
|
||||||
)
|
|
||||||
|
|
||||||
func (p *postgresRouteStorage) getRouteInner(ctx context.Context, arg string, kind string) (Route, error) {
|
|
||||||
r, err := p.ds.QueryRow(p.db, kind, arg)
|
|
||||||
if err != nil {
|
|
||||||
return Route{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
rt := Route{}
|
|
||||||
|
|
||||||
err = (&rt).Scan(r)
|
|
||||||
if err != nil {
|
|
||||||
return Route{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return rt, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *postgresRouteStorage) Get(ctx context.Context, id string) (Route, error) {
|
|
||||||
return p.getRouteInner(ctx, id, "find-one-route-by-id")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *postgresRouteStorage) GetHost(ctx context.Context, host string) (Route, error) {
|
|
||||||
return p.getRouteInner(ctx, host, "find-one-route-by-host")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *postgresRouteStorage) GetAll(ctx context.Context, user string) ([]Route, error) {
|
|
||||||
var result []Route
|
|
||||||
|
|
||||||
rows, err := p.ds.Query(p.db, "find-all-routes-for-user", user)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
defer rows.Close()
|
|
||||||
for rows.Next() {
|
|
||||||
rt := &Route{}
|
|
||||||
|
|
||||||
if err := rt.Scan(rows); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
result = append(result, *rt)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := rows.Err(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return result, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *postgresRouteStorage) Put(ctx context.Context, r Route) (Route, error) {
|
|
||||||
if r.ID == "" {
|
|
||||||
r.ID = uuid.New()
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := p.ds.Exec(p.db, "insert-route", r.ID, r.Hostname)
|
|
||||||
if err != nil {
|
|
||||||
return Route{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return p.Get(ctx, r.ID)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *postgresRouteStorage) Delete(ctx context.Context, r Route) (Route, error) {
|
|
||||||
rt, err := p.Get(ctx, r.ID)
|
|
||||||
if err != nil {
|
|
||||||
return Route{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = p.ds.Exec(p.db, "delete-one-route", rt.ID, rt.Hostname)
|
|
||||||
if err != nil {
|
|
||||||
return Route{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return rt, nil
|
|
||||||
}
|
|
|
@ -75,11 +75,3 @@ func TestBoltDBRouteStorage(t *testing.T) {
|
||||||
|
|
||||||
testRoutes(ctx, t, st.Routes())
|
testRoutes(ctx, t, st.Routes())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPostgresRouteStorage(t *testing.T) {
|
|
||||||
st, ctx, cancel := newTestPostgresStorage(t, os.Getenv("DATABASE_URL"))
|
|
||||||
defer st.Close()
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
testRoutes(ctx, t, st.Routes())
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue