func (db *DB) DeleteFlag(id int64) error {
	result, err := db.Exec("DELETE FROM flag WHERE id=$1;", id)
	if err != nil {
		return err
	}
	count, err := result.RowsAffected()
	if err != nil {
		return err
	}
	if count == 0 {
		return sql.ErrNoRows
	}
	return nil
}
DeleteFlag deletes a single flag from the database
package database
import (
	"database/sql"
	"github.com/nsec/askgod/api"
	"github.com/nsec/askgod/internal/utils"
)
func (db *DB) GetFlags() ([]api.AdminFlag, error) {
	resp := []api.AdminFlag{}
	rows, err := db.Query("SELECT id, flag, value, return_string, description, tags FROM flag ORDER BY id ASC;")
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	for rows.Next() {
		row := api.AdminFlag{}
		tags := ""
		err := rows.Scan(&row.ID, &row.Flag, &row.Value, &row.ReturnString, &row.Description, &tags)
		if err != nil {
			return nil, err
		}
		row.Tags, err = utils.ParseTags(tags)
		if err != nil {
			return nil, err
		}
		resp = append(resp, row)
	}
	err = rows.Err()
	if err != nil {
		return nil, err
	}
	return resp, nil
}
func (db *DB) GetFlag(id int64) (*api.AdminFlag, error) {
	row := api.AdminFlag{}
	tags := ""
	err := db.QueryRow("SELECT id, flag, value, return_string, description, tags FROM flag WHERE id=$1;", id).Scan(
		&row.ID, &row.Flag, &row.Value, &row.ReturnString, &row.Description, &tags)
	if err != nil {
		return nil, err
	}
	row.Tags, err = utils.ParseTags(tags)
	if err != nil {
		return nil, err
	}
	return &row, nil
}
func (db *DB) CreateFlag(flag api.AdminFlagPost) (int64, error) {
	id := int64(-1)
	err := db.QueryRow("INSERT INTO flag (flag, value, return_string, description, tags) VALUES ($1, $2, $3, $4, $5) RETURNING id",
		flag.Flag, flag.Value, flag.ReturnString, flag.Description, utils.PackTags(flag.Tags)).Scan(&id)
	if err != nil {
		return -1, err
	}
	return id, nil
}
func (db *DB) UpdateFlag(id int64, flag api.AdminFlagPut) error {
	result, err := db.Exec("UPDATE flag SET flag=$1, value=$2, return_string=$3, description=$4, tags=$5 WHERE id=$6;",
		flag.Flag, flag.Value, flag.ReturnString, flag.Description, utils.PackTags(flag.Tags), id)
	if err != nil {
		return err
	}
	count, err := result.RowsAffected()
	if err != nil {
		return err
	}
	if count == 0 {
		return sql.ErrNoRows
	}
	return nil
}