// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.30.0 // source: anos_formaturas.sql package generated import ( "context" "github.com/jackc/pgx/v5/pgtype" ) const createAnoFormatura = `-- name: CreateAnoFormatura :one INSERT INTO anos_formaturas (ano_semestre) VALUES ($1) RETURNING id, ano_semestre, criado_em ` func (q *Queries) CreateAnoFormatura(ctx context.Context, anoSemestre string) (AnosFormatura, error) { row := q.db.QueryRow(ctx, createAnoFormatura, anoSemestre) var i AnosFormatura err := row.Scan(&i.ID, &i.AnoSemestre, &i.CriadoEm) return i, err } const deleteAnoFormatura = `-- name: DeleteAnoFormatura :exec DELETE FROM anos_formaturas WHERE id = $1 ` func (q *Queries) DeleteAnoFormatura(ctx context.Context, id pgtype.UUID) error { _, err := q.db.Exec(ctx, deleteAnoFormatura, id) return err } const getAnoFormaturaByID = `-- name: GetAnoFormaturaByID :one SELECT id, ano_semestre, criado_em FROM anos_formaturas WHERE id = $1 ` func (q *Queries) GetAnoFormaturaByID(ctx context.Context, id pgtype.UUID) (AnosFormatura, error) { row := q.db.QueryRow(ctx, getAnoFormaturaByID, id) var i AnosFormatura err := row.Scan(&i.ID, &i.AnoSemestre, &i.CriadoEm) return i, err } const getAnoFormaturaByNome = `-- name: GetAnoFormaturaByNome :one SELECT id, ano_semestre, criado_em FROM anos_formaturas WHERE ano_semestre = $1 ` func (q *Queries) GetAnoFormaturaByNome(ctx context.Context, anoSemestre string) (AnosFormatura, error) { row := q.db.QueryRow(ctx, getAnoFormaturaByNome, anoSemestre) var i AnosFormatura err := row.Scan(&i.ID, &i.AnoSemestre, &i.CriadoEm) return i, err } const listAnosFormaturas = `-- name: ListAnosFormaturas :many SELECT id, ano_semestre, criado_em FROM anos_formaturas ORDER BY ano_semestre ` func (q *Queries) ListAnosFormaturas(ctx context.Context) ([]AnosFormatura, error) { rows, err := q.db.Query(ctx, listAnosFormaturas) if err != nil { return nil, err } defer rows.Close() var items []AnosFormatura for rows.Next() { var i AnosFormatura if err := rows.Scan(&i.ID, &i.AnoSemestre, &i.CriadoEm); err != nil { return nil, err } items = append(items, i) } if err := rows.Err(); err != nil { return nil, err } return items, nil } const updateAnoFormatura = `-- name: UpdateAnoFormatura :one UPDATE anos_formaturas SET ano_semestre = $2 WHERE id = $1 RETURNING id, ano_semestre, criado_em ` type UpdateAnoFormaturaParams struct { ID pgtype.UUID `json:"id"` AnoSemestre string `json:"ano_semestre"` } func (q *Queries) UpdateAnoFormatura(ctx context.Context, arg UpdateAnoFormaturaParams) (AnosFormatura, error) { row := q.db.QueryRow(ctx, updateAnoFormatura, arg.ID, arg.AnoSemestre) var i AnosFormatura err := row.Scan(&i.ID, &i.AnoSemestre, &i.CriadoEm) return i, err }