Loggest thy stuff
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

  1. // Code generated by sqlc. DO NOT EDIT.
  2. // versions:
  3. // sqlc v1.13.0
  4. // source: stats.sql
  5. package mysqlcore
  6. import (
  7. "context"
  8. "git.aiterp.net/stufflog3/stufflog3-api/internal/sqltypes"
  9. )
  10. const listStats = `-- name: ListStats :many
  11. SELECT id, name, description, weight, allowed_amounts FROM stat
  12. WHERE scope_id = ?
  13. `
  14. type ListStatsRow struct {
  15. ID int `json:"id"`
  16. Name string `json:"name"`
  17. Description string `json:"description"`
  18. Weight float64 `json:"weight"`
  19. AllowedAmounts sqltypes.NullRawMessage `json:"allowed_amounts"`
  20. }
  21. func (q *Queries) ListStats(ctx context.Context, scopeID int) ([]ListStatsRow, error) {
  22. rows, err := q.query(ctx, q.listStatsStmt, listStats, scopeID)
  23. if err != nil {
  24. return nil, err
  25. }
  26. defer rows.Close()
  27. items := []ListStatsRow{}
  28. for rows.Next() {
  29. var i ListStatsRow
  30. if err := rows.Scan(
  31. &i.ID,
  32. &i.Name,
  33. &i.Description,
  34. &i.Weight,
  35. &i.AllowedAmounts,
  36. ); err != nil {
  37. return nil, err
  38. }
  39. items = append(items, i)
  40. }
  41. if err := rows.Close(); err != nil {
  42. return nil, err
  43. }
  44. if err := rows.Err(); err != nil {
  45. return nil, err
  46. }
  47. return items, nil
  48. }