diff options
Diffstat (limited to 'poll.go')
-rw-r--r-- | poll.go | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -8,7 +8,7 @@ type Poll struct { userId int } -func addPoll(db *sqlite3.Conn, title string, options []string, nick string) error { +func addPoll(db *sqlite3.Conn, title string, options []string, nick string) (int64, error) { user := getUserForName(db, nick) @@ -23,18 +23,18 @@ func addPoll(db *sqlite3.Conn, title string, options []string, nick string) erro err := db.Exec(sql, args) if (err != nil ) { - return err + return 0, err } pollId := db.LastInsertId() for _,option := range options { addOption(db, option, pollId) if (err != nil ) { - return err + return 0, err } } - return nil + return pollId, nil } @@ -70,4 +70,5 @@ func getPollFromTitle(db *sqlite3.Conn, title string) Poll { //If we get here there are no matching users return Poll{id:0, title:"", userId:0} -}
\ No newline at end of file +} + |