dbconn
This commit is contained in:
@@ -11,6 +11,47 @@ import (
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
const createQuery = `-- name: CreateQuery :one
|
||||
INSERT INTO queries (type) VALUES ($1) RETURNING id
|
||||
`
|
||||
|
||||
func (q *Queries) CreateQuery(ctx context.Context, type_ Querytype) (pgtype.UUID, error) {
|
||||
row := q.db.QueryRow(ctx, createQuery, type_)
|
||||
var id pgtype.UUID
|
||||
err := row.Scan(&id)
|
||||
return id, err
|
||||
}
|
||||
|
||||
const createQueryConfig = `-- name: CreateQueryConfig :exec
|
||||
INSERT INTO queryConfigs (queryId, config, addedVersion) VALUES ($1, $2, $3)
|
||||
`
|
||||
|
||||
type CreateQueryConfigParams struct {
|
||||
Queryid pgtype.UUID
|
||||
Config []byte
|
||||
Addedversion int32
|
||||
}
|
||||
|
||||
func (q *Queries) CreateQueryConfig(ctx context.Context, arg CreateQueryConfigParams) error {
|
||||
_, err := q.db.Exec(ctx, createQueryConfig, arg.Queryid, arg.Config, arg.Addedversion)
|
||||
return err
|
||||
}
|
||||
|
||||
const createRequiredQuery = `-- name: CreateRequiredQuery :exec
|
||||
INSERT INTO requiredQueries (queryId, requiredQueryId, addedVersion) VALUES ($1, $2, $3)
|
||||
`
|
||||
|
||||
type CreateRequiredQueryParams struct {
|
||||
Queryid pgtype.UUID
|
||||
Requiredqueryid pgtype.UUID
|
||||
Addedversion int32
|
||||
}
|
||||
|
||||
func (q *Queries) CreateRequiredQuery(ctx context.Context, arg CreateRequiredQueryParams) error {
|
||||
_, err := q.db.Exec(ctx, createRequiredQuery, arg.Queryid, arg.Requiredqueryid, arg.Addedversion)
|
||||
return err
|
||||
}
|
||||
|
||||
const deprecateQuery = `-- name: DeprecateQuery :exec
|
||||
INSERT INTO queryDeprecations (queryId) VALUES ($1)
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user