scanfile/server/internal/sqlc/queries-msoffice.sql.go

162 lines
4 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.29.0
// source: queries-msoffice.sql
package sqlc
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const getMSOfficeData = `-- name: GetMSOfficeData :one
SELECT t1.file_id, t1.data AS oleid, t2.data AS olevba, t3.data AS mraptor
FROM msoffice_oleid as t1
LEFT join msoffice_olevba AS t2 ON t2.file_id = t1.file_id
LEFT JOIN msoffice_mraptor AS t3 ON t3.file_id = t1.file_id
WHERE t1.file_id = $1
`
type GetMSOfficeDataRow struct {
FileID pgtype.UUID
Oleid []byte
Olevba []byte
Mraptor []byte
}
func (q *Queries) GetMSOfficeData(ctx context.Context, dollar_1 pgtype.UUID) (GetMSOfficeDataRow, error) {
row := q.db.QueryRow(ctx, getMSOfficeData, dollar_1)
var i GetMSOfficeDataRow
err := row.Scan(
&i.FileID,
&i.Oleid,
&i.Olevba,
&i.Mraptor,
)
return i, err
}
const getMSOfficeResults = `-- name: GetMSOfficeResults :one
SELECT id, file_id, verdict, container_format, encrypted, file_format, vba_macros, xlm_macros, vba_stomping, nb_autoexec, nb_iocs, nb_macros, nb_suspicious, olevba_results, macros FROM msoffice
WHERE file_id = $1
LIMIT 1
`
func (q *Queries) GetMSOfficeResults(ctx context.Context, fileID pgtype.UUID) (Msoffice, error) {
row := q.db.QueryRow(ctx, getMSOfficeResults, fileID)
var i Msoffice
err := row.Scan(
&i.ID,
&i.FileID,
&i.Verdict,
&i.ContainerFormat,
&i.Encrypted,
&i.FileFormat,
&i.VbaMacros,
&i.XlmMacros,
&i.VbaStomping,
&i.NbAutoexec,
&i.NbIocs,
&i.NbMacros,
&i.NbSuspicious,
&i.OlevbaResults,
&i.Macros,
)
return i, err
}
const insertFileMsofficeMraptor = `-- name: InsertFileMsofficeMraptor :exec
INSERT INTO msoffice_mraptor (
file_id, data
) VALUES ($1, $2)
`
type InsertFileMsofficeMraptorParams struct {
Column1 pgtype.UUID
Column2 []byte
}
func (q *Queries) InsertFileMsofficeMraptor(ctx context.Context, arg InsertFileMsofficeMraptorParams) error {
_, err := q.db.Exec(ctx, insertFileMsofficeMraptor, arg.Column1, arg.Column2)
return err
}
const insertFileMsofficeOleid = `-- name: InsertFileMsofficeOleid :exec
INSERT INTO msoffice_oleid (
file_id, data
) VALUES ($1, $2)
`
type InsertFileMsofficeOleidParams struct {
Column1 pgtype.UUID
Column2 []byte
}
func (q *Queries) InsertFileMsofficeOleid(ctx context.Context, arg InsertFileMsofficeOleidParams) error {
_, err := q.db.Exec(ctx, insertFileMsofficeOleid, arg.Column1, arg.Column2)
return err
}
const insertFileMsofficeOlevba = `-- name: InsertFileMsofficeOlevba :exec
INSERT INTO msoffice_olevba (
file_id, data
) VALUES ($1, $2)
`
type InsertFileMsofficeOlevbaParams struct {
Column1 pgtype.UUID
Column2 []byte
}
func (q *Queries) InsertFileMsofficeOlevba(ctx context.Context, arg InsertFileMsofficeOlevbaParams) error {
_, err := q.db.Exec(ctx, insertFileMsofficeOlevba, arg.Column1, arg.Column2)
return err
}
const insertMSOfficeResults = `-- name: InsertMSOfficeResults :exec
INSERT INTO msoffice (
file_id, verdict, container_format, encrypted, file_format, vba_macros, xlm_macros,
vba_stomping, nb_autoexec, nb_iocs, nb_macros, nb_suspicious, olevba_results, macros
) VALUES (
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14
)
`
type InsertMSOfficeResultsParams struct {
FileID pgtype.UUID
Verdict pgtype.Text
ContainerFormat pgtype.Text
Encrypted pgtype.Bool
FileFormat pgtype.Text
VbaMacros pgtype.Text
XlmMacros pgtype.Text
VbaStomping pgtype.Bool
NbAutoexec pgtype.Int4
NbIocs pgtype.Int4
NbMacros pgtype.Int4
NbSuspicious pgtype.Int4
OlevbaResults [][]string
Macros [][]string
}
func (q *Queries) InsertMSOfficeResults(ctx context.Context, arg InsertMSOfficeResultsParams) error {
_, err := q.db.Exec(ctx, insertMSOfficeResults,
arg.FileID,
arg.Verdict,
arg.ContainerFormat,
arg.Encrypted,
arg.FileFormat,
arg.VbaMacros,
arg.XlmMacros,
arg.VbaStomping,
arg.NbAutoexec,
arg.NbIocs,
arg.NbMacros,
arg.NbSuspicious,
arg.OlevbaResults,
arg.Macros,
)
return err
}