diff options
Diffstat (limited to '')
-rw-r--r-- | golang/pkg/database/tokens.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/golang/pkg/database/tokens.go b/golang/pkg/database/tokens.go index 16bda2b..0787b5c 100644 --- a/golang/pkg/database/tokens.go +++ b/golang/pkg/database/tokens.go @@ -1,14 +1,11 @@ package database -func (db DB) AddToken(token string) error { +func (db *DB) AddToken(token string) error { _, err := db.db.ExecContext(db.ctx, `INSERT INTO tokens(data) VALUES (?);`, token) return err } -func (db DB) GetToken() (string, error) { - var token string - if err := db.db.QueryRowContext(db.ctx, `SELECT data FROM tokens;`).Scan(&token); err != nil { - return "", err - } - return token, nil +func (db *DB) GetToken() (token string, err error) { + err = db.db.QueryRowContext(db.ctx, `SELECT data FROM tokens;`).Scan(&token) + return token, err } |