// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.30.0
// source: file_types.sql

package sqlcgen

import (
	"context"
)

const createFileType = `-- name: CreateFileType :one
INSERT INTO file_types (extension) VALUES (?)
RETURNING id, extension
`

func (q *Queries) CreateFileType(ctx context.Context, extension string) (FileType, error) {
	row := q.db.QueryRowContext(ctx, createFileType, extension)
	var i FileType
	err := row.Scan(&i.ID, &i.Extension)
	return i, err
}

const deleteFileType = `-- name: DeleteFileType :exec
DELETE FROM file_types 
WHERE id =?
`

func (q *Queries) DeleteFileType(ctx context.Context, id int64) error {
	_, err := q.db.ExecContext(ctx, deleteFileType, id)
	return err
}

const getFileType = `-- name: GetFileType :one
SELECT id, extension FROM file_types 
WHERE id = ? LIMIT 1
`

func (q *Queries) GetFileType(ctx context.Context, id int64) (FileType, error) {
	row := q.db.QueryRowContext(ctx, getFileType, id)
	var i FileType
	err := row.Scan(&i.ID, &i.Extension)
	return i, err
}

const updateFileType = `-- name: UpdateFileType :exec
UPDATE file_types 
SET extension = ?
WHERE id =?
`

type UpdateFileTypeParams struct {
	Extension string
	ID        int64
}

func (q *Queries) UpdateFileType(ctx context.Context, arg UpdateFileTypeParams) error {
	_, err := q.db.ExecContext(ctx, updateFileType, arg.Extension, arg.ID)
	return err
}
