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.

218 lines
7.7 KiB

  1. // Code generated by sqlc. DO NOT EDIT.
  2. // versions:
  3. // sqlc v1.13.0
  4. package mysqlcore
  5. import (
  6. "context"
  7. "database/sql"
  8. "fmt"
  9. )
  10. type DBTX interface {
  11. ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
  12. PrepareContext(context.Context, string) (*sql.Stmt, error)
  13. QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
  14. QueryRowContext(context.Context, string, ...interface{}) *sql.Row
  15. }
  16. func New(db DBTX) *Queries {
  17. return &Queries{db: db}
  18. }
  19. func Prepare(ctx context.Context, db DBTX) (*Queries, error) {
  20. q := Queries{db: db}
  21. var err error
  22. if q.deleteAllScopeMembersStmt, err = db.PrepareContext(ctx, deleteAllScopeMembers); err != nil {
  23. return nil, fmt.Errorf("error preparing query DeleteAllScopeMembers: %w", err)
  24. }
  25. if q.deleteScopeStmt, err = db.PrepareContext(ctx, deleteScope); err != nil {
  26. return nil, fmt.Errorf("error preparing query DeleteScope: %w", err)
  27. }
  28. if q.deleteScopeMemberStmt, err = db.PrepareContext(ctx, deleteScopeMember); err != nil {
  29. return nil, fmt.Errorf("error preparing query DeleteScopeMember: %w", err)
  30. }
  31. if q.getScopeStmt, err = db.PrepareContext(ctx, getScope); err != nil {
  32. return nil, fmt.Errorf("error preparing query GetScope: %w", err)
  33. }
  34. if q.getScopeDisplayNameStmt, err = db.PrepareContext(ctx, getScopeDisplayName); err != nil {
  35. return nil, fmt.Errorf("error preparing query GetScopeDisplayName: %w", err)
  36. }
  37. if q.getScopeWithDisplayNameStmt, err = db.PrepareContext(ctx, getScopeWithDisplayName); err != nil {
  38. return nil, fmt.Errorf("error preparing query GetScopeWithDisplayName: %w", err)
  39. }
  40. if q.insertScopeStmt, err = db.PrepareContext(ctx, insertScope); err != nil {
  41. return nil, fmt.Errorf("error preparing query InsertScope: %w", err)
  42. }
  43. if q.listProjectEntriesStmt, err = db.PrepareContext(ctx, listProjectEntries); err != nil {
  44. return nil, fmt.Errorf("error preparing query ListProjectEntries: %w", err)
  45. }
  46. if q.listScopeMembersStmt, err = db.PrepareContext(ctx, listScopeMembers); err != nil {
  47. return nil, fmt.Errorf("error preparing query ListScopeMembers: %w", err)
  48. }
  49. if q.listScopesStmt, err = db.PrepareContext(ctx, listScopes); err != nil {
  50. return nil, fmt.Errorf("error preparing query ListScopes: %w", err)
  51. }
  52. if q.listScopesByUserStmt, err = db.PrepareContext(ctx, listScopesByUser); err != nil {
  53. return nil, fmt.Errorf("error preparing query ListScopesByUser: %w", err)
  54. }
  55. if q.listStatsStmt, err = db.PrepareContext(ctx, listStats); err != nil {
  56. return nil, fmt.Errorf("error preparing query ListStats: %w", err)
  57. }
  58. if q.updateScopeStmt, err = db.PrepareContext(ctx, updateScope); err != nil {
  59. return nil, fmt.Errorf("error preparing query UpdateScope: %w", err)
  60. }
  61. if q.updateScopeMemberStmt, err = db.PrepareContext(ctx, updateScopeMember); err != nil {
  62. return nil, fmt.Errorf("error preparing query UpdateScopeMember: %w", err)
  63. }
  64. return &q, nil
  65. }
  66. func (q *Queries) Close() error {
  67. var err error
  68. if q.deleteAllScopeMembersStmt != nil {
  69. if cerr := q.deleteAllScopeMembersStmt.Close(); cerr != nil {
  70. err = fmt.Errorf("error closing deleteAllScopeMembersStmt: %w", cerr)
  71. }
  72. }
  73. if q.deleteScopeStmt != nil {
  74. if cerr := q.deleteScopeStmt.Close(); cerr != nil {
  75. err = fmt.Errorf("error closing deleteScopeStmt: %w", cerr)
  76. }
  77. }
  78. if q.deleteScopeMemberStmt != nil {
  79. if cerr := q.deleteScopeMemberStmt.Close(); cerr != nil {
  80. err = fmt.Errorf("error closing deleteScopeMemberStmt: %w", cerr)
  81. }
  82. }
  83. if q.getScopeStmt != nil {
  84. if cerr := q.getScopeStmt.Close(); cerr != nil {
  85. err = fmt.Errorf("error closing getScopeStmt: %w", cerr)
  86. }
  87. }
  88. if q.getScopeDisplayNameStmt != nil {
  89. if cerr := q.getScopeDisplayNameStmt.Close(); cerr != nil {
  90. err = fmt.Errorf("error closing getScopeDisplayNameStmt: %w", cerr)
  91. }
  92. }
  93. if q.getScopeWithDisplayNameStmt != nil {
  94. if cerr := q.getScopeWithDisplayNameStmt.Close(); cerr != nil {
  95. err = fmt.Errorf("error closing getScopeWithDisplayNameStmt: %w", cerr)
  96. }
  97. }
  98. if q.insertScopeStmt != nil {
  99. if cerr := q.insertScopeStmt.Close(); cerr != nil {
  100. err = fmt.Errorf("error closing insertScopeStmt: %w", cerr)
  101. }
  102. }
  103. if q.listProjectEntriesStmt != nil {
  104. if cerr := q.listProjectEntriesStmt.Close(); cerr != nil {
  105. err = fmt.Errorf("error closing listProjectEntriesStmt: %w", cerr)
  106. }
  107. }
  108. if q.listScopeMembersStmt != nil {
  109. if cerr := q.listScopeMembersStmt.Close(); cerr != nil {
  110. err = fmt.Errorf("error closing listScopeMembersStmt: %w", cerr)
  111. }
  112. }
  113. if q.listScopesStmt != nil {
  114. if cerr := q.listScopesStmt.Close(); cerr != nil {
  115. err = fmt.Errorf("error closing listScopesStmt: %w", cerr)
  116. }
  117. }
  118. if q.listScopesByUserStmt != nil {
  119. if cerr := q.listScopesByUserStmt.Close(); cerr != nil {
  120. err = fmt.Errorf("error closing listScopesByUserStmt: %w", cerr)
  121. }
  122. }
  123. if q.listStatsStmt != nil {
  124. if cerr := q.listStatsStmt.Close(); cerr != nil {
  125. err = fmt.Errorf("error closing listStatsStmt: %w", cerr)
  126. }
  127. }
  128. if q.updateScopeStmt != nil {
  129. if cerr := q.updateScopeStmt.Close(); cerr != nil {
  130. err = fmt.Errorf("error closing updateScopeStmt: %w", cerr)
  131. }
  132. }
  133. if q.updateScopeMemberStmt != nil {
  134. if cerr := q.updateScopeMemberStmt.Close(); cerr != nil {
  135. err = fmt.Errorf("error closing updateScopeMemberStmt: %w", cerr)
  136. }
  137. }
  138. return err
  139. }
  140. func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) {
  141. switch {
  142. case stmt != nil && q.tx != nil:
  143. return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...)
  144. case stmt != nil:
  145. return stmt.ExecContext(ctx, args...)
  146. default:
  147. return q.db.ExecContext(ctx, query, args...)
  148. }
  149. }
  150. func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) {
  151. switch {
  152. case stmt != nil && q.tx != nil:
  153. return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...)
  154. case stmt != nil:
  155. return stmt.QueryContext(ctx, args...)
  156. default:
  157. return q.db.QueryContext(ctx, query, args...)
  158. }
  159. }
  160. func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) *sql.Row {
  161. switch {
  162. case stmt != nil && q.tx != nil:
  163. return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...)
  164. case stmt != nil:
  165. return stmt.QueryRowContext(ctx, args...)
  166. default:
  167. return q.db.QueryRowContext(ctx, query, args...)
  168. }
  169. }
  170. type Queries struct {
  171. db DBTX
  172. tx *sql.Tx
  173. deleteAllScopeMembersStmt *sql.Stmt
  174. deleteScopeStmt *sql.Stmt
  175. deleteScopeMemberStmt *sql.Stmt
  176. getScopeStmt *sql.Stmt
  177. getScopeDisplayNameStmt *sql.Stmt
  178. getScopeWithDisplayNameStmt *sql.Stmt
  179. insertScopeStmt *sql.Stmt
  180. listProjectEntriesStmt *sql.Stmt
  181. listScopeMembersStmt *sql.Stmt
  182. listScopesStmt *sql.Stmt
  183. listScopesByUserStmt *sql.Stmt
  184. listStatsStmt *sql.Stmt
  185. updateScopeStmt *sql.Stmt
  186. updateScopeMemberStmt *sql.Stmt
  187. }
  188. func (q *Queries) WithTx(tx *sql.Tx) *Queries {
  189. return &Queries{
  190. db: tx,
  191. tx: tx,
  192. deleteAllScopeMembersStmt: q.deleteAllScopeMembersStmt,
  193. deleteScopeStmt: q.deleteScopeStmt,
  194. deleteScopeMemberStmt: q.deleteScopeMemberStmt,
  195. getScopeStmt: q.getScopeStmt,
  196. getScopeDisplayNameStmt: q.getScopeDisplayNameStmt,
  197. getScopeWithDisplayNameStmt: q.getScopeWithDisplayNameStmt,
  198. insertScopeStmt: q.insertScopeStmt,
  199. listProjectEntriesStmt: q.listProjectEntriesStmt,
  200. listScopeMembersStmt: q.listScopeMembersStmt,
  201. listScopesStmt: q.listScopesStmt,
  202. listScopesByUserStmt: q.listScopesByUserStmt,
  203. listStatsStmt: q.listStatsStmt,
  204. updateScopeStmt: q.updateScopeStmt,
  205. updateScopeMemberStmt: q.updateScopeMemberStmt,
  206. }
  207. }