[golang] bootstrapped a client in yet another language
This commit is contained in:
parent
5aac233c08
commit
427cc77fa3
12 changed files with 447 additions and 0 deletions
14
golang/pkg/database/tokens.go
Normal file
14
golang/pkg/database/tokens.go
Normal file
|
@ -0,0 +1,14 @@
|
|||
package database
|
||||
|
||||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue