Add dryrun mode to contacts.
This commit is contained in:
parent
4eaa3b8710
commit
27f38e6614
@ -5,17 +5,22 @@ import (
|
||||
"database/sql"
|
||||
"flag"
|
||||
"fmt"
|
||||
"net/mail"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
"xinu.tv/types"
|
||||
|
||||
"github.com/golang/glog"
|
||||
_ "github.com/lib/pq"
|
||||
|
||||
"xinu.tv/std/net/mail"
|
||||
)
|
||||
|
||||
var all = flag.Bool("all", false,
|
||||
"extract addresses from all messages. Default is to only extract from unprocessed messages.")
|
||||
var (
|
||||
all = flag.Bool("all", false,
|
||||
"extract addresses from all messages. Default is to only extract from unprocessed messages.")
|
||||
|
||||
dryrun = flag.Bool("dryrun", false, "don't write to the DB.")
|
||||
)
|
||||
|
||||
type contact struct {
|
||||
hash string
|
||||
@ -24,6 +29,12 @@ type contact struct {
|
||||
}
|
||||
|
||||
func insertAddresses(db *sql.DB, batch int, contactCh chan *contact, errc chan error) {
|
||||
if *dryrun {
|
||||
for _ = range contactCh {
|
||||
}
|
||||
errc <- nil
|
||||
return
|
||||
}
|
||||
var (
|
||||
txn *sql.Tx
|
||||
stmt *sql.Stmt
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user