/
Arsinenko
/
CompClubAPI_Go
Обзор
Документация
Войти
/
Arsinenko
/
CompClubAPI_Go
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
internal/database/gen/workings_spaces.sql.go
126 строк
3 KB
Arsinenko
Working space update
17 ноя 2025, 17:41
17 ноя 2025, 17:41
d647065
Код
Авторство
О чём код?
// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.30.0 // source: workings_spaces.sql package gen import ( "context" "database/sql" ) const createWorkingSpace = `-- name: CreateWorkingSpace :one insert into working_spaces (club, tariff) values ($1, $2) returning id, enabled, club, tariff ` type CreateWorkingSpaceParams struct { Club string Tariff string } func (q *Queries) CreateWorkingSpace(ctx context.Context, arg CreateWorkingSpaceParams) (WorkingSpace, error) { row := q.db.QueryRowContext(ctx, createWorkingSpace, arg.Club, arg.Tariff) var i WorkingSpace err := row.Scan( &i.ID, &i.Enabled, &i.Club, &i.Tariff, ) return i, err } const getWorkingSpace = `-- name: GetWorkingSpace :one select id, enabled, club, tariff from working_spaces where id = $1 ` func (q *Queries) GetWorkingSpace(ctx context.Context, id int32) (WorkingSpace, error) { row := q.db.QueryRowContext(ctx, getWorkingSpace, id) var i WorkingSpace err := row.Scan( &i.ID, &i.Enabled, &i.Club, &i.Tariff, ) return i, err } const getWorkingSpaces = `-- name: GetWorkingSpaces :many select id, enabled, club, tariff from working_spaces ` func (q *Queries) GetWorkingSpaces(ctx context.Context) ([]WorkingSpace, error) { rows, err := q.db.QueryContext(ctx, getWorkingSpaces) if err != nil { return nil, err } defer rows.Close() var items []WorkingSpace for rows.Next() { var i WorkingSpace if err := rows.Scan( &i.ID, &i.Enabled, &i.Club, &i.Tariff, ); err != nil { return nil, err } items = append(items, i) } if err := rows.Close(); err != nil { return nil, err } if err := rows.Err(); err != nil { return nil, err } return items, nil } const updateStatus = `-- name: UpdateStatus :one update working_spaces set enabled = $2 where id = $1 returning id, enabled, club, tariff ` type UpdateStatusParams struct { ID int32 Enabled sql.NullBool } func (q *Queries) UpdateStatus(ctx context.Context, arg UpdateStatusParams) (WorkingSpace, error) { row := q.db.QueryRowContext(ctx, updateStatus, arg.ID, arg.Enabled) var i WorkingSpace err := row.Scan( &i.ID, &i.Enabled, &i.Club, &i.Tariff, ) return i, err } const updateWorkingSpaceTariff = `-- name: UpdateWorkingSpaceTariff :one update working_spaces set tariff = $2 where id = $1 returning id, enabled, club, tariff ` type UpdateWorkingSpaceTariffParams struct { ID int32 Tariff string } func (q *Queries) UpdateWorkingSpaceTariff(ctx context.Context, arg UpdateWorkingSpaceTariffParams) (WorkingSpace, error) { row := q.db.QueryRowContext(ctx, updateWorkingSpaceTariff, arg.ID, arg.Tariff) var i WorkingSpace err := row.Scan( &i.ID, &i.Enabled, &i.Club, &i.Tariff, ) return i, err }