65 lines
1.7 KiB
Go
65 lines
1.7 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
// source: component_status_history.sql
|
|
|
|
package db
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
const createComponentStatusHistory = `-- name: CreateComponentStatusHistory :one
|
|
INSERT INTO component_status_history (
|
|
component_item_id, old_status, new_status,
|
|
changed_quantity, note, changed_by, changed_at
|
|
)
|
|
VALUES (
|
|
$1,
|
|
$2,
|
|
$3,
|
|
$4,
|
|
$5,
|
|
$6,
|
|
$7
|
|
)
|
|
RETURNING id, component_item_id, old_status, new_status, changed_quantity, note, changed_by, changed_at
|
|
`
|
|
|
|
type CreateComponentStatusHistoryParams struct {
|
|
ComponentItemID int64 `db:"component_item_id" json:"componentItemId"`
|
|
OldStatus NullComponentItemStatusEnum `db:"old_status" json:"oldStatus"`
|
|
NewStatus ComponentItemStatusEnum `db:"new_status" json:"newStatus"`
|
|
ChangedQuantity pgtype.Int4 `db:"changed_quantity" json:"changedQuantity"`
|
|
Note pgtype.Text `db:"note" json:"note"`
|
|
ChangedBy pgtype.Text `db:"changed_by" json:"changedBy"`
|
|
ChangedAt time.Time `db:"changed_at" json:"changedAt"`
|
|
}
|
|
|
|
func (q *Queries) CreateComponentStatusHistory(ctx context.Context, arg CreateComponentStatusHistoryParams) (ComponentStatusHistory, error) {
|
|
row := q.db.QueryRow(ctx, createComponentStatusHistory,
|
|
arg.ComponentItemID,
|
|
arg.OldStatus,
|
|
arg.NewStatus,
|
|
arg.ChangedQuantity,
|
|
arg.Note,
|
|
arg.ChangedBy,
|
|
arg.ChangedAt,
|
|
)
|
|
var i ComponentStatusHistory
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.ComponentItemID,
|
|
&i.OldStatus,
|
|
&i.NewStatus,
|
|
&i.ChangedQuantity,
|
|
&i.Note,
|
|
&i.ChangedBy,
|
|
&i.ChangedAt,
|
|
)
|
|
return i, err
|
|
}
|