Simple web server for showing original messages.
This commit is contained in:
@@ -14,22 +14,22 @@ var (
|
||||
sslmode = flag.String("dbsslmode", "disable", "PostgreSQL sslmode setting")
|
||||
)
|
||||
|
||||
type conn struct {
|
||||
type Conn struct {
|
||||
*sql.DB
|
||||
}
|
||||
|
||||
// NewDB creates connection to PostgreSQL DB. If dsn is empty, the flags
|
||||
// -dbuser, -dbname, -dbsslmode are used.
|
||||
func NewConn(dsn string) (*conn, error) {
|
||||
func NewConn(dsn string) (*Conn, error) {
|
||||
if dsn == "" {
|
||||
dsn = fmt.Sprintf("user=%s dbname=%s sslmode=%s", *user, *name,
|
||||
*sslmode)
|
||||
}
|
||||
db, err := sql.Open("postgres", dsn)
|
||||
return &conn{DB: db}, err
|
||||
return &Conn{DB: db}, err
|
||||
}
|
||||
|
||||
func (c *conn) OriginalBlobByHash(hash string, blob *[]byte) error {
|
||||
func (c *Conn) OriginalBlobByHash(hash string, blob *[]byte) error {
|
||||
row := c.QueryRow(`
|
||||
SELECT
|
||||
blob
|
||||
|
||||
Reference in New Issue
Block a user