fix postgres table creation
This commit is contained in:
parent
835be5beab
commit
23a044d076
2 changed files with 32 additions and 1 deletions
31
remote/context.go
Normal file
31
remote/context.go
Normal file
|
@ -0,0 +1,31 @@
|
|||
package remote
|
||||
|
||||
import (
|
||||
"code.google.com/p/go.net/context"
|
||||
)
|
||||
|
||||
const reqkey = "remote"
|
||||
|
||||
// NewContext returns a Context whose Value method returns
|
||||
// the applications Remote instance.
|
||||
func NewContext(parent context.Context, v Remote) context.Context {
|
||||
return &wrapper{parent, v}
|
||||
}
|
||||
|
||||
type wrapper struct {
|
||||
context.Context
|
||||
v Remote
|
||||
}
|
||||
|
||||
// Value returns the named key from the context.
|
||||
func (c *wrapper) Value(key interface{}) interface{} {
|
||||
if key == reqkey {
|
||||
return c.v
|
||||
}
|
||||
return c.Context.Value(key)
|
||||
}
|
||||
|
||||
// FromContext returns the Remote associated with this context.
|
||||
func FromContext(c context.Context) Remote {
|
||||
return c.Value(reqkey).(Remote)
|
||||
}
|
|
@ -112,7 +112,7 @@ CREATE TABLE IF NOT EXISTS logs (
|
|||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS nodes (
|
||||
node_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||||
node_id SERIAL PRIMARY KEY
|
||||
,node_addr VARCHAR(1024)
|
||||
,node_arch VARCHAR(50)
|
||||
,node_cert BYTEA
|
||||
|
|
Loading…
Reference in a new issue