summaryrefslogtreecommitdiff
path: root/golang/pkg/database/tokens.go
blob: 0356cb2783fd3e231b9692ab5a34b81ec876d410 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
package database

func (db *DB) AddToken(token string) error {
	_, err := db.Exec(`INSERT INTO tokens(data) VALUES (?);`, token)
	return err
}

func (db *DB) GetToken() (string, error) {
	var token string
	err := db.QueryRow(`SELECT data FROM tokens;`).Scan(&token)
	return token, err
}