You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.2 KiB
54 lines
1.2 KiB
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.13.0
|
|
// source: stats.sql
|
|
|
|
package mysqlcore
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.aiterp.net/stufflog3/stufflog3-api/internal/sqltypes"
|
|
)
|
|
|
|
const listStats = `-- name: ListStats :many
|
|
SELECT id, name, description, weight, allowed_amounts FROM stat
|
|
WHERE scope_id = ?
|
|
`
|
|
|
|
type ListStatsRow struct {
|
|
ID int `json:"id"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Weight float64 `json:"weight"`
|
|
AllowedAmounts sqltypes.NullRawMessage `json:"allowed_amounts"`
|
|
}
|
|
|
|
func (q *Queries) ListStats(ctx context.Context, scopeID int) ([]ListStatsRow, error) {
|
|
rows, err := q.query(ctx, q.listStatsStmt, listStats, scopeID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []ListStatsRow{}
|
|
for rows.Next() {
|
|
var i ListStatsRow
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.Name,
|
|
&i.Description,
|
|
&i.Weight,
|
|
&i.AllowedAmounts,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Close(); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|