mirror of
https://github.com/1f349/lavender.git
synced 2024-12-22 23:54:10 +00:00
35 lines
645 B
Go
35 lines
645 B
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.25.0
|
|
// source: roles.sql
|
|
|
|
package database
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
const addRole = `-- name: AddRole :execlastid
|
|
INSERT OR IGNORE INTO roles(role)
|
|
VALUES (?)
|
|
`
|
|
|
|
func (q *Queries) AddRole(ctx context.Context, role string) (int64, error) {
|
|
result, err := q.db.ExecContext(ctx, addRole, role)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
return result.LastInsertId()
|
|
}
|
|
|
|
const removeRole = `-- name: RemoveRole :exec
|
|
DELETE
|
|
FROM roles
|
|
WHERE role = ?
|
|
`
|
|
|
|
func (q *Queries) RemoveRole(ctx context.Context, role string) error {
|
|
_, err := q.db.ExecContext(ctx, removeRole, role)
|
|
return err
|
|
}
|